SetPlayerPos
From SA-MP
[edit]
SetPlayerPos
This function sets the players position to the specified co-ordinates.
(playerid,Float:x,Float:y,Float:z)
| playerid | ID of the player |
| Float:x | X coord |
| Float:y | Y coord |
| Float:z | Z 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); } } }
[edit]
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- SetPlayerPosFindZ: Find the next lowest Z position below the player
- GetPlayerPos: Retrieve player position
