09.12.2011, 08:17
pawn Код:
CMD:makeadmin(playerid,params[])
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 7)
{
new string[128],name[MAX_PLAYER_NAME],pID,Level;
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
if(sscanf(params,"ui",pID,Level)) return SendClientMessage(playerid,COLOR_GREY,"/makeadmin <player> <level>");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_GREY,"ERROR: Player not connected!");
if(PlayerInfo[pID][pAdminLevel] != Level)
{
if(PlayerInfo[pID][pAdminLevel] < Level)
{
PlayerInfo[pID][pAdminLevel] = Level;
format(string,sizeof(string),"** ADMIN PROMOTE: %s Is Now An Administrator Level %d!",name,Level);
SendClientMessageToAll(COLOR_PINK,string);
GameTextForPlayer(pID,"~g~Promoted",3000,4);
}
else
{
GameTextForPlayer(pID,"~r~Demoted",3000,4);
format(string,sizeof(string),"** ADMIN DEMOTE: %s Has Been Demoted To Level %d!",name,Level);
SendClientMessageToAll(COLOR_PINK,string);
PlayerInfo[pID][pAdminLevel] = Level;
}
}
else return SendClientMessage(playerid, COLOR_RED, "This player is already that level.");
}
else return 0;
return 1;
}