04.04.2013, 12:49
Using ZCMD - sscanf :
Should work
pawn Код:
CMD:makeadmin(playerid, params[])
{
new id,
level;
if(gPlayerInfo[playerid][PLAYER_LEVEL] < 5)
return SendClientMessage(playerid, -1, "You need to be Level 10 to use this command!");
if(sscanf(params, "ui", id, level))
return SendClientMessage(playerid, -1, "Usage: /makeadmin <playerid> <level>");
if(id == playerid)
return SendClientMessage(playerid, -1, "ERROR:{00CED1} You cannot set your own Admin Level!");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, -1, "ERROR:{00CED1} Player is not connected!");
if ( level < 0 || level > 5 )
return SendClientMessage(playerid, -1, "ERROR:{00CED1} Invalid Admin level");
gPlayerInfo[id][PLAYER_LEVEL] = level;
new pName[MAX_PLAYER_NAME], str[128], pName1[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(id, pName1, sizeof(pName1));
format(str, sizeof(str), "Administrator %s has changed %s's Admin level to %i",pName, pName1, level);
SendClientMessageToAll(-1, str);
return 1;
}