[Release] [ESX] loffe_burglary

What is it?
It is a simple burglary script where you have to break the door using a crowbar, using anything else won’t deal any damage to the door.

Config
  • Cops required to break into the house
  • Ghetto or city setting, if ghetto then npc will spawn and if city the cops will be called
Features
  • Server synced items
  • Easy to add more locations
  • Police can fix the lock so the door will be locked
Requirements

Laggy video

Note:
It is currently in Swedish so you will have to translate, I will add a translation when I have time!

Download

5 Likes

Very neat, thanks for the Resource

Well done son :wink:

Really like the door function, overall well done!

2 Likes

hello thank you for sharing! you know what’s called the animation scripts to take and range are weapon?

Yop, it’s This one https://github.com/FiveM-Dev-Sverige/weapon_switch_anim

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?