GetPlayerID (Useful_Functions)
#1

Код:
CMD:mapp(playerid, params[])
{
	new Float:TY, Float:TX, Float:TZ, targetname[MAX_PLAYER_NAME], IDofName, string[128], realname[MAX_PLAYER_NAME];
	if(sscanf(params,"u",targetname)) return SendClientMessage(playerid,-1, "{FF0000}Usage: /mapp [player name]!");
	
 	IDofName = GetPlayerID(targetname, 1);
	{
	    new shit[128];
	    format(shit, sizeof(shit), "Returned ID: %d", IDofName);
		SendClientMessage(playerid, -1, shit);
	
	    if(!IsPlayerConnected(IDofName))
	    {
	        SendClientMessage(playerid, 0xFF0000FF, "Error: player is not connected.");
	    }
	    else
	    {
			GetPlayerPos(IDofName, TX, TY, TZ);
			GPSMarkeris[playerid] = SetPlayerMapIcon(playerid, 0, TX, TY, TZ, 0, 0xFF0000FF, 1);
			GetPlayerName(IDofName, realname, sizeof(realname));
			format(string, sizeof(string), "{3399FF}[GPS] {5167F0}%s {3399FF}last known location has been marked {FF0000}with a red marker", realname);
			SendClientMessage(playerid, COLOR_HIGHLIGHT, string);
		}
	}


	return 1;
}
Why does this command work when I type in the name or part of name of ID0 only? When I type in the name of ID1 then GetPlayerID returns the value -1. Anyone know a fix to this?


This stuff is to see what value is returned:
Код:
	    new shit[128];
	    format(shit, sizeof(shit), "Returned ID: %d", IDofName);
		SendClientMessage(playerid, -1, shit);
Reply


Messages In This Thread
GetPlayerID (Useful_Functions) - by Sheperc - 05.01.2016, 09:02
Re: GetPlayerID (Useful_Functions) - by DRIFT_HUNTER - 05.01.2016, 09:07
Re: GetPlayerID (Useful_Functions) - by Gammix - 05.01.2016, 09:08
Re: GetPlayerID (Useful_Functions) - by Sheperc - 05.01.2016, 09:40
Re: GetPlayerID (Useful_Functions) - by DRIFT_HUNTER - 05.01.2016, 10:48
Re: GetPlayerID (Useful_Functions) - by Crayder - 05.01.2016, 10:51

Forum Jump:


Users browsing this thread: 2 Guest(s)