Do I need to put after both? - 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: Do I need to put after both? (
/showthread.php?tid=463938)
Do I need to put after both? -
Don_Cage - 14.09.2013
If I do like this.
pawn Код:
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 && PlayerInfo[playerid][pDuty] == 1)
Will it check if the player is pMember 1 and pDuty = 1 too? Or do I need to pur the pDuty after pMember aswell? What I mean is, is this code the same as if I would put
pawn Код:
if(PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pDuty] == 1 || PlayerInfo[playerid][pLeader] == 1 && PlayerInfo[playerid][pDuty] == 1)
Re: Do I need to put after both? -
Konstantinos - 14.09.2013
I'd use parentheses.
pawn Код:
if( ( PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 ) && PlayerInfo[playerid][pDuty] == 1 )
Quote:
Originally Posted by TataPhoton
pawn Код:
if(PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pDuty] == 1 && PlayerInfo[playerid][pLeader] == 1 && PlayerInfo[playerid][pDuty] == 1)
use This.
|
He wants either "Member and Duty" or "Leader and Duty". Your code will check if the player is "Member, Leader and Duty".
Re: Do I need to put after both? -
Don_Cage - 14.09.2013
So this one will only check if it's a member and nothing else, or if its a leader and duty?
pawn Код:
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 && PlayerInfo[playerid][pDuty] == 1)
Re: Do I need to put after both? -
-Prodigy- - 14.09.2013
Use this:
pawn Код:
if(PlayerInfo[playerid][pMember] == 1 || (PlayerInfo[playerid][pLeader] == 1 && PlayerInfo[playerid][pDuty] == 1))
Re: Do I need to put after both? -
XcorelloX - 14.09.2013
Konstantinos method was correct. Most of the above check if they're leader and on duty or just a member.