[Tutorial] OnPlayerClickPlayer Teleport
#1

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;
}
Reply
#2

The shortest Tutorial :

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

Not even a tutorial..
Reply
#4

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.
Reply
#5

It is a tutorial.
Reply
#6

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

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

@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;
}
Reply
#9

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!
Reply
#10

Sorry, typing mistake
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)