[HELP] Teleports - Read before posting
#1

To get the location...

1) First you have to go in-game, then you have to travel to the place you want. Once there, you have to /save. With save you can just do it like that, or you can do /save [comment].

2) Now you can go to your "Rockstar Games" directory, go in to "GTA San Andreas" then find a text document called savedpositions.txt. Within it you will have the coordinates to the place you were in.

_________________________________________________

To extract the coordinates...

If you were in a car, you now have something that looks like this:
AddStaticVehicle(496,-1972.4789,256.7105,34.8884,91.4832,53,56);

In that case, you have:
AddStaticVehicle(modelid,x,y,z,angle,color1,color2);

If you were on foot, you have something that looks like this:
AddPlayerClass(0,-1972.6334,277.9128,35.1719,89.8026,0,0,0,0,0,0);

In that case, you have:
AddPlayerClass(skinid, x, y, z, angle, weapon, ammo, weapon, ammo, weapon, ammo);

What we need of course is the x, y and z.

_________________________________________________

To make the teleport...

First lets make on that only teleports people on-foot. The function you have to use is SetPlayerPos.

pawn Code:
SetPlayerPos(playerid, x, y, z);
Easy. Now if we were going to make one that teleports you in a car as well...

pawn Code:
if(IsPlayerInAnyVehicle(playerid) == 1)
    {
        SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
    }
    else
    {
        SetPlayerPos(playerid, x, y, z);
    }
_________________________________________________

Getting more advanced...

Say you would want the teleporter to be facing a certain way when he teleports? For that we would need the angle. To back to the "extract the coordinates" thing and find the purple numbers.

If you want a vehicle to face that way, use:
pawn Code:
SetVehicleZAngle(GetPlayerVehicleID(playerid), angle)
If you want the player to face that way, do:
pawn Code:
SetPlayerFacingAngle(playerid, angle)
Now if you want to set an interior, in which all teleports should have, then you have to add the interior ID. You can get the ID by going into the place in-game and doing /interior, or you can look here.

This is typically:
pawn Code:
SetPlayerInterior(playerid, interior);
If you don't want you vehicle to be invisible, do:
pawn Code:
LinkVehicleToInterior(GetPlayerVehicleID(playerid), interior);
In the very end you would have something looking like this:
pawn Code:
if(strcmp("/teleport", cmdtext, true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
            SetVehicleZAngle(GetPlayerVehicleID(playerid), angle)
            SetPlayerInterior(playerid, interior);
            LinkVehicleToInterior(GetPlayerVehicleID(playerid), interior);
        }
        else
        {
            SetPlayerPos(playerid, x, y, z);
            SetPlayerFacingAngle(playerid, angle);
            SetPlayerInterior(playerid, interior);
        }
        return 1;
    }
Reply


Messages In This Thread
[HELP] Teleports - Read before posting - by Zezombia - 25.06.2008, 13:32
Re: [HELP] Teleports - Read before posting - by bFe - 27.07.2008, 12:09
Re: [HELP] Teleports - Read before posting - by Donny_k - 27.07.2008, 12:43
Re: [HELP] Teleports - Read before posting - by AiVAMAN - 27.11.2008, 16:30
Re: [HELP] Teleports - Read before posting - by fff - 27.03.2009, 20:38
Re: [HELP] Teleports - Read before posting - by kevin13 - 30.04.2009, 17:51
Re: [HELP] Teleports - Read before posting - by Weirdosport - 30.04.2009, 17:55
Re: [HELP] Teleports - Read before posting - by MenaceX^ - 30.04.2009, 17:56
Re: [HELP] Teleports - Read before posting - by (LifeStealeR) - 29.08.2010, 11:52
Re: [HELP] Teleports - Read before posting - by megamind2067 - 10.04.2012, 14:48

Forum Jump:


Users browsing this thread: 1 Guest(s)