ObjectClient

addDoorToSystem

ADD_DOOR_TO_SYSTEM0x6F8838D03D1DC226

The GTA V native ADD_DOOR_TO_SYSTEM of the OBJECT namespace, as LS:MP client scripts call it: the global function addDoorToSystem, in JavaScript and in Lua.

SignatureJavaScript
addDoorToSystem(
  doorHash: Hash,
  modelHash: Hash,
  x: number,
  y: number,
  z: number,
  p5: boolean,
  scriptDoor: boolean,
  isLocal: boolean,
  p8: any
): void
SignatureLua
addDoorToSystem(
  doorHash: Hash,
  modelHash: Hash,
  x: number,
  y: number,
  z: number,
  p5: boolean,
  scriptDoor: boolean,
  isLocal: boolean,
  p8: any
)

Usage

JavaScript
addDoorToSystem(doorHash, modelHash, x, y, z, p5, scriptDoor, isLocal, p8);
Lua
addDoorToSystem(doorHash, modelHash, x, y, z, p5, scriptDoor, isLocal, p8)

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
addDoorToSystem(doorHash, modelHash, pos, p5, scriptDoor, isLocal, p8);
Lua · with vectors
addDoorToSystem(doorHash, modelHash, pos, p5, scriptDoor, isLocal, p8)

Parameters

ParameterTypeJavaScriptLua
doorHashHashnumberinteger
modelHashHashnumberinteger
xfloatnumbernumber
yfloatnumbernumber
zfloatnumbernumber
p5BOOLbooleanboolean
scriptDoorBOOLbooleanboolean
isLocalBOOLbooleanboolean
p8Anyanyany

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

p5 only set to true in single player native scripts.
If scriptDoor is true, register the door on the script handler host (note: there's a hardcap on the number of script IDs that can be added to the system at a given time). If scriptDoor and isLocal are both false, the door is considered to be in a "Persists w/o netobj" state.

door hashes normally look like PROP_[int]_DOOR_[int] for interior doors and PROP_BUILDING_[int]_DOOR_[int] exterior doors but you can just make up your own hash if you want
All doors need to be registered with addDoorToSystem before they can be manipulated with the door natives and the easiest way to get door models is just find the door in codewalker.

Example: AddDoorToSystem("PROP_43_DOOR_0", "hei_v_ilev_fh_heistdoor2", -1456.818, -520.5037, 69.67043, 0, 0, 0)

Reference

Namespace
Object OBJECT
In the game
void ADD_DOOR_TO_SYSTEM(Hash doorHash, Hash modelHash, float x, float y, float z, BOOL p5, BOOL scriptDoor, BOOL isLocal, Any p8)
Hash
0x6F8838D03D1DC226

Open in the interactive natives reference