SA-MP Forums Archive
Change Name command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Change Name command (/showthread.php?tid=325287)



Change Name command - NTS - 12.03.2012

Hi,

Can someone please make a change name command for me for admins level 2 and player info described as PInfo

Thanks


Re: Change Name command - kvsolga - 12.03.2012

Here this should work fine in zcmd:

Код:
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;
}
Hope this helps!


Re: Change Name command - NTS - 12.03.2012

Thanks ALLOT, works great