Can someone please make a change name command for me for admins level 2 and player info described as PInfo
Код:
CMD:changename(playerid, params[])
{
new targetid,name[128];
if(PInfo[playerid][Level] < 2 || !IsPlayerAdmin(playerid)) return 0;
else if (sscanf(params,"us",targetid,name))SendClientMessage(playerid,RED,"Usage: /changename [Playerid] [New name]");
else if(!IsPlayerConnected(targetid))SendClientMessage(playerid,RED,"Error: Player is not connected!");
else {
new string[128],n[MAX_PLAYER_NAME];
GetPlayerName(targetid,n,sizeof(n));
SetPlayerName(targetid,name);
format(string,sizeof(string),"Admin %s [ID:%d] Has set %s [ID:%d] name to %s",Name(playerid),playerid,n,targetid,name);
SendClientMessageToAll(YELLOW,string);
format(string,sizeof(string),"Your Name has been set to %s by Admin %s[ID:%d]",Name(targetid),n,playerid);
SendClientMessage(playerid,GREEN,string);
}
return 1;
}