Jump to content
suffer4real

[BASICS] Ear Plugs

Recommended Posts

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Difficulty: Easy

Publish by:  suffer4real

Source AltisLifeRPG.com cache

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

hello,
Here is a tutorial on how to add ear plugs to your server.

Difficulty:  Copy & Paste

_____________________________________________________________________________________________________________________________________

1. Navigate to your mission's root and enter core then functions. Open up fn_keyHandler.sqf and paste in the following:

case 207:
    {
	if(_shift) then {
		switch (player getVariable["Earplugs",0]) do {
			case 0: {hintSilent "Ear Plugs 90%"; 1 fadeSound 0.1; player setVariable ["Earplugs", 10]; };
			case 10: {hintSilent "Ear Plugs 60%"; 1 fadeSound 0.4; player setVariable ["Earplugs", 40]; };
			case 40: {hintSilent "Ear Plugs 30%"; 1 fadeSound 0.7; player setVariable ["Earplugs", 70]; };
			case 70: {hintSilent "Ear Plugs Removed"; 1 fadeSound 1; player setVariable ["Earplugs", 0]; };
		    };
	   };
   };

1.5. Make sure that your formatting is correct otherwise you will experience some problems...

2. ReCompile your .pbo and restart your server

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
On 9/19/2016 at 3:29 PM, NotImpor7ant said:

4.4R3 has earplugs built in with shift + o

Incase anyone is using 4.4R3 there is no need to do this.

You do if you want the different amount of fade. Shift + o only fades 1 way.

Share this post


Link to post
Share on other sites

But this system is better; i have one problem, i have the beatiful HUD and icons too but when i put ear plugs on the hud doesnt show me

Share this post


Link to post
Share on other sites

That would be a problem with the HUD, re-do the tut for it. This system is..ok but it (at least for my players) is annoying to deal with. Instead of pressing a button once to put earplugs, and pressing it once more to take them out, you have to press it multiple times.

Share this post


Link to post
Share on other sites
Quote

i have the beatiful HUD and icons too but when i put ear plugs on the hud doesnt show me

It is a problem with the HUD. If ear-plugs work and the HUD icon doesn't, the HUD is the problem. Look back through your HUD tutorial and make sure you followed the instructions for ear-plugs correctly. Double that the variable it is using is the correct variable. You may also need to edit the variable's value is the correct value.

Share this post


Link to post
Share on other sites
On 5/19/2019 at 2:25 AM, FibraWin said:

But this system is better; i have one problem, i have the beatiful HUD and icons too but when i put ear plugs on the hud doesnt show me

This depends what HUD you are using. If you mean Repentz's HUD, you need to edit to set the life_fadeSound variable as he puts in his code (the comments have this part outlined for the default earplugs on that thread). This code outlined here has nothing to do with the HUD and would never show.

Share this post


Link to post
Share on other sites

Thanks this helped me alot! 

2 hours ago, imthatguyhere said:

This depends what HUD you are using. If you mean Repentz's HUD, you need to edit to set the life_fadeSound variable as he puts in his code (the comments have this part outlined for the default earplugs on that thread). This code outlined here has nothing to do with the HUD and would never show.

 

Share this post


Link to post
Share on other sites

i did the following:

--KEY HANDLER--

//O Key
    case 24:
    {
    if(_shift) then {
        switch (player getVariable["life_fadeSound",0]) do {
            case 0: {hintSilent "Volume ambientale diminuito del 90%"; 1 fadeSound 0.1; player setVariable ["life_fadeSound", 10]; };
            call life_fnc_hudUpdate;
            case 10: {hintSilent "Volume ambientale diminuito del 70%"; 1 fadeSound 0.4; player setVariable ["life_fadeSound", 40]; };
            call life_fnc_hudUpdate;
            case 40: {hintSilent "Volume ambientale diminuito del 30%"; 1 fadeSound 0.7; player setVariable ["life_fadeSound", 70]; };
            call life_fnc_hudUpdate;
            case 70: {hintSilent "Volume ripristinato!"; 1 fadeSound 1; player setVariable ["life_fadeSound", 0]; };
            call life_fnc_hudUpdate;
            };
       };
   };

 

--FN_FADESOUND--
 if (life_fadeSound) then
    {
        1 fadeSound 0.1;
        call life_fnc_hudUpdate;
    } else {
        1 fadeSound 1;
        call life_fnc_hudUpdate;
};

 

--HUDUPDATE--

if(!isNil "life_fadeSound") then
{
    if(life_fadeSound) then
    {
        LIFEctrl(IDC_LIFE_BAR_Speaker) ctrlSetText "C:\Program Files (x86)\Steam\steamapps\common\Arma 3\MPMissions\Altis_Life.Altis\textures\HUD\earplugsY.paa";
    } else {
        LIFEctrl(IDC_LIFE_BAR_Speaker) ctrlSetText "C:\Program Files (x86)\Steam\steamapps\common\Arma 3\MPMissions\Altis_Life.Altis\textures\HUD\earplugsN.paa";
    };
};

 

but the icon doesnt appear as the plugs in usage

Edited by FibraWin

Share this post


Link to post
Share on other sites
10 hours ago, FibraWin said:

i did the following:

...

but the icon doesnt appear as the plugs in usage

What is fn_fadeSound? From your snippets it never gets called.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...