EditObject

From SA-MP Wiki

Jump to: navigation, search


Allows a player to edit an object (position and rotation) using a GUI (Graphical User Interface).


The GUI to edit the object.


EditObject was added in SA-MP 0.3x 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 ID of the object to be edited by the player.


Returns1 on success and 0 on failure.


new object;
public OnGameModeInit()
{
    object = CreateObject(1337, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    return 1;
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/oedit", true))
    {
        EditObject(playerid, object);
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You can now edit the object!");
        return 1;
    }
    return 0;
}
Image:32px-Ambox_warning_orange.png Note: Players can move the camera while editing by holding the sprint key (by default this is the spacebar) and moving the mouse.


Related Functions

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

Personal tools