EditPlayerObject

From SA-MP Wiki

Jump to: navigation, search


Description:

Allows players to edit a player-object (position and rotation) with a GUI and their mouse.


EditPlayerObject was added in SA-MP 0.3e This function was added in SA-MP 0.3e and will not work in earlier versions!


Parameters:
(playerid, objectid)
playeridThe ID of the player that should edit the object
objectidThe object to be edited by the player


Return Values:

  • 1: The function executed successfully.
  • 0: The function failed to execute. Player or object not valid.


Example Usage:

new object[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
    object[playerid] = CreatePlayerObject(playerid, 1337, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/edit", true))
    {
        EditPlayerObject(playerid, object[playerid]);
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You now edit your object!");
        return 1;
    }
    return 0;
}

The GUI to edit the object.

Image:32px-Ambox_warning_orange.png

Note

You can move the camera while editing by pressing and holding the spacebar (or W in vehicle) and moving your mouse.


Related Functions

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

Personal tools