Help With getting name
#2

it is because u are trying to fetch the name of player by id BEFORE knowing the id itself... the GetPlayerName function should be AFTER the sscanf call.
Try this:
Код:
CMD:explode(playerid,params[])
{
		        if(pInfo[playerid][Adminlevel] < 5) return SendClientMessage(playerid, COLOR_RED, "ERROR_MESSAGE");
		        new TargetID, reason[20];
		        new targetname[MAX_PLAYER_NAME];
		        if(sscanf(params, "us", TargetID, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /explode [id] [reason]");
		        if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID )) return SendClientMessage(playerid, COLOR_RED, "* Player Is Not Connected.");
                        GetPlayerName(TargetID, targetname, sizeof(targetname));
	    	        new string[300], srting1[128];
			new Float:burnx, Float:burny, Float:burnz; GetPlayerPos(TargetID,burnx, burny, burnz); CreateExplosion(burnx, burny , burnz, 7,10.0);
			format(string,sizeof(string),"** EXPLODE: %s (%d) (ADMIN EXPLODE) Has Been EXPLODED By An Admin. (Reason: %s)", targetname,TargetID,reason);
			SendClientMessageToAll(COLOR_HOTPINK,string);
			format(srting1,sizeof(srting1),"You have exploded %s (%d)", targetname,TargetID);
			SendClientMessage(playerid,COLOR_HOTPINK,srting1);
			return 1;
}
Reply


Messages In This Thread
Help With getting name - by AroseKhanNiazi - 30.03.2014, 05:51
Re: Help With getting name - by electrux - 30.03.2014, 05:59
Re: Help With getting name - by AroseKhanNiazi - 30.03.2014, 07:51

Forum Jump:


Users browsing this thread: 1 Guest(s)