SA-MP Forums Archive
How to make Admin Level System - 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)
+--- Thread: How to make Admin Level System (/showthread.php?tid=455922)



How to make Admin Level System - Unoffical - 03.08.2013

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


Re: How to make Admin Level System - Unoffical - 03.08.2013

bump


Re: How to make Admin Level System - Facerafter - 03.08.2013

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



Re: How to make Admin Level System - [ABK]Antonio - 03.08.2013

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.


Re: How to make Admin Level System - Unoffical - 03.08.2013

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