SA-MP Forums Archive
Can't understand - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can't understand (/showthread.php?tid=79625)



Can't understand - russiany - 29.05.2009

Ok. I create a variable.
pawn Код:
new i = 1;
if i try to make a function , something like this
pawn Код:
if(i))
{
// function
}
It took i = 1 , isn't ?

This is equivalent with this , isn't ?

pawn Код:
if(i == 1)
{
//function
}
Right ...

but if i do like this
pawn Код:
if(!i))
{
//function
}
It took i == 0 , whY?


Re: Can't understand - MenaceX^ - 29.05.2009

if(variable==1)
and
if(variable)
they are the same.
also
if(variable==0)
and
if(!variable)
are same aswell.


Re: Can't understand - Felle - 29.05.2009

You're not making a function, you're making an if statement. And yeah, that's just how the ! operator works...


Re: Can't understand - Donny_k - 29.05.2009

Quote:
Originally Posted by MenaceX^
if(variable==1)
and
if(variable)
they are the same.
also
if(variable==0)
and
if(!variable)
are same aswell.
No it isn't dude, "== 1" means it equals one.

pawn Код:
if ( blah == 1 )   //equals one
if ( blah )     //is true, is NOT false
if ( !blah )     //is false, is NOT true