Posts: 949
Threads: 153
Joined: Jan 2012
Reputation:
0
I've searched on ****** for how to use a boolean in PAWN, but never could get the hang of it. If someone could give me an example (I've already got how to create one: "new bool:variableName = true;" How would I, for instance, set that bool to false, or get the current status of the boolean?
Posts: 918
Threads: 125
Joined: Nov 2010
very simple, just like assigning integers to a variable.
simply:
variableName = false;
or
variableName = true;
if you want to use it inside a if(...), you could use if(variableName) which is the same as if(variableName == true) or if(!variableName) which is the same as if(variableName == false).
Posts: 949
Threads: 153
Joined: Jan 2012
Reputation:
0
Holy crap, 4 replies instantly. Uhh, is there a speed difference between integers and booleans by any chance? The reason I'm using a boolean is because it's a variable to check if they are logged in or not, and it only has two possible options, so I assumed a boolean would be a proper solution for this.
Posts: 1,831
Threads: 69
Joined: Mar 2008
Reputation:
0
Well, no, the only thing the "bool" tag does is tell the compiler to complain (no pun intended) if you give the variable anything but true or false, or if you compare it to anything but true or false.
"true" is essentially 1 and "false" 0.