PHP код:
CMD:makeadmin(playerid, params[])
{
new targetid, level;
new string[128];
if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid,COLOR_RED,"{AF1C1C}(INFO):{FFFFFF}Onl y Executive Administators can use this command. ");
else if (sscanf(params, "ui", targetid, level)) return SCM(playerid, COLOR_WHITE,"{E5AC00}Usage: {FFFFFF}/makeadmin [ID] [Level 1-6]");
else if(targetid == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED, "{B3B3B3}Player is not online");
else
{
format(string, sizeof(string),"{37A63D}(INFO){FFFFFF}You made %s Admin level %i!", PlayerName(targetid), level);
SCM(playerid, COLOR_WHITE, string);
format(string, sizeof(string),"{37A63D}(INFO){FFFFFF}You have been promoted to Level %i Admin by Executive Adminstrator %s ", level, PlayerName(playerid));
SCM(targetid, COLOR_WHITE, string);
PlayerInfo[targetid][pAdmin] = level;
format(string, sizeof(string),"{37A63D}(INFO){FFFFFF}Executive Adminstrator %s promoted %s to Admin Level %i | ",PlayerName(playerid),PlayerName(targetid),level) ;
AdminMessage(COLOR_WHITE, string);
SavePlayer(targetid);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
// You forgot to reset the level when a player is disconnected from the server. On this when someone enters a given ID it receives administrator rights.
PlayerInfo[playerid][pAdmin] = 0; // Reset level for player ID
return 1;
}