SA-MP Forums Archive
What have i done wrong in this if statement - 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: What have i done wrong in this if statement (/showthread.php?tid=399535)



What have i done wrong in this if statement - thefatshizms - 15.12.2012

pawn Код:
if(gTeam[playerid] != POLICE || gTeam[playerid] != STAT) return SendClientMessage(playerid, COLOR_RED2, "[ERROR] :{FFFFFF} To use this command you need to be in Stat or police");
As the title says, what have i done wrong? it always says im not in the cop or stat team but yet i am..


Re: What have i done wrong in this if statement - CoaPsyFactor - 15.12.2012

change || to && cus in this case if you are police and not stat it will enter in, and if you are stat and not police it will enter in || means OR and && means AND

EDIT: i believe you want to check if player is not police and is not stat


Re: What have i done wrong in this if statement - Threshold - 15.12.2012

Yeah, so just another case of the old || and && mixup.
pawn Код:
if(gTeam[playerid] != POLICE && gTeam[playerid] != STAT) return SendClientMessage(playerid, COLOR_RED2, "[ERROR] :{FFFFFF} To use this command you need to be in Stat or police");
This seems like it should work.