24.08.2011, 20:46
pawn Code:
CMD:makeadmin(playerid, params[])
{
new pID, value;
if(!(PlayerInfo[playerid][pAdmin] >= 1338)) return SendClientMessage(playerid, 0xFF0000AA, " you are not authorized to use this command!");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /makeadmin [playerid/partofname] [level 1-1338]");
else if (value < 1 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "Unknown level! Only 1 to 1338");
else if(IsPlayerConnected(pID)) {
if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
}
else
{
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have promoted %s to Admin level %i", tName, value);
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have been promoted to Admin level %i by %s", value, pName);
SCM(pID, COLOR_LIGHTBLUE, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}