SA-MP Forums Archive
how to use 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: how to use IF (/showthread.php?tid=675868)



how to use IF - Calinut200 - 23.05.2020

How to use IF like that
PHP Code:
if(and and 0)
{
 
// my code
}
else if 
!= 0 sendclientmessage(playerid,-1,"x is not 0");
else if 
!= 0 sendclientmessage(playerid,-1,"y is not 0");
else if 
!= 0 sendclientmessage(playerid,-1,"z is not 0"); 
how to put that AND? I need in this IF to all 3 variables to be on 0


Re: how to use IF - SharpenBlade - 23.05.2020

Instead of and use &&


Re: how to use IF - GeorgeLimit - 23.05.2020

new a = 1;
new b = 0;

OnMyFunction()
{
if(a == b)
{
SendClientMessage(playerid, -1, "A and B is Same");
}
else if(a != b) //or you can use else
{
SendClientMessage(playerid, -1, "A and B is Different");
}
}