Setlevel
#2

pawn Код:
CMD:setlevel(playerid, params[])
{
  if(PInfo[playerid][Level] < 5) return SendClientMessage(playerid,0xFF0000AA,"ERROR: You are not allowed to use this command!");
    new
        id,
        level;

    if(sscanf(params, "ui", id, level))
        return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /setlevel <id> <level>");
            if(level > 7) // If selected level is higher than 7 admin will get error
            {
                SendClientMessage(playerid,-1,"[ERROR]: Incorrect Level");
                return 1;
            }
    if(!IsPlayerConnected(id))
        return SendClientMessage(playerid, 0xFF0000FF, "That player is not connected!");

    new
        file[64],
        PlayerName[24],string[64];

    GetPlayerName(id, PlayerName, sizeof PlayerName);
    format(file, sizeof file, "Admin/%s.ini", PlayerName);

    if(!fexist(file))
        return SendClientMessage(playerid, 0xFF0000FF, "That player is not registered");

    INI_Open(file);                
    INI_WriteInt("Level", level);  
    INI_Save();                    
    INI_Close();                    

    PInfo[id][Level] = level;

    SendClientMessage(playerid, blue, "You have changed the selected user's admin level");
    format(string,sizeof(string),"Your admin level has been changed to %d by server admin",level);  
 SendClientMessage(id, blue, string);
    return 1;
}
Reply


Messages In This Thread
Setlevel - by Biess - 25.11.2012, 15:43
Re: Setlevel - by Hoss - 25.11.2012, 15:45
Re: Setlevel - by Biess - 25.11.2012, 17:19

Forum Jump:


Users browsing this thread: 1 Guest(s)