From SA-MP Wiki

Jump to: navigation, search

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


Attaches a player's camera to a player-object. The player is able to move their camera while it is attached to an object. Can be used with MovePlayerObject and AttachPlayerObjectToVehicle.

(playerid, playerobjectid)
playeridThe ID of the player which will have their camera attached to a player-object.
playerobjectidThe ID of the player-object to which the player's camera will be attached.

Return Values:

This function does not return any specific values.



The player-object must be created before attempting to attach the player's camera to it.

Example Usage:

public OnPlayerCommandText(playerid, cmdtext[])
    if(!strcmp(cmdtext, "/attach", false))
        new playerobject = CreatePlayerObject(playerid, 1245, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);
        AttachCameraToPlayerObject(playerid, playerobject);
        SendClientMessage(playerid, 0xFFFFFFAA, "Your camera is now attached to an object.");
        return 1;
    return 0;

Related Functions

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

Personal tools
In other languages