Boolean variables - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Boolean variables (
/showthread.php?tid=397764)
Boolean variables -
Lz - 06.12.2012
Is there such thing is a variable that uses a boolean
Rather then having to check if the value is 0 or 1 for no/yes?
Re: Boolean variables -
DaRk_RaiN - 06.12.2012
Variables can be used for that too, for example gTeam.
Re: Boolean variables -
Lz - 06.12.2012
Quote:
Originally Posted by DaRk_RaiN
Variables can be used for that too, for example gTeam.
|
I mean instead of doing:
pawn Код:
if(phone != 0)) // Doesn't have a phone
return 0;
{
else(phone !=1)) // does have a phone
abletocall();
Is there an easier way like:
pawn Код:
phone(true);
abletocall();
{
else(return 0;
Re: Boolean variables -
Vince - 06.12.2012
That doesn't even make sense.
Re: Boolean variables -
Konstantinos - 06.12.2012
There are booleans in Pawn, but the code you showed as Vince said makes no sense. I will give you an example of it.
pawn Код:
new
Toggle_Something[ MAX_PLAYERS ]
;
public OnPlayerConnect( playerid )
{
Toggle_Something[ playerid ] = 0;
return 1;
}
// on a command
Toggle_Something[ playerid ] = 1;
This is with integers 0/1, the next will be with booleans.
pawn Код:
new
bool: Toggle_Something[ MAX_PLAYERS ]
;
public OnPlayerConnect( playerid )
{
Toggle_Something[ playerid ] = false;
return 1;
}
// on a command
Toggle_Something[ playerid ] = true;