29.10.2011, 18:08
how to
CMD:setadmin(playerid, params[])
{
new pID, value;
if(PlayerInfo[playerid][pAdmin] < 1 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "[SERVER]: You're not authorized to use this command!");
else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /setadmin [playerid/partofname] [level]");
else if (value < 0 || value > 1338) return SendClientMessage(playerid, 0xFF0000AA, "[SERVER]: UNKNOWN LEVEL!");
else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"[SERVER]: 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), "[SERVER]: You have promoted %s to Admin level %i", tName, value);
SCM(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "[SERVER]: Congratulations, you have been promoted to Admin level %i by %s", value, pName);
SCM(pID, COLOR_LIGHTRED, string);
PlayerInfo[pID][pAdmin] = value;
}
return 1;
}