SA-MP Forums Archive
[Tutorial] 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] OnPlayerClickPlayer Teleport (/showthread.php?tid=328667)



OnPlayerClickPlayer Teleport - kelvin22 - 25.03.2012

OnPlayerClickPlayer Teleport



Functions we're going to use:
OnPlayerClickPlayer
GetPlayerPos
SetPlayerPos

Lets start:

pawn Code:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{  
        // Declare 3 float variables to store the X, Y and Z coordinates in
        new Float:x, Float:y, Float:z;
 
        // Use GetPlayerPos, passing the 3 float variables we just created
        GetPlayerPos(clickedplayerid,  x, y, z);

        // SetPlayerPos from: 3 float variables wich we saved
        SetPlayerPos(playerid, x,y,z);
    return 1;
}



Re: OnPlayerClickPlayer Teleport - Shabi RoxX - 25.03.2012

The shortest Tutorial :

You just use
pawn Code:
OnPlayerClickPlayer,
GetPlayerPos,
SetPlayerPos
Never explain them by yourself o_O


Re: OnPlayerClickPlayer Teleport - rbN. - 25.03.2012

Not even a tutorial..


Re: OnPlayerClickPlayer Teleport - kelvin22 - 25.03.2012

Quote:
Originally Posted by Shabi RoxX
View Post
The shortest Tutorial :

You just use
pawn Code:
OnPlayerClickPlayer,
GetPlayerPos,
SetPlayerPos
Never explain them by yourself o_O
What i did explain them, lol?

@RobinOwnz

It's a short one or better to say basic.


Re: OnPlayerClickPlayer Teleport - Max_Coldheart - 25.03.2012

It is a tutorial.


Re: OnPlayerClickPlayer Teleport - XStormiest - 06.06.2012

So OnPlayerCkiclPlayer is used for when you want to see the player's connect and click on it no? yes or no..?


Re: OnPlayerClickPlayer Teleport - Jonny5 - 06.06.2012

hum..
what if your in a vehicle...
or they are in a different interior or world.


Re: OnPlayerClickPlayer Teleport - kelvin22 - 06.06.2012

@XStormiest OnPlayerClickPlayer is used when a player double-clicks into another player's name on the scoreboard

@Jonny5 Then you need to make the code a bit more complicated

pawn Code:
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 - Jonny5 - 06.06.2012

yes i know but others dont,
your teaching here so try to tackle all aspects or problems that might happen

also you have an error in that last code

pawn Code:
world = GetPlayerVirtualWorld(clickedplayerid);
    interior = GetPlayerInterior(clickedplayerid);
i changed playerid to clickedplayerid

just trying to help improve ya tut!


Re: OnPlayerClickPlayer Teleport - kelvin22 - 06.06.2012

Sorry, typing mistake