Jump to content
Sign in to follow this  
reaper lok

Simple Script to working for client

Recommended Posts

I am trying to edit this script to be available so all clients joining the server can use the functionality of the FLAG and the AMMO BOX (VAS Script). So far it all works but only for the player that executes the script via an addAction. My guess is that I am missing a very simple line of code or that I am a complete noob at script commands and their functionality - either way any help is appreciated. I did search and spent 3 hours researching my problem prior to posting - thanx.

// No dedicated

if (isDedicated) exitWith {};

_veh = _this select 0;

_man = _this select 1;

// What to execute

_option = (_this select 3) select 0;

// Exec only at caller

//if (_man != player) exitWith {};

// Deploy

if (_option == "Deploy") exitWith {

// Exit if in vehicle

if (vehicle _man != player) then {

hint "You must dissembark before you can perform this action.";

} else {

if (isEngineOn _veh) then {

hint "You must turn engine off before you can perform this action.";

} else {

_veh setFuel 0;

_man playMove "AinvPknlMstpSlayWrflDnon_medic";

sleep 5;

_Net = "CamoNet_OPFOR_big_F" createVehicle [0,0,0];

_Net setDir ((direction _veh) +0);

_Net setPos (_veh modelToWorld [0,0,((position _veh) select 2)-2.4]);

_box = "B_supplyCrate_F" createVehicle [0,0,0];

_box setDir ((direction _veh) +0);

_box setPos (_veh modelToWorld [-3,-3,((position _veh) select 2)-2.4]);

_box addAction["<t color=#ff9900'>Virtual Ammobox</t>", "VAS\open.sqf];

_flag = "Flag_POWMIA_F" createVehicle [0,0,0];

_flag setDir ((direction _veh) +0);

_flag setPos (_veh modelToWorld [-3,-9,((position _veh) select 2)-2.4]);

_flag addAction["<t color=#ff9900'>HALO jump</t>", "ATM_airdrop\atm_airdrop.sqf];

// Set variable for vehicle

_veh setVariable ["CamoDeployed", true, true];

// String ;)

sleep 1;

waitUntil {!(_veh getVariable "CamoDeployed") || !(alive _veh) || !(alive _Net)};

// If stowed, no clean up needed, exit

if (!(_veh getVariable "CamoDeployed")) exitWith {};

_veh setVariable ["CamoDeployed", false, true];

_veh setFuel 1;

_Net setDamage 1;

sleep 3;

deleteVehicle _Net;

if (!(_veh getVariable "CamoDeployed")) exitWith {};

_veh setVariable ["CamoDeployed", false, true];

_Net setDamage 1;

sleep 3;

deleteVehicle _Net;

};

};

};

Share this post


Link to post
Share on other sites

Could you specify which part isn't working for you? Did you mean this script is run via addAction?

Share this post


Link to post
Share on other sites
Could you specify which part isn't working for you? Did you mean this script is run via addAction?

yes, I am calling the script via an addAction in a Strider init box within the mission. I have everything working within the editor and also locally, however, when I play test the mission on our MP game server the script is only working for the player that called it and not for all clients on the server.

The script basically creates a HALO Flag, Camo Net and VAS (Ammo Box) at a Vehicle - like it creates an MHQ. Everyone sees the items spawn yet only the player who called the script via the addAction can access the functionality of the HALO Flag and VAS.

Share this post


Link to post
Share on other sites
yes, I am calling the script via an addAction in a Strider init box within the mission. I have everything working within the editor and also locally, however, when I play test the mission on our MP game server the script is only working for the player that called it and not for all clients on the server.

The script basically creates a HALO Flag, Camo Net and VAS (Ammo Box) at a Vehicle - like it creates an MHQ. Everyone sees the items spawn yet only the player who called the script via the addAction can access the functionality of the HALO Flag and VAS.

Ok so what you need to do is look at this thread.

Share this post


Link to post
Share on other sites

Yep, what lala said. addAction is a local command, you'll need to use bis_fnc_mp (or a pvar eh, if you're old school) to execute on other clients.

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
Sign in to follow this  

×