pawn Код:
stock GetName(playerid)
{
new name[24];
GetPlayerName(playerid,name,sizeof(name));
return name;
}
new pAdmin[MAX_PLAYERS];
CMD:makeadmin(playerid,params[])
{
new
targetid,
level,
targetstring[128],
string[128];
if(pAdmin[playerid] <= 1 && !IsPlayerAdmin(playerid))
{
return SendClientMessage(playerid,-1,"You are not authorised to use that command.");
}
if(sscanf(params,"ui",targetid,level))
{
return SendClientMessage(playerid,-1,"USAGE: /makeadmin [playerid] [level]");
}
if(targetid == INVALID_PLAYER_ID)
{
return SendClientMessage(playerid,-1,"Player not found.");
}
if(level == 0 || level >= 3)
{
return SendClientMessage(playerid,-1,"Only levels available are level 1 and 2.");
}
else
{
format(targetstring,sizeof(targetstring),"Administrator %s has promoted you to Level %d Admin.",GetName(playerid),level);
format(string,sizeof(string),"You have made %s a level %d Admin.",GetName(targetid),level);
SendClientMessage(targetid,-1,targetstring);
SendClientMessage(playerid,-1,string);
pAdmin[targetid] = level;
}
return 1;
}