انتقل إلى المحتوى الرئيسي

AttachObjectToVehicle

Description

Attach an object to a vehicle.

NameDescription
objectidThe ID of the object to attach to the vehicle. Note that this is an object ID, not a model ID. The object must be CreateObject created first.
parentidThe ID of the vehicle to attach the object to.
Float:offsetXThe X axis offset from the vehicle to attach the object to.
Float:offsetYThe Y axis offset from the vehicle to attach the object to.
Float:offsetZThe Z axis offset from the vehicle to attach the object to.
Float:rotationXThe X rotation offset for the object.
Float:rotationYThe Y rotation offset for the object.
Float:rotationZThe Z rotation offset for the object.

Returns

This function does not return any specific values.

Examples

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

Notes

تلميح

The object must be created first.

warning

When the vehicle is destroyed or respawned, the attached objects won't be destroyed with it; they will remain stationary at the position the vehicle disappeared and be reattached to the next vehicle to claim the vehicle ID that the objects were attached to.