Jump to content
Sign in to follow this  
wozzsta

how to removeAction for all players and JIP until server restart.

Recommended Posts

Hi all, 

 

I have an action on a flag pole that starts a mission when selected, and once it is activated it disappears but only for the player that activated it and only for that session, if they leave and rejoin the action is available again. 

 

This is the code on the flag pole: 

   

"WaveAction = this addAction[""Start Wave Defence!"", ""functions\wavetrigger.sqf""]; ";

this is what it triggers: 

 

["oa1", "WWDStart", "WAVE 1"] call fnc_sendNotif;	
[] spawn {null = ["wave1", "wp1", "oa1"] execVM "waves.sqf";}; 
WaveFlag removeAction WaveAction;

 

so, how do i remove it for everyone? 

 

Cheers. 

Share this post


Link to post
Share on other sites

Depending at which point you're adding the action, you could use remoteExec to remove the action on all clients.

https://community.bistudio.com/wiki/remoteExec

 

A safer method (since I'm not 100% sure the actionID could be the same to remove on all clients) would be to add a variable to the addAction condition parameter, something like;

missionNamespace getVariable ['var_canUse',true]

 

Then in the script, send a variable to all clients which would set the above varialbe to 'false' and hence stop them using the action;

missionNamespace setVariable ['var_canUse', false, true]

 

https://community.bistudio.com/wiki/setVariable

https://community.bistudio.com/wiki/getVariable

Share this post


Link to post
Share on other sites

thanks for the reply, 

 

the trigger is "live" from the mission start as it is on an objects init, so i guess on mission load. 

 

but i guess the action doesnt need to be removed. i could have the script check a missionNamespace Variable and depending on if it has been triggered on not display a different message. 

 

thanks!  

Share this post


Link to post
Share on other sites

something like 

 

if (missionNamespace getVariable ['var_canUse', false, true] then {

hint "please wait until server restart before trying again!"

}

else{

execVM "functions\wavetrigger.sqf"

};

Share this post


Link to post
Share on other sites

That would work, you can also add it directly to the addAction too.

https://community.bistudio.com/wiki/addAction

 

So something like this in the init;

WaveFlag addAction ["Start Wave Defence!", "functions\wavetrigger.sqf", [], 0, true, true, "", "(missionNamespace getVariable ['var_canUse', true])"];

 

 

I missed you were using a global variable for the actions - So remoteExec should work fine in this case too. The below should remove the action for all players and JIPs,

[WaveFlag, WaveAction] remoteExec ["removeAction", 0, true];

 

  • Thanks 1

Share this post


Link to post
Share on other sites

hmm so i'm doing something wrong. 

 

i am using this in my functions\wavetrigger.sqf:

 

if (missionNamespace getVariable ["CanUse", false]) then {
hint "please wait until server restart before trying again!"
}
else{

 diag_log text "OA1 WWDSTART WAVE1 SEND NOTIFICATION STARTING.";
    
    ["oa1", "WWDStart", "WAVE 1"] call fnc_sendNotif;
    
    diag_log text "OA1 WWDSTART WAVE1 SEND NOTIFICATION FINISHED.";
    
    [] spawn {null = ["wave1", "wp1", "oa1"] execVM "waves.sqf";};

    missionNamespace setVariable ["CanUse",false,true];
};


   

and this in my init.sqf: 

 

missionNamespace setVariable ["CanUse",true,true];

 

but it doesnt matter what i do, it always comes up with 

 

"please wait until server restart before trying again!"

 

so i guess i am doing something wrong? 
    

Share this post


Link to post
Share on other sites

[_this select 0,_this select 2] remoteExec ["removeAction", 0, true];   // inside addAction code

  • Thanks 2

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  

×