SA-MP Forums Archive
Teleport to player. - 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: Teleport to player. (/showthread.php?tid=586413)



Teleport to player. - DerickClark - 21.08.2015

This command don't teleport to the player location.


Код:
CMD:tpto(playerid, params[])
{
	new id = isnull(params);
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_WHITE, "Usage: /tpto [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOUR_WHITE, "Player is not connected");
	else
	{
		new Float:X, Float:Y, Float:Z, Pname[24];
		GetPlayerPos(id, X, Y, Z);
		GetPlayerName(id, Pname, 24);
        SetPlayerPos(playerid, X, Y, Z);
		new String[56];
		format(String, sizeof(String), "%s teleported to you", Pname, id);
		SendClientMessage(id, COLOUR_WHITE, String);
	}
	return 1;
}



Re: Teleport to player. - jamal1992 - 21.08.2015

Try that:
new userid;
if(sscanf(params, "u", userid)) return Your Message;


Re: Teleport to player. - jlalt - 21.08.2015

try this?
PHP код:
CMD:tpto(playeridparams[])
{
    new 
id isnull(params);
    if(
isnull(params)) return SendClientMessage(playerid, -1"Usage: /tpto [playerid]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid, -1"Player is not connected");
    new 
Float:XFloat:YFloat:ZPname[24];
    new 
String[56];
    
GetPlayerPos(idXYZ);
    
GetPlayerName(idPname24);
    
SetPlayerPos(playeridXYZ);
    
format(Stringsizeof(String), "%s teleported to you"Pnameid);
    
SendClientMessage(id, -1String);
    return 
1;




Re: Teleport to player. - DerickClark - 21.08.2015

nvm. thanks.