Jump to content

Recommended Posts

Script Example (which I use in my mission):

 

[
 Truck,
 "<t color='#58D68D'>Enganchar UH60</t>",
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
 "(_this distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
 "(_Caller distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
 {},
 {},
 {
   null = ["Scripts\Interacciones\Remolcador\Soltar_Heli_1.sqf","BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;
   [Truck,_actionId] call BIS_fnc_holdActionRemove;
 },
 {},
 [],
 5,
 6,
 true,
 false
] remoteExec ["BIS_fnc_holdActionAdd", 0, Truck];

 

____________________________________________________________________________________________________________________

 

When I put this Script in my Init.sqf file, one appears every time a player joins my dedicated server. Is there a way to fix that? the problem is where do I put my script? or is it a typical Arma 3 problem?

Share this post


Link to post
Share on other sites

The server and every client calls init.sqf when joining, and your script broadcasts the command to everyone so you get duplicates.

You could either remoteExec your command from the server (with the JIP parameter set to true), or call it from init.sqf or initPlayerLocal.sqf instead of remoteExec.

Share this post


Link to post
Share on other sites

BIS_fnc_holdActionAdd needs to be executed on every client.

 

If you let the server handle this from init.sqf it would look something like this (the isServer check is critical here, or you'd end up with the same problem of having duplicate actions):

Spoiler

// init.sqf

if (isServer) then {
	[
		 Truck,
		"<t color='#58D68D'>Enganchar UH60</t>",
		"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
		"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
		"(_this distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
		"(_caller distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
		{},
		{},
		{
			params ["_target","_caller","_actionId","_arguments","_progress","_maxProgress"];
			[Truck,_actionId] call BIS_fnc_holdActionRemove;
			_null = ["Scripts\Interacciones\Remolcador\Soltar_Heli_1.sqf","BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;
		},
		{},
		[],
		5,
		6,
		true,
		false
	] remoteExec ["BIS_fnc_holdActionAdd",0,Truck]; 
};

 

 

If you let the client handle this from init.sqf it would look something like this:

Spoiler

// init.sqf

[
	 Truck,
	"<t color='#58D68D'>Enganchar UH60</t>",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",
	"(_this distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
	"(_caller distance _target < 3) && (Truck_Bar distance Heli_1 < 10)",
	{},
	{},
	{
		params ["_target","_caller","_actionId","_arguments","_progress","_maxProgress"];
		[Truck,_actionId] call BIS_fnc_holdActionRemove;
		_null = ["Scripts\Interacciones\Remolcador\Soltar_Heli_1.sqf","BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;
	},
	{},
	[],
	5,
	6,
	true,
	false
] call BIS_fnc_holdActionAdd; 

 

 

There are better/more elegant solutions for how to call your function and what is happening inside it, but this should quickly do the trick using your own script.

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

×