Hello here, i’m actually trying to get a door opening and close with a button, but i can’t get it to work
Here is my script
Citizen.CreateThread(function()
local door = DoesDoorExist('v_ilev_bk_vaultdoor')
print(door)
Citizen.InvokeNative(0x6F8838D03D1DC226, 'v_ilev_bk_vaultdoor', '961976194' , x, y, z, 0.0 , 0.0 , 0.0) --Add door native
print(door)
end
end)
function OpenVaultGestion()
object = ESX.Game.GetClosestObject('v_ilev_bk_vaultdoor')
local x,y,z = table.unpack(GetEntityCoords(object, true))
print(x,y,z)
local hash = GetHashKey('v_ilev_bk_vaultdoor')
print(hash)
local elements = {
{label = _U('open_vault'), value = 'open_vault'},
{label = _U('close_vault'), value = 'close_vault'}
}
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'vaultdoor',
{
title = _U('vaultdoor'),
align = 'top-left',
elements = elements,
},
function(data, menu)
menu.close()
if data.current.value == 'open_vault' then
print("before open")
Citizen.InvokeNative(0x9B12F9A24FABEDB0, 'v_ilev_bk_vaultdoor', x, y, z, 0, 0.0 , 0.50 , 0.0) --Door Control native
print("after open")
end
if data.current.value == 'close_vault' then
Citizen.InvokeNative(0x9B12F9A24FABEDB0, hash , x, y, z, 1, 0.0 , 0.50 , 0.0)
end
end,
function(data, menu)
menu.close()
CurrentAction = 'menu_vault'
CurrentActionMsg = _U('open_cloackroom')
CurrentActionData = {}
end
)
end
Any tips on how i can get it to work ?
There’s the door i want to open :
I want to get it like that when my employee press the “open” button
Any tips on what’s wrong ?