SA-MP Forums Archive
How to check true or false - 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: How to check true or false (/showthread.php?tid=434922)



How to check true or false - EdvinasStudio - 04.05.2013

When i put this on register script:

Newbie[playerid] = true;


Then, how check OnPlayerSpawn is true or false?


Re: How to check true or false - GoldZoroGrab - 04.05.2013

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


Re: How to check true or false - DaRk_RaiN - 04.05.2013

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
}



Re: How to check true or false - RajatPawar - 04.05.2013

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.



Re: How to check true or false - EdvinasStudio - 04.05.2013

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



Re: How to check true or false - EdvinasStudio - 04.05.2013

Any?


Re: How to check true or false - Faisal_khan - 04.05.2013

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


Re: How to check true or false - EdvinasStudio - 04.05.2013

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