_DOOR_CONTROL
DocsDoorControl(modelHash, x, y, z, locked, xRotMult, yRotMult, zRotMult)Description
Hardcoded not to work in multiplayer environments.
Native name between SET_LOCAL_PLAYER_VISIBLE_LOCALLY & SET_MAX_WANTED_LEVEL.
OBJECT::_9B12F9A24FABEDB0(${prop_gate_prison_01}, 1845.0, 2605.0, 45.0, 0, 0.0, 50.0, 0); //door unlocked
OBJECT::_9B12F9A24FABEDB0(${prop_gate_prison_01}, 1845.0, 2605.0, 45.0, 1, 0.0, 50.0, 0); //door lockedParameters
| Name | Type | Description |
|---|---|---|
modelHash | Hash | — |
x | float | — |
y | float | — |
z | float | — |
locked | BOOL | tells the game whether or not the door is locked |
xRotMult | float | multiplier that specifies how fast the door/gate will rotate in degrees per second. |
yRotMult | float | multiplier that specifies how fast the door/gate will rotate in degrees per second. |
zRotMult | float | multiplier that specifies how fast the door/gate will rotate in degrees per second. |
Quick Snippet: Get Coordinatesxyz
xyzAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Load Model HashmodelHash
modelHashModels must be loaded before use. This snippet handles requesting and releasing properly.
-- Properly load a model before spawning/using it
local modelName = "prop_barrel_01a" -- change to your model
local modelHash = GetHashKey(modelName)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
print("Model loaded: " .. modelName .. " (" .. modelHash .. ")")
-- Release when done:
-- SetModelAsNoLongerNeeded(modelHash)Returns
voidThis native does not return a value.
Examples
Official
DoorControl(`prop_gate_prison_01`, 1845.0, 2605.0, 45.0, 0, 0.0, 50.0, 0) -- door unlocked
DoorControl(`prop_gate_prison_01`, 1845.0, 2605.0, 45.0, 1, 0.0, 50.0, 0) -- door locked