Jump to content
Stormmy1950

Earplugs in multiplayer

Recommended Posts

so i have the script that works when the players join at the same time but i wanted to add when players join on a random time to still have earplugs and i added JIP but not correcly if somebody can tell me how to add JIP correclty i have error Missing ]

[
player addAction ["Enable earuplugs ",{ 
        params ["_plyr","_caller","_id"]; 
        private _actMenu = (_plyr actionParams _id) select 0;
        if (_actMenu isEqualTo "Disable earuplugs") then {
          _actMenu = "Enable earuplugs";
          call disableEarplugs;
        } else {
          _actMenu = "Disable earuplugs";
          call enableEarplugs;
        };
        _plyr setUserActionText [_id,_actMenu];
      },nil,0.8,false,true,"", ""],
] call BIS_fnc_MP;

 

  • Like 1

Share this post


Link to post
Share on other sites

Hello there Stormmy1950!

 

There is also this if you want to check:

 

Share this post


Link to post
Share on other sites

Can you paste the code?

or give a link to download?

 

this is fixed:

player addAction ["Enable earuplugs ",{ 
        params ["_plyr","_caller","_id"]; 
        private _actMenu = (_plyr actionParams _id) select 0;
        if (_actMenu isEqualTo "Disable earuplugs") then {
          _actMenu = "Enable earuplugs";
          call disableEarplugs;
        } else {
          _actMenu = "Disable earuplugs";
          call enableEarplugs;
        };
        _plyr setUserActionText [_id,_actMenu];
      },nil,0.8,false,true,"", ""]call BIS_fnc_MP;

 

Share this post


Link to post
Share on other sites

There is no need to use BIS_fnc_MP or remoteExec unless I have misunderstood. What do you mean on the same time? The action being added to JIP players? Just add it init.sqf / initPlayerLocal.sqf or in another script called from there.

  • Like 2

Share this post


Link to post
Share on other sites

I do not understand why jip is needed. Here is my mp version...

 

description.ext

class CfgFunctions {

	//dub functions
	#include "dub\CfgFunctions.hpp"

	
};

initPlayerLocal.sqf

/*****************************************************************
//Earbud Functions (dub functions)
****************************************************************/
call dub_fnc_earbuds;

fn_earbuds.sqf

/**dub 2016**/
buds = 
["<t color='#33ccff'>Earbuds</t>",
		{	
			_i = _this select 2;
			if (soundVolume == 1) then 
			{
				hintSilent "Inserting earbuds...";
				2 fadeSound 0.1;
				player setUserActionText [_i,"<t color='#ffcc33'>Remove Earbuds</t>"];
			} 
			else 
			{
				hintSilent "Removing earbuds...";
				2 fadeSound 1;
				player setUserActionText [_i,"<t color='#33ccff'>Insert Earbuds</t>"];
			}
		},
		[],
		-90,
		false,
		true,
		"",
		"_target == vehicle player"
];

player addAction buds;
player addEventHandler 
[
	"Respawn",
	{
		2 fadeSound 1;
		player addAction buds;
	}
];

~dub

  • Like 2

Share this post


Link to post
Share on other sites

ty for that @thedubl sorry i wasnt active  i was away today so yea i will test that script and give it a feed back later

Share this post


Link to post
Share on other sites

you could try something as simple as 

 

add the below lines into initPlayerLocal.sqf

 

_player addAction ["Remove Ear Muffs" , {1 fadeSound 1},0,1,false,false,"","(soundVolume < 1)"];
_player addAction ["Wear Ear Muffs" , {1 fadeSound 0.15},0,1,false,false,"","(soundVolume == 1)"];

  • Like 2

Share this post


Link to post
Share on other sites
28 minutes ago, zonekiller said:

you could try something as simple as 

 

add the below lines into initPlayerLocal.sqf

 

_player addAction ["Remove Ear Muffs" , {1 fadeSound 1},0,1,false,false,"","(soundVolume < 1)"];
_player addAction ["Wear Ear Muffs" , {1 fadeSound 0.15},0,1,false,false,"","(soundVolume == 1)"];

Still would need a respawn event handler. Otherwise, upon respawn the addaction will not exist.

Share this post


Link to post
Share on other sites
On 6/3/2018 at 10:12 PM, GEORGE FLOROS GR said:

There is also this if you want to check:

 

 

IzDvX7NoTdqPVCYYjqK7XQ.png

 

Share this post


Link to post
Share on other sites
On 3/8/2018 at 11:44 AM, zonekiller said:

you could try something as simple as 

 

add the below lines into initPlayerLocal.sqf

 

_player addAction ["Remove Ear Muffs" , {1 fadeSound 1},0,1,false,false,"","(soundVolume < 1)"];
_player addAction ["Wear Ear Muffs" , {1 fadeSound 0.15},0,1,false,false,"","(soundVolume == 1)"];

 

You can also put this into one addAction:

 

GOM_earplugID = player addAction ["Earplugs Off",{

	_plugState = missionNamespace getVariable ["GOM_fnc_plugState",false];
	1 fadeSound ([1,0.15] select _plugState);
	player setUserActionText [GOM_earplugID, ["Earplugs On","Earplugs Off"] select _plugState];
	missionNamespace setVariable ["GOM_fnc_plugState",!_plugState];

},0,1,false,false,"","_target isEqualTo _this"];

Also I wouldn't use soundVolume for checks, since the returned value will not gradually change over time, it will immediately take the value set by fadeSound, no matter the time parameter.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×