Tag missmatch
#1

What did I do wrong?
Код:
if(!PlayerInfo[playerid][pAdminLevel] == 1) return SCM(playerid, COLOR_RED, "<!> Not an administrator!");
Reply
#2

Thats Not Right.
use this :-
pawn Код:
if(PlayerInfo[playerid][pAdminLevel] < 1) return SCM(playerid, COLOR_RED, "<!> Not an administrator!");
{
else
}
if(PlayerInfo[playerid][pAdminLevel] >= 1) return /// your Options...
Reply
#3

Hmm thanks
Reply
#4

It depends what you are trying to do.

If you want to check if admin is any number other than one
pawn Код:
if(PlayerInfo[playerid][pAdminLevel] != 1) return SCM(playerid, COLOR_RED, "<!> Not an administrator!");
If you want to check if admin is 1 or more
pawn Код:
if(PlayerInfo[playerid][pAdminLevel] >= 1) return SCM(playerid, COLOR_RED, "<!> Not an administrator!");
Reply
#5

Using '!' is For :- IsPlayerAdmin, IsPlayerLoggedIn ....
And if you have enums, use the things which i told you.
Reply
#6

Quote:
Originally Posted by SimpalK
Посмотреть сообщение
Using '!' is For :- IsPlayerAdmin, IsPlayerLoggedIn ....
And if you have enums, use the things which i told you.
Using "!" is not only for inline functions like you are suggesting. It is a comparative tool which can be used in checking any value. The only issue is that Squirrel placed it in the wrong spot. Refer to my post.

It can be very useful if you are looking for one specific value. Let's say for example I only want players with VipLevel==69 to have access to that command. I would use:

pawn Код:
CMD:69(playerid, params[])
{
    if(PlayerInfo[playerid][VipLevel] != 69)
    {
        SendClientMessage(playerid, Red, "You aren't level 69 VIP.");
    }
    else
    {
        // Do something here
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)