Skip to content

Object ​

A model placed in the world by the server. It is removed when its creating resource stops or its parent is removed. It stays still and no client can break it until the server moves it. Reads and actions return nil, err once it is gone.

Object:id ​

Returns id integer

Object:model ​

Returns model integer|nil, err string|nil

Object:position ​

Returns the current position, including during a movement; while attached, returns the offset from the parent.

Returns x_or_nil number|nil, y_or_err number|string|nil, z number|nil

Object:rotation ​

Returns the current rotation in degrees; while attached, it is relative to the parent.

Returns rx_or_nil number|nil, ry_or_err number|string|nil, rz number|nil

Object:is_moving ​

Returns moving boolean|nil, err string|nil

Object:is_broken ​

Returns broken boolean|nil, err string|nil

Object:set_broken ​

Breaks the object on every client at once, with the game's own debris, or restores it. Nothing else breaks an object: shots, explosions and vehicles leave it intact, and the gamemode decides, for example from hit_object of player_weapon_fire. Breaking never causes an explosion; for a barrel's blast, call dlmp.create_explosion. A broken object stays in the world without collision: shots pass through it, it can still move and carry objects, and players who arrive later see it broken. Fails for a model the game never breaks and for an object on a bone. Setting the current state succeeds and sends nothing.

Parameters

  • on boolean

Returns ok boolean|nil, err string|nil

Object:set_position ​

Moves the object instantly and ends any movement without raising object_move_end. While attached, sets the offset from the parent.

Parameters

  • x number
  • y number
  • z number

Returns ok boolean|nil, err string|nil

Object:set_rotation ​

Rotates the object instantly and ends any movement without raising object_move_end.

Parameters

  • rx number — Degrees, -3600..3600.
  • ry number
  • rz number

Returns ok boolean|nil, err string|nil

Object:move ​

Moves the object at constant speed from its current position, replacing any running movement, and raises object_move_end when done. A player standing on it moves with it. Fails while attached or above 100 m/s.

Parameters

  • x number
  • y number
  • z number
  • duration_ms integer — 1..3600000
  • rx (optional) number — Target rotation in degrees; if omitted, the rotation does not change.
  • ry (optional) number
  • rz (optional) number

Returns ok boolean|nil, err string|nil

Object:stop ​

Stops the object where it is, without raising object_move_end.

Returns ok boolean|nil, err string|nil

Object:attach ​

Attaches the object to a player (at the body's root; attach_bone attaches to a bone), a vehicle or an object, and the object takes the parent's scope. It stays attached through death and respawn; removing the parent removes the object. Ends any movement. Fails for a chain deeper than 8 levels, an attachment to itself, or a parent on a bone.

Parameters

  • parent Player|Vehicle|Object
  • x (optional) number — Offset; defaults to 0, up to 1000 on each axis.
  • y (optional) number
  • z (optional) number
  • rx (optional) number — Rotation relative to the parent in degrees; defaults to 0.
  • ry (optional) number
  • rz (optional) number

Returns ok boolean|nil, err string|nil

Object:attach_bone ​

Attaches the object to a bone of the player's body: it follows that bone through every animation and stays attached through death, respawn and skin changes. The offset and rotation are in the bone's frame. Only clients know where the bone is, so the server streams the object and detaches it at the player's root. An object on a bone cannot carry objects. Ends any movement. Fails for an unknown bone.

Parameters

  • player Player
  • bone PedBone
  • x (optional) number — Offset in meters; defaults to 0, up to 1000 on each axis.
  • y (optional) number
  • z (optional) number
  • rx (optional) number — Rotation relative to the bone in degrees; defaults to 0.
  • ry (optional) number
  • rz (optional) number

Returns ok boolean|nil, err string|nil

PedBone ​

One of: "spine", "head", "neck", "left_clavicle", "right_clavicle", "left_upper_arm", "right_upper_arm", "left_forearm", "right_forearm", "left_hand", "right_hand", "left_thigh", "right_thigh", "left_calf", "right_calf", "left_foot", "right_foot"

Object:detach ​

Detaches the object in place, keeping its world position and rotation; it stays in the parent's scope.

Returns ok boolean|nil, err string|nil

Object:attach_in_place ​

Attaches the object in place: the offset and rotation are chosen to keep its current pose in the world.

Parameters

Returns ok boolean|nil, err string|nil

Documentation licensed under CC BY 4.0. DarqlineMP is not affiliated with Rockstar Games or Take-Two Interactive. Grand Theft Auto is a trademark of Take-Two Interactive Software, Inc.