25.11.2012, 15:45
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;
}