SetPlayerPos

SetPlayerPos

Description:
Function SetPlayerPos set a player's position.
Using this function on a player in a vehicle will instantly remove them from the vehicle. Useful for quickly ejecting players.
When setting a player's position to an interior, their interior must be set also.


Parameters:
(playerid, Float:x, Float:y, Float:z)
int playerid The ID of the player to set the position of.
float X The X coordinate to position the player at.
float Y The Y coordinate to position the player at.
float Z The Z coordinate to position the player at.


Return Values:
  • 1: The function was executed successfully.
  • 0: The function failed to execute. This means the player specified does not exist.


Examples:
// Teleports players to the center of San Andreas when they type /middle
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext, "/middle", true))
    {            
        SetPlayerPos(playerid, 0.0, 0.0, 3.0);
        return 1;
    }
    return 0;
}


Related Functions
The following functions may be useful, as they are related to this function in one way or another.