Enum help
#1

Hello all.

I am trying to understand how to effectively use enumeration in my script. This is my current enumeration:
pawn Код:
enum PlayerInfo
{
    AdminLevel,
}
new pinfo[MAX_PLAYERS][PlayerInfo];
So, i'm trying to create a command which shows what level you are
pawn Код:
CMD:mypermissions(playerid, params[])
{
    if(pinfo[playerid][AdminLevel] == 0) return MESSAGE(cwhite, "You have level 0 permissions. (Player)");
    if(pinfo[playerid][AdminLevel] == 1) return MESSAGE(cyellow, "You have level 1 permissions. (VIP)");
    if(pinfo[playerid][AdminLevel] == 2) return MESSAGE(clightblue, "You have level 2 permissions. (Jr. Mod)");
    if(pinfo[playerid][AdminLevel] == 3) return MESSAGE(clightblue, "You have level 3 permissions. (Moderator)");
    if(pinfo[playerid][AdminLevel] == 4) return MESSAGE(cred, "You have level 4 permissions. (Admin)");
    return 1;
}
BUT, when I type it in-game, it shows that I only have level 0 permissions, even though I have level 2 permissions (set in my MySQL database). I know I am doing something wrong, I just need some help to identify what it is i'm doing wrong. (Still trying to learn how to properly use if/switch statements)

Thanks
Reply


Messages In This Thread
Enum help - by DBan - 11.04.2012, 12:00
Re: Enum help - by sjvt - 11.04.2012, 12:20
Re: Enum help - by DBan - 11.04.2012, 12:25
Re: Enum help - by MadeMan - 11.04.2012, 12:27
Re: Enum help - by DBan - 11.04.2012, 12:33
Re: Enum help - by MadeMan - 11.04.2012, 12:35
Re: Enum help - by DBan - 11.04.2012, 12:38
Re: Enum help - by MadeMan - 11.04.2012, 12:41
Re: Enum help - by DBan - 11.04.2012, 12:45

Forum Jump:


Users browsing this thread: 1 Guest(s)