Skip to content

Commit

Permalink
refactor: style changes
Browse files Browse the repository at this point in the history
* refactor: style changes

* fix: some linting
  • Loading branch information
mafewtm authored Dec 11, 2023
1 parent 00a0643 commit 4a34410
Show file tree
Hide file tree
Showing 7 changed files with 634 additions and 968 deletions.
59 changes: 29 additions & 30 deletions client/doors.lua
Original file line number Diff line number Diff line change
@@ -1,60 +1,59 @@
local sharedConfig = require 'config.shared'
local bigBanks = require 'config.shared'.bigBanks

RegisterNetEvent('qb-bankrobbery:client:ClearTimeoutDoors', function()
--Config.DoorlockAction(4, true)
local PaletoObject = GetClosestObjectOfType(sharedConfig.bigBanks["paleto"]["coords"]["x"], sharedConfig.bigBanks["paleto"]["coords"]["y"], sharedConfig.bigBanks["paleto"]["coords"]["z"], 5.0, sharedConfig.bigBanks["paleto"]["object"], false, false, false)
if PaletoObject ~= 0 then
SetEntityHeading(PaletoObject, sharedConfig.bigBanks["paleto"]["heading"].closed)
local paletoObject = GetClosestObjectOfType(bigBanks.paleto.coords.x, bigBanks.paleto.coords.y, bigBanks.paleto.coords.z, 5.0, bigBanks.paleto.object, false, false, false)
if paletoObject ~= 0 then
SetEntityHeading(paletoObject, bigBanks.paleto.heading.closed)
end
local object = GetClosestObjectOfType(sharedConfig.bigBanks["pacific"]["coords"][2]["x"], sharedConfig.bigBanks["pacific"]["coords"][2]["y"], sharedConfig.bigBanks["pacific"]["coords"][2]["z"], 20.0, sharedConfig.bigBanks["pacific"]["object"], false, false, false)
local object = GetClosestObjectOfType(bigBanks.pacific.coords[2].x, bigBanks.pacific.coords[2].y, bigBanks.pacific.coords[2].z, 20.0, bigBanks.pacific.object, false, false, false)
if object ~= 0 then
SetEntityHeading(object, sharedConfig.bigBanks["pacific"]["heading"].closed)
SetEntityHeading(object, bigBanks.pacific.heading.closed)
end
for k in pairs(sharedConfig.bigBanks["pacific"]["lockers"]) do
sharedConfig.bigBanks["pacific"]["lockers"][k]["isBusy"] = false
sharedConfig.bigBanks["pacific"]["lockers"][k]["isOpened"] = false
for k in pairs(bigBanks.pacific.lockers) do
bigBanks.pacific.lockers[k].isBusy = false
bigBanks.pacific.lockers[k].isOpened = false
end
for k in pairs(sharedConfig.bigBanks["paleto"]["lockers"]) do
sharedConfig.bigBanks["paleto"]["lockers"][k]["isBusy"] = false
sharedConfig.bigBanks["paleto"]["lockers"][k]["isOpened"] = false
for k in pairs(bigBanks.paleto.lockers) do
bigBanks.paleto.lockers[k].isBusy = false
bigBanks.paleto.lockers[k].isOpened = false
end
sharedConfig.bigBanks["paleto"]["isOpened"] = false
sharedConfig.bigBanks["pacific"]["isOpened"] = false
bigBanks.paleto.isOpened = false
bigBanks.pacific.isOpened = false
end)

CreateThread(function()
while true do
local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
local PaletoDist = #(pos - sharedConfig.bigBanks["paleto"]["coords"])
local PacificDist = #(pos - sharedConfig.bigBanks["pacific"]["coords"][2])
if PaletoDist < 15 then
if sharedConfig.bigBanks["paleto"]["isOpened"] then
local pos = GetEntityCoords(cache.ped)
local paletoDist = #(pos - bigBanks.paleto.coords)
local pacificDist = #(pos - bigBanks.pacific.coords[2])
if paletoDist < 15 then
if bigBanks.paleto.isOpened then
--Config.DoorlockAction(4, false)
local object = GetClosestObjectOfType(sharedConfig.bigBanks["paleto"]["coords"]["x"], sharedConfig.bigBanks["paleto"]["coords"]["y"], sharedConfig.bigBanks["paleto"]["coords"]["z"], 5.0, sharedConfig.bigBanks["paleto"]["object"], false, false, false)
local object = GetClosestObjectOfType(bigBanks.paleto.coords.x, bigBanks.paleto.coords.y, bigBanks.paleto.coords.z, 5.0, bigBanks.paleto.object, false, false, false)
if object ~= 0 then
SetEntityHeading(object, sharedConfig.bigBanks["paleto"]["heading"].open)
SetEntityHeading(object, bigBanks.paleto.heading.open)
end
else
--Config.DoorlockAction(4, true)
local object = GetClosestObjectOfType(sharedConfig.bigBanks["paleto"]["coords"]["x"], sharedConfig.bigBanks["paleto"]["coords"]["y"], sharedConfig.bigBanks["paleto"]["coords"]["z"], 5.0, sharedConfig.bigBanks["paleto"]["object"], false, false, false)
local object = GetClosestObjectOfType(bigBanks.paleto.coords.x, bigBanks.paleto.coords.y, bigBanks.paleto.coords.z, 5.0, bigBanks.paleto.object, false, false, false)
if object ~= 0 then
SetEntityHeading(object, sharedConfig.bigBanks["paleto"]["heading"].closed)
SetEntityHeading(object, bigBanks.paleto.heading.closed)
end
end
end

-- Pacific Check
if PacificDist < 50 then
if sharedConfig.bigBanks["pacific"]["isOpened"] then
local object = GetClosestObjectOfType(sharedConfig.bigBanks["pacific"]["coords"][2]["x"], sharedConfig.bigBanks["pacific"]["coords"][2]["y"], sharedConfig.bigBanks["pacific"]["coords"][2]["z"], 20.0, sharedConfig.bigBanks["pacific"]["object"], false, false, false)
if pacificDist < 50 then
if bigBanks.pacific.isOpened then
local object = GetClosestObjectOfType(bigBanks.pacific.coords[2].x, bigBanks.pacific.coords[2].y, bigBanks.pacific.coords[2].z, 20.0, bigBanks.pacific.object, false, false, false)
if object ~= 0 then
SetEntityHeading(object, sharedConfig.bigBanks["pacific"]["heading"].open)
SetEntityHeading(object, bigBanks.pacific.heading.open)
end
else
local object = GetClosestObjectOfType(sharedConfig.bigBanks["pacific"]["coords"][2]["x"], sharedConfig.bigBanks["pacific"]["coords"][2]["y"], sharedConfig.bigBanks["pacific"]["coords"][2]["z"], 20.0, sharedConfig.bigBanks["pacific"]["object"], false, false, false)
local object = GetClosestObjectOfType(bigBanks.pacific.coords[2].x, bigBanks.pacific.coords[2].y, bigBanks.pacific.coords[2].z, 20.0, bigBanks.pacific.object, false, false, false)
if object ~= 0 then
SetEntityHeading(object, sharedConfig.bigBanks["pacific"]["heading"].closed)
SetEntityHeading(object, bigBanks.pacific.heading.closed)
end
end
end
Expand Down
Loading

0 comments on commit 4a34410

Please sign in to comment.