Jump to content
Sign in to follow this  
daniel1060

Variable thinks it's a different data type

Recommended Posts

Right so I'm new to scripting in .SQF, basically my problem is that I have an If statement that is meant to run on a dedicated server but is not executing the correctly.

 

I have set up a global variable, (cash), which is set to hold integers, however, when I put the variable in an if statement it thinks that it is expecting a boolean and not an integer.

init.sqf

Spoiler

if (isServer) then {
cash = 0;
publicVariable "cash";

 
 

sample if statement

Spoiler

if (isServer) then {
    if cash < 50000 then {notenough.sqs} else {
        cash = cash - 50000;
        _AH6J = "CUP_B_AH6J_Escort_USA" createVehicle [9801.48,12574.9,0];
        _AH6J setDir 220;
};
};

 
 

 

Note I have it set to (isServer) because I am testing it on a server hosted by my machine

Share this post


Link to post
Share on other sites

Just as isServer is wrapped brackets, so must cash < 50000 be:

 

if (cash < 50000) then {

 

All if then conditions must be wrapped in ( ) and return true/false. 

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  

×