Boolean variables
#1

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?
Reply
#2

Variables can be used for that too, for example gTeam.
Reply
#3

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;
Reply
#4

That doesn't even make sense.
Reply
#5

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;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)