The command is working just fine, the problem is that 'SendClietMessage' and that 'pName'.
As you might know, when you declare a variable, it's set to '0'. So when you declared 'pID' you made it 'pID=0'.
You used sscanf AFTER you got the ID of the player, meaning that first it gets the name and afterwards checks what ID the person was typing in the command. So it does not work that way. Let me fix it for you.
pawn Код:
CMD:setadmin(playerid, params[])
{
if(IsPlayerAdmin(playerid) | PlayerInfo[playerid][pAdmin] >= 3)
{
new pID;
new Level;
new string[128];
new pName[MAX_PLAYER_NAME];
new aName[MAX_PLAYER_NAME];
if(sscanf(params, "ui", pID, Level)) return SendClientMessage(playerid, -1, "[USAGE] /setadmin [playerid] [level]"); // Just moved this line a bit.
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(pID, pName, sizeof(pName));
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "[ERROR] The Player You Want To Make Admin Is Not Connected");
format(string, sizeof(string), "Admin %s Has Made %s An Admin Level %d", aName, pName, Level);
SendClientMessageToAll(-1, string);
PlayerInfo[pID][pAdmin] = Level;
}
else return SendClientMessage(playerid, -1, "You Are Not Authorized To Use That Command");
return 1;
}
edit: There is no ID bug as the guys above suggested. The command is working, you just don't know that.