29.12.2011, 06:24
Please check this is my code and nicely indented but still that problem that it just works on ID 0
pawn Код:
CMD:rsetadmin(playerid, params[])
{
new id, level, string[128];
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params,"ui", id, level))
{
if(level < 6 && level >= 0)
{
if(IsPlayerConnected(id))
{
if(PlayerInfo[id][pAdmin] != level)
{
if(PlayerInfo[id][pAdmin] < level)
{
PlayerInfo[id][pAdmin] = level;
format(string, sizeof(string),"RCON Admin %s have promoted you to admin level %i.",GetName(playerid), level);
SendClientMessage(id, COLOR_RED, string);
format(string, sizeof(string),"You have promoted %s to admin level %i.", GetName(id), level);
SendClientMessage(playerid, COLOR_RED, string);
}
else
{
PlayerInfo[id][pAdmin] = level;
format(string, sizeof(string),"RCON Admin %s have demoted you to admin level %i.",GetName(playerid), level);
SendClientMessage(id, COLOR_RED, string);
format(string, sizeof(string),"You have demoted %s to admin level %i.",GetName(id), level);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else SendClientMessage(playerid, ERROR,"The player is already that level admin.");
}
else SendClientMessage(playerid, ERROR,"Invalid Player.");
}
else SendClientMessage(playerid, ERROR,"Levels only from 0 - 5.");
}
else SendClientMessage(playerid, ERROR,"Usage: /rsetadmin [playerid] [Level]");
}
else SendClientMessage(playerid, ERROR,"You are not authorized to use that command.");
return 1;
}