[Tutorial] [SA:MP] How to make a teleport command

Junior Spellweaver
Joined
Jun 17, 2007
Messages
116
Reaction score
1
Yeah,, I know this isn't really hard, but it's for you noobs out there trying to get into SA:MP :laugh:

OK,, First off I'll just explain the variables in the SetPlayerPos() function

Code:
SetPlayerPos(playerid,Float:x,Float:y,Float:z)

playerid = ID of the Player
Float:X = x coord
Float:y = y coord
Float:z = z coord
PHP:
// Teleports a player with his car or alone to the center
 // of the map if he uses the command center

    if strcmp(text,"/center",true) { // /center is what the player enter into the text field
        if (IsPlayerInAnyVehicle(playerid)) { //Checks if player is inside a vehicle
            SetVehiclePos(GetPlayerVehicleID(playerid),0.0,0.0,200.0); // Teleports the vehicle
        } else {
            SetPlayerPos(playerid,0.0,0.0,200.0); // teleports the player
        }
    }

also remember to put this code INSIDE the OnPlayerCommandText() tag!
but that you might already know :lol:

PS: This is my first tut so it might not be that good :$:
 
Re: [TUT] How to make a teleport command

Hey,

Nice tut will come in handy for me, I cant even code gta sa stuff xD But I am lerning though
this mite help me lern a bit as well xD.
 
Re: [TUT] How to make a teleport command

To help a little more you should explain how to get the coordinates of the places they want to teleport too.
 
Re: [TUT] How to make a teleport command

hehe,, you know,, thats really a problem for me too xD

I'm currently using the MTA Map Editor (download from MTA site) and I just place an object where I want it, and uses the coords that are saved in MTA to use for the teleport command (hope some of you understand,,
 
Re: [TUT] How to make a teleport command

actually the easiest way to get the coordinates is by using /save while you are in a server or in the debug mode..

then the coordinates will be saved in savedpositions.txt in your gta folder

greetz


edit: btw, nice guide.. next time try to make it a lil more noob-friendly
 
Re: [TUT] How to make a teleport command

yeah I found out a couple hours ago xD

actually I'm learning how to make SA:MP servers right now my self xD
so I'm still kind of a noob xD
 
Back