EditAttachedObject

From SA-MP Wiki

Jump to: navigation, search


Description:

Enter edition mode for an attached object.


EditAttachedObject 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, index)
playeridThe ID of the player to enter in to edition mode
indexThe index (slot) of the attached object to edit


Return Values:

1 on success and 0 on failure.


public OnPlayerSpawn(playerid)
{
    SetPlayerAttachedObject(playerid, 0, 1337, 2);
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/edit", true))
    {
        EditAttachedObject(playerid, 0);
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You now edit your attached object on index slot 0!");
        return 1;
    }
    return 0;
}

The GUI to edit the attached 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.


There are 7 clickable buttons in edition mode.
The three single icons that have X/Y/Z on them can be dragged to edit position/rotation/scale.
The four buttons in a row are to select the edition mode and save edition: [Move] [Rotate] [Scale] [Save].
Clicking save will call OnPlayerEditAttachedObject.

Image:32px-Circle-style-warning.png

Important
Note

Players will be able to scale objects up to a very large or negative value size. Limits should be put in place using OnPlayerEditAttachedObject to abort the edit.


Related Functions

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


Related Callbacks

The following callbacks might be useful, as they're related to this function in one way or another.

Personal tools
In other languages