SA-MP Forums Archive
Help with "if ()" - 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: Help with "if ()" (/showthread.php?tid=611637)



Help with "if ()" - oktokt1 - 09.07.2016

Hello,
Today idk how i forget all about "if"lol
Can someone help me? Like
Код:
 
If (SomeThing[playerid] == 0) return 1;
//now what to do to make something happen if it = 1?!



Re: Help with "if ()" - oktokt1 - 09.07.2016

Quote:
Originally Posted by oktokt1
Посмотреть сообщение
Hello,
Today idk how i forget all about "if"lol
Can someone help me? Like
Код:
 
If (SomeThing[playerid] == 0) return 1;
//now what to do to make something happen if it = 1?!
Like uf i want to make
If Something = 1 thn msg to player with "somting enabled"
If Something = 0 then msg "somting disabled"
Sorry for re post it was by mistake .


Re: Help with "if ()" - iKarim - 09.07.2016

PHP код:
if(something == 1) { 
// do smth
}
else if(
something == 0) { 
// do smth
}
// alternatively you can use:
if(something// equals to 1.
else if(!something// equals to 0. 



Re: Help with "if ()" - oktokt1 - 09.07.2016

I got it thanx alot.


Re: Help with "if ()" - Stinged - 09.07.2016

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
PHP код:
if(something == 1) { 
if(
something// equals to 1.
else if(!something// equals to 0. 
Actually those mean
Код:
if (something) // means if (something >= 1) not if (something == 1)
else if (!something) // means if (something < 1) not if (something == 0)



Re: Help with "if ()" - Misiur - 09.07.2016

Actually
pawn Код:
if(!something) //Will execute ONLY when something == 0
if(something) //Will execute for everthing different than 0, meaning: 1, 666, -1, -10.2, etc.