SetPlayerPos

From SA-MP

Jump to: navigation, search


SetPlayerPos

This function sets the players position to the specified co-ordinates.


(playerid,Float:x,Float:y,Float:z)
playeridID of the player
Float:xX coord
Float:yY coord
Float:zZ coord


This function does not return a specific value, it's best to simply ignore it.


// Teleports a player with his car or alone to the center
// of the map if he uses the command teleport
public OnPlayerCommandText(playerid,text[])
{
    if strcmp(text,"/teleport",true) {
        if (IsPlayerInAnyVehicle(playerid)) {
            SetVehiclePos(GetPlayerVehicleID(playerid),0.0,0.0,200.0);
        } else {
            SetPlayerPos(playerid,0.0,0.0,200.0); 
        }
    }
}

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

Personal tools