AttachObjectToVehicle

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:54, 6 May 2013
Smithy (Talk | contribs)

← Previous diff
Revision as of 22:22, 31 January 2014
Connor Mead (Talk | contribs)

Next diff →
Line 55: Line 55:
[[Category:Scripting Functions]] [[Category:Scripting Functions]]
 +[[fr:AttachObjectToPlayer]]
[[ru:AttachObjectToPlayer]] [[ru:AttachObjectToPlayer]]

Revision as of 22:22, 31 January 2014




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


Description:

Attach an object to a vehicle.


Parameters:
(objectid, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ)


objectidThe ID of the object to attach to the vehicle.
vehicleidThe ID of the vehicle to attach the object to.
Float:OffsetXThe X axis offset.
Float:OffsetYThe Y axis offset.
Float:OffsetZThe Z axis offset.
Float:RotXThe X rotation offset.
Float:RotYThe Y rotation offset.
Float:RotZThe Z rotation offset.


Return Values:

This function does not return any specific values.


Image:32px-Ambox_warning_orange.png

Note

You need to create the object first.
Image:32px-Circle-style-warning.png

Important
Note

When the vehicle is destroyed or respawned, the attached objects won't be destroyed. They will remain stationary at the position the vehicle disappeared and be re-attached to the next vehicle to claim the vehicle ID that the objects were attached to.


new objectid = CreateObject(...);
new vehicleid = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(objectid, vehicleid, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);

Related Functions

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



In other languages