Whats wrong with this
#1

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;
            }
Reply
#2

Then delete it..
Reply
#3

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)
Reply
#4

im trying to make it so only cops can use it...@relixes
Reply
#5

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
Reply
#6

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.");
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)