SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/05/2020, 12:49 PM   #1
Calinut200
Big Clucker
 
Join Date: Jun 2016
Posts: 74
Reputation: 0
Default how to use IF

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
Calinut200 is offline   Reply With Quote
Old 23/05/2020, 12:56 PM   #2
SharpenBlade
Huge Clucker
 
Join Date: May 2020
Posts: 202
Reputation: 25
Default Re: how to use IF

Instead of and use &&
SharpenBlade is offline   Reply With Quote
Old 23/05/2020, 03:51 PM   #3
GeorgeLimit
Big Clucker
 
GeorgeLimit's Avatar
 
Join Date: Mar 2018
Location: Jawa Timur, Indonesia
Posts: 166
Reputation: 0
Default Re: how to use IF

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");
}
}
__________________

Quote:
That is perfectly fine, I'm just pointing out where you made mistakes what does hearing "good job" get you? Absolutely nothing. You need to hear the problems otherwise you'll keep making the same mistakes
GeorgeLimit is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 08:33 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.