12.04.2017, 12:54
This code sends the "You have set PLAYER admin level to VALUE" to the person that set it, but it doesn't send the second message to the person who's admin level is being set.
PHP код:
CMD:setadmin(playerid, params[])
{
new pID, value;
if(!IsPlayerAdmin(playerid)) return 0;
else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, -1, "{FFFF00}[SERVER] {FF0000}USAGE: {FFFFFF}/setadmin id level");
else if(value < 0 || value > 5) return SendClientMessage(playerid, -1, "{FFFF00}[SERVER] {FF0000}ERROR: {FFFFFF}Pick a level between 1 and 5");
else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{FFFF00}[SERVER] {FF0000}ERROR: {FFFFFF}That player is not connected");
else
{
new string[128], string1[128], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pID, target, sizeof(target));
format(string, sizeof(string), "{FFFF00}[SERVER] {FFFFFF}You have set {FFFF00}%s{FFFFFF} admin level to {FFFF00}%i", target, value);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{FFFF00}[SERVER] {FFFFFF}Your admin level has been set to {FFFF00}%i {FFFFFF}by {FFFF00}%s", value, pName);
SendClientMessage(pID, -1, string1);
PlayerInfo[playerid][pAdmin] = value;
}
return 1;
}