Jump to content
Sign in to follow this  
thedubl

Inactivate option on use

Recommended Posts

Hello, I am having trouble wrapping my mind around this today. Help would be awesome. I would like to disable and option use for 300 seconds. I want a condition for active, but not quite sure what to use or if I have been looking at it the whole time. My idea was on use set 0 sleep for 300 sec then set it back to 1 (Example: Heli Insertion). Is this even possible if not I can disable the entire addaction did not want to?

 

dub

aka Travis

 

//support menu
_onUseCondition = "";

MENU_support = [
	["610 Options",true],
	["Infantry Supplies", [2], "", -5, [["expression", "_thread = 1 spawn dub_fnc_Support610; "]], "1", "1"],
	["Vehicle Ammo", [3], "", -5, [["expression", "_thread = 1 spawn dub_fnc_VDropVehAmmo;"]], "1", "1"],
	["Vehicle Drop", [4], "", -5, [["expression", "_thread = 1 spawn dub_fnc_VDrop; "]], "1", "1"],
	["Heli Insertion", [5], "", -5, [["expression", "_thread = 1 spawn dub_fnc_heliinsertion; "]], "1", _onUseCondition]
	
];



//Open menu action
player addAction [("<t color=""#00ff1d"">" +  ("610 Support") + "</t>"), {showCommandingMenu "#USER:MENU_support";}, [], 0, false, true, "", ""];

player addEventHandler [ "Respawn", {
	player addAction [("<t color=""#00ff1d"">" + ("610 Support")+ "</t>"), {showCommandingMenu "#USER:MENU_support";}, [], 0, false, true, "", ""];
}];

 

Share this post


Link to post
Share on other sites

Have a global variable lastSupport with the time it was called last and a condition time > lastSupport + 300.

(remember to set lastSupport = time -300 at mission start)

Share this post


Link to post
Share on other sites

Cool. Do you think there needs to be publicVariable for each option?

 

Thanks.

Share this post


Link to post
Share on other sites

Ok, well it does return a 1 or a 0, but it has no effect on the option. Any other suggestion?

 

initServer

/***************************Support Time Out PVs************************/


lastSupportOption = time - 300;
publicVariable "lastSupportOption";
lastSupportOption1 = time - 300;
publicVariable "lastSupportOption1";
lastSupportOption2 = time - 300;
publicVariable "lastSupportOption2";
lastSupportOption3 = time - 300;
publicVariable "lastSupportOption3";

 

 

 

fn_SupportMenu

//lastSupport defined in initServer.sqf
_onUseCondition  = "parseNumber (time > lastSupportOption + 300) ";
_onUseCondition1 = "parseNumber (time > lastSupportOption1 + 300)";
_onUseCondition2 = "parseNumber (time > lastSupportOption2 + 300)";
_onUseCondition3 = "parseNumber (time > lastSupportOption3 + 300)";


//support menu
MENU_support = [
	["610 Options",true],
	["Infantry Supplies", [2], "", -5, [["expression", "_thread = 1 spawn dub_fnc_Support610; "]], "1", _onUseCondition],
	["Vehicle Ammo", [3], "", -5, [["expression", "_thread = 1 spawn dub_fnc_VDropVehAmmo;"]], "1", _onUseCondition1],
	["Vehicle Drop", [4], "", -5, [["expression", "_thread = 1 spawn dub_fnc_VDrop; "]], "1", _onUseCondition2],
	["Heli Insertion", [5], "", -5, [["expression", "_thread = 1 spawn dub_fnc_heliinsertion; "]], "1", _onUseCondition3 ]
	
];



//Open menu action
player addAction [("<t color=""#00ff1d"">" +  ("610 Support") + "</t>"), {showCommandingMenu "#USER:MENU_support";}, [], 0, false, true, "", ""];

player addEventHandler [ "Respawn", {
	player addAction [("<t color=""#00ff1d"">" + ("610 Support")+ "</t>"), {showCommandingMenu "#USER:MENU_support";}, [], 0, false, true, "", ""];
}];

 

Share this post


Link to post
Share on other sites

No other suggestion since it works if you implement it correctly.

Also, I recommend using addCommMenuItem instead of addAction. Not only is that a better, native option but you can define condition to show in the config itself.

Share this post


Link to post
Share on other sites

Ok, I will take a look and reply back.

 

Thanks,

dub

 

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  

×