24.09.2016, 02:54
pawn Код:
CMD:makeadmin(playerid, params[])
{
new ID;
new lvl;
new string[128];
new lvlname[50];
if(lvl == 0) return lvlname = "Not Admin";
if(lvl == 1) return lvlname = "Moderator";
if(lvl == 2) return lvlname = "Junior Administrator";
if(lvl == 3) return lvlname = "Senior Administrator";
if(lvl == 4) return lvlname = "Executive Administrator";
if(lvl == 5) return lvlname = "Owner";
if(sscanf(params, "ui", ID, lvl))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [PlayerID/Name] [Level]");
return 1;
}
else
{
if(pInfo[playerid][Admin] >= 5 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(ID))
{
if(pInfo[ID][Admin] != lvl)
{
format(string, sizeof(string), "Promoted to~n~~w~Admin Level %d", lvl);
if(pInfo[ID][Admin] < lvl)
{
format(string, sizeof(string), "~g~Promoted to~n~~w~Admin Level %d", lvl);
GameTextForPlayer(playerid, string, 9000, 0);
}
if(pInfo[ID][Admin] > lvl)
{
format(string, sizeof(string), "~r~Demoted to~n~~w~Admin Level %d", lvl);
GameTextForPlayer(playerid, string, 9000, 0);
}
pInfo[ID][Admin] = lvl;
format(string, sizeof(string), "-| You have given %s(%d) admin level %d (%s) |-", GetName(ID), ID, lvl, lvlname);
SendClientMessage(playerid, COLOR_ADMIN, string);
format(string, sizeof(string), "-| Admin %s has given you admin level %d (%s) |-", GetName(playerid), lvl, lvlname);
SendClientMessage(ID, COLOR_ADMIN, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Player is already that level.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected. Use /adminoffline to set an offline player's level.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You are not a high enough level to use this command.");
}
}
return 1;
}
Any ideas?
Thanks.