whats the correct way to have more weapons to break the doors have got the weapon hash there with no errors only thing is that when i use it it says the msg that i have to use a crowbar any tips?
I really like your releases and so I thought I could help you with this; Its for the GCPHONE alert, we use it on Anubis RP.
function PoliceRobberyAlert()
local playerPed = PlayerPedId()
PedPosition = GetEntityCoords(playerPed)
robbery_alert = ‘House robbery in progress’
local PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z }
TriggerServerEvent(‘esx_addons_gcphone:startCall’, ‘police’, robbery_alert, PlayerCoords, {
PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z },
})
end
We ended up adding this to our server. Here is the code for a timer that will autolock the door. Drop this anywhere in your client/main.lua.
One small issue that I never cared to dig into. loop triggers as soon as the door loses any health, not just at zero. Not sure why when I’ve said “while GetEntityHealth(door) <= 0.0 do”. It’s actually a better way to do it cus now if someone leaves a door half broken it will get fixed.
Also, love your stuff Loffes. We use a bunch of your mods on our server (VandalRP).
Citizen.CreateThread(function ()
local lockCounter = 0
local player = PlayerPedId()
local coords = GetEntityCoords(player)
for i = 1, #Config.Burglary do
Wait(0)
local v = Config.Burglary[i]
local d = v.Door
local door = GetClosestObjectOfType(d.Coords, 2.0, GetHashKey(d.Object), false, 0, 0)
while GetEntityHealth(door) <= 0.0 do
Wait(5000) --This is where you adjust how long to wait before auto repairing door in miliseconds * 100
lockCounter = lockCounter + 1
if lockCounter == 100 then
TriggerServerEvent('loffe_burglary:setDoorFreezeStatus', i, true)
lockCounter = 0
end
end
end
end)
Citizen.CreateThread(function ()
local lockCounter = 0
local player = PlayerPedId()
local coords = GetEntityCoords(player)
for i = 1, #Config.Burglary do
Wait(0)
local v = Config.Burglary[i]
local d = v.Door
while not d.Frozen do
Wait(5000) --This is where you adjust how long to wait before auto repairing door in miliseconds * 100
lockCounter = lockCounter + 1
if lockCounter == 100 then
TriggerServerEvent('loffe_burglary:setDoorFreezeStatus', i, true)
lockCounter = 0
end
end
end
end)
I don’t know if it’s good to do this on every client tho, I would recommend doing it server sided so when a door is set to be open, wait like 2 minutes then lock it. Haven’t tried this, but it should work:
After row 34 in RegisterServerEvent(‘loffe_burglary:setDoorFreezeStatus’) add:
if not status then
local seconds = 120 -- 2 min
Wait(seconds*1000)
Config.Burglary[house].Door.Frozen = true
TriggerClientEvent('loffe_burglary:setFrozen', -1, house, Config.Burglary[house].Door.Frozen)
end