Jump to content
Sign in to follow this  
-FW- Shaanguy

addaction condition (not working) help!

Recommended Posts

I am trying to make if a player getVariable ["TestMode", 1], then the addaction appears to the player, but here is the script that i used, but it's not working, i am %100 sure, there is a problem, in this script.

Here: I Used this in init.sqf

TestIDS = [];

TestIDS = TestIDS + [player addAction["<img image='' width='32' height='32'/> Test Mode (available)", "test_script.sqf", [], 1, false, false, "", "player getVariable 'TestMode' == '1'"]];

Any broken word in this post, then sorry for my bad english :)

Edited by [FW] Shaanguy

Share this post


Link to post
Share on other sites

Hi, the first error that i see :

["TestMode", 1]

TestMode = SCALAR

correction:

"player getVariable 'TestMode' == 1"

TestIDS = [];
TestIDS = TestIDS + [player addAction["<img image='' width='32' height='32'/> Test Mode (available)", "test_script.sqf", [], 1, false, false, "", "player getVariable 'TestMode' == 1"]];

Share this post


Link to post
Share on other sites

Firstly, player getVariable ["TestMode", 1] is syntactically correct as the 1 is the default value taken if the value behind "TestMode" is nil.

Secondly, if you use 1 (a number) as default value for the getVariable, you must not check for '1' (a string) in the action condition, because then this will always be false and the action will never be visible. So change the condition part of the addAction to this:

"player getVariable ['TestMode', 1] == 1"

Btw, your English is just fine. :)

Edited by Heeeere's Johnny!

Share this post


Link to post
Share on other sites

Thanks TittErS

It worked! :D

Thanks for more information Heeeere's Johnny!

Firstly, player getVariable ["TestMode", 1] is syntactically correct as the 1 is the default value taken if the value behind "TestMode" is nil.

Secondly, if you use 1 (a number) as default value for the getVariable, you must not check for '1' (a string) in the action condition, because then this will always be false and the action will never be visible. So change the condition part of the addAction to this:

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  

×