[Release] [ESX] loffe_burglary

thank you

how do i change to city setting because now police wont get message

and i have gcphone is that a problem?

Yes, this script is for esx_phone since gcphone does not have any built in function for sending police a message, at least not that I know of.

beautiful script I definitely tested the only flaw and that you can only use houses with interior ++ REP

That is the point of this burglary, there are other burglary scripts with teleports, for example 99kr-burglary

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

@Loffes Is there a way to make make it that the doors reset themselves if there are no cops online? Or if cops < 2

Yes, but you would need to do that yourself.

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)

Thank you :smiley:

Can you try this instead?

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
1 Like

Thanks man I’ll give that a shot (I’m aware that my script was not perfect, lol)

edit: I was not able to get either of your solutions to work unfortunately. No errors either so I can’t be much help here

So im having a problem where nothing happens, im just there banging the door, went to look for erros and got nothing :frowning: Help pls

Sounds weird, I have no idea why. Have you run the sql file? Have you checked so that you are not a cop?

I think i was a cop let me try again today and i will give you feedback.

Do you know if fixing the lock is supposed to reset the loot tables? People are saying that sometimes they go into a house and the loot is still empty even though the lock was fixed by an officer. Any help in understanding how its supposed to reset would be great.

No, only the lock gets fixed

2 Likes

Thanks for the reply. My only suggestion that would make this script perfect is a way to reset the loot tables without restarting the service. I’m new to fivem coding but I’ve been trying without success.

Still …such a fun mod that has added a lot good RP to our server.

I don’t understand why you would want that but I can make it for you

1 Like