peeps 0 Posted March 18, 2013 Hey guys. Im really struggling to create a variable on each player on a server. I've used this command : player setvariable ["hasbomb", false, false]; which I think creates a bool value on the player called hasbomb and sets it to false. I then try to retrieve the value later using : _canplant = _playertoplant getvariable "hasbomb"; (_playertoplant is referring to a player). I then attempt to use _canplant in an if statement.. if (_canplant = true) then { //blahblahblah }; However I get an error saying a bool was expected but an array was given. Can someone explain what im doing wrong here? Share this post Link to post Share on other sites
XSOF - Toxx 10 Posted March 19, 2013 Did you try: _canplant = _playertoplant getvariable ["hasbomb", 0]; Second thing is, in if-statements you have to use == to check a condition. = is for assigning: if (_canplant == true) Share this post Link to post Share on other sites
giallustio 770 Posted March 19, 2013 player setVariable ["hasbomb",0,true]; if (_playertoplant getvariable "hasbomb" == 1) then {bla bla bla}; Share this post Link to post Share on other sites
peeps 0 Posted March 20, 2013 thanks guys, works now :) Share this post Link to post Share on other sites