How to make Admin Level System
#1

Ok i just got my admin system working. Here the Code
Код:
CMD:setadmin(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new id,level;
        if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid, COLOR_RED, "Usage: /setadmin [id] [level] ");
        if(level > 5) return SendClientMessage(playerid, COLOR_RED, "Usage: /setadmin id 1-5");
        new INI:File = INI_Open(UserPath(id));
        INI_WriteInt(File,"Admin",level);
        PlayerInfo[playerid][pAdmin]++;
        INI_Close(File);
    }
    else SendClientMessage(playerid, COLOR_RED, "That id is not connected");
    return 1;
}
But i notice right if i go in game and i use command it just change the user file admin= 1 even if i set level to 5 it just goes up one
Reply
#2

bump
Reply
#3

Instead of
pawn Код:
PlayerInfo[playerid][pAdmin]++;
Use
pawn Код:
PlayerInfo[playerid][pAdmin] = level;
Reply
#4

I thought I'd explain a little bit more. When you use ++ you're incrementing the variable. It's the equivalent of typing
pawn Код:
PlayerInfo[playerid][pAdmin]+=1;
So that's why it's only increasing to one. If you typed that command again, you'd be level 2. It'd just keep raising by 1 every time.
Reply
#5

actually i found it.
this is what i was meaning: https://sampforum.blast.hk/showthread.php?tid=273643
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)