SA-MP Forums Archive
OnPlayerClickPlayer Teleport - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerClickPlayer Teleport (/showthread.php?tid=217146)



OnPlayerClickPlayer Teleport - Michael@Belgium - 27.01.2011

hi now im going to post fast a topic, because i don't have much time x)
So in my script ... in everyone's script. There is OnPlayerClickPlayer
On the forum i don't find it so i'm going to ask it x)
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
   
    return 1;
}
Ofcouse xD But i want to make:
If someone(/the admin) clicks on a player he/she has to be teleported to him/her. (or maybe just for the admin himself )
So how you do that ?

plz answer me question

SOLVED



Re: OnPlayerClickPlayer Teleport - Lorenc_ - 27.01.2011

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new Float: X,Float:Y, Float:Z, string[70];
    GetPlayerPos(clickedplayerid, X,Y,Z);
    SetPlayerPos(playerid, X,Y,Z);
    format(string, sizeof(string), "You have teleported to ID: %i", clickedplayerid);
    return 1;
}



Re: OnPlayerClickPlayer Teleport - iggy1 - 27.01.2011

Well i wrote some code and lorenc_ posted but ill post mine anyway as it does other things.

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new
        world,interior,
        Float:x, Float:y, Float:z, Float:angle;

    world = GetPlayerVirtualWorld(playerid);
    interior = GetPlayerInterior(playerid);
    GetPlayerPos(clickedplayerid, x, y, z);
    GetPlayerFacingAngle(clickedplayerid, angle);
   
    SetPlayerPos(playerid, x, y, z+0.2);
    SetPlayerFacingAngle(playerid, angle);
    SetCameraBehindPlayer(playerid);
    SetPlayerVirtualWorld(playerid, world);
    SetPlayerInterior(playerid, interior);
    return 1;
}



Re: OnPlayerClickPlayer Teleport - Lorenc_ - 27.01.2011

Yes i would suggest iggy's because its got interior checking and other cool stuff, mines pretty straight of basic (lol took me 20 seconds to type that without pawno -.-)


Re: OnPlayerClickPlayer Teleport - Michael@Belgium - 27.01.2011

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new Float: X,Float:Y, Float:Z, string[70];
    GetPlayerPos(clickedplayerid, X,Y,Z);
    SetPlayerPos(playerid, X,Y,Z);
    format(string, sizeof(string), "You have teleported to ID: %i", clickedplayerid);
    return 1;
}
Quote:
Originally Posted by iggy1
Посмотреть сообщение
Well i wrote some code and lorenc_ posted but ill post mine anyway as it does other things.

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new
        world,interior,
        Float:x, Float:y, Float:z, Float:angle;

    world = GetPlayerVirtualWorld(playerid);
    interior = GetPlayerInterior(playerid);
    GetPlayerPos(clickedplayerid, x, y, z);
    GetPlayerFacingAngle(clickedplayerid, angle);
   
    SetPlayerPos(playerid, x, y, z+0.2);
    SetPlayerFacingAngle(playerid, angle);
    SetCameraBehindPlayer(playerid);
    SetPlayerVirtualWorld(playerid, world);
    SetPlayerInterior(playerid, interior);
    return 1;
}
Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Yes i would suggest iggy's because its got interior checking and other cool stuff, mines pretty straight of basic (lol took me 20 seconds to type that without pawno -.-)
Yeah ok thank you guys ^^ im going to test them both ... maybe someone's don't work