Whats wrong with this - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong with this (
/showthread.php?tid=183721)
Whats wrong with this -
Marshall_Banks - 16.10.2010
Everytime i use it, it says im not a cop.
Код:
if(gTeam[playerid] != 2 || PlayerInfo[playerid][pMember] != 3 || PlayerInfo[playerid][pLeader] != 3)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop!");
return 1;
}
Re: Whats wrong with this -
Relixious - 16.10.2010
Then delete it..
Re: Whats wrong with this -
Mauzen - 16.10.2010
The || means or, so you check if gTeam[playerid] is not 2 or not 3.
This will always be true, because it is for example 2, PlayerInfo[playerid][pMember] != 3 will return 1 so the whole line is true.
Replace the || with && (and)
Re: Whats wrong with this -
Marshall_Banks - 16.10.2010
im trying to make it so only cops can use it...@relixes
Re: Whats wrong with this -
Relixious - 16.10.2010
Quote:
Originally Posted by Marshall_Banks
im trying to make it so only cops can use it...@relixes
|
Ok, well this "You're not a cop" only get's called if;
- gTeam is not 2
- pMember is not 3
- pLeader is not 3
Re: Whats wrong with this -
Tee - 16.10.2010
Here is one that i use (it has the skins of all law enforcers)
pawn Код:
if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288){
//You code here.
}else return SendClientMessage(playerid,0xC0C0C0FF,"You dont have permisson to access this command.");
Re: Whats wrong with this -
Marshall_Banks - 16.10.2010
Quote:
Originally Posted by Mauzen
The || means or, so you check if gTeam[playerid] is not 2 or not 3.
This will always be true, because it is for example 2, PlayerInfo[playerid][pMember] != 3 will return 1 so the whole line is true.
Replace the || with && (and)
|
Thanks it worked, and thanks to everyone else that tried helping.