open.mp | SetPlayerPos
  • Home
  • FAQ
  • Forum
  • Servers
  • Docs
  • Blog
  • Login
  • Englishاللغة العربيةar-TNবাংলাbosanski jezikDeutschΕλληνικάEspañoleestiفارسیFrançaisHrvatskimagyarBahasa IndonesiaItaliano日本語ქართულიlietuvių kalbaNederlandsNorskjęzyk polskiPortuguêsRomânăРусскийslovenski jezikсрпски језикไทยWikang TagalogTürkçeУкраїнськаاردوTiếng Việt简体中文繁體中文
warning Not Translated

This page has not been translated into the language that your browser requested. The English content is being shown as a fallback.

If you want to contribute a translation for this page then please click here.

SetPlayerPos

Description

Set a player's position.

NameDescription
playeridThe ID of the player to set the position of.
Float:xThe X coordinate to position the player at.
Float:yThe Y coordinate to position the player at.
Float:zThe Z coordinate to position the player at.

Returns

1: The function 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;
}

Notes

tip

Using this function on a player in a vehicle will instantly remove them from the vehicle. Useful for quickly ejecting players.

tip

When setting a player's position to an interior, their interior must be set also.

Related Functions

  • SetPlayerPosFindZ: Set a player's position and find the ground.
  • GetPlayerPos: Get a player's position.
  • SetVehiclePos: Set the position of a vehicle.
  • GetVehiclePos: Get the position of a vehicle.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub