How to check true or false
#1

When i put this on register script:

Newbie[playerid] = true;


Then, how check OnPlayerSpawn is true or false?
Reply
#2

pawn Код:
if(Newbie[playerid]== true)
{
    //what you need?
}
very simple
Reply
#3

https://sampwiki.blast.hk/wiki/Control_Structures
Scroll down to Operators.
Example or two:
pawn Код:
if(Newbie[playerid] == true)//Checks if the condition is true
{
//code
}
if(Newbie[playerid] != true)//Checks if the condition isn't true
{
//code
}
Reply
#4

Yeah, by the way, you can see it being checked like:
pawn Код:
if(Newbie[playerid]) // If it's true

if(!Newbie[playerid]) // If it's false

Newbie[playerid] =! Newbie[playerid]; // Inverts the state. True --> False, if false --> true.
Reply
#5

ERRORS:
Quote:

D:\Edvinas\RPG\gamemodes\RPG.pwn(39) : error 021: symbol already defined: "Naujokas"
D:\Edvinas\RPG\gamemodes\RPG.pwn(86) : error 028: invalid subscript (not an array or too many subscripts): "Naujokas"
D:\Edvinas\RPG\gamemodes\RPG.pwn(86) : warning 215: expression has no effect
D:\Edvinas\RPG\gamemodes\RPG.pwn(86) : error 001: expected token: ";", but found "]"
D:\Edvinas\RPG\gamemodes\RPG.pwn(86) : error 029: invalid expression, assumed zero
D:\Edvinas\RPG\gamemodes\RPG.pwn(86) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

Quote:

new bool:Naujokas[MAX_PLAYERS];

Quote:

public OnPlayerSpawn(playerid)
{
if(Naujokas[playerid]==true)
{

}
return 1;
}
Reply
#6

Any?
Reply
#7

It's saying you already defined the variable. Change it.
Reply
#8

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
It's saying you already defined the variable. Change it.
Oh yea.. i saw it, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)