Skip to content

Commit

Permalink
Merge pull request #121 from singh-manavv/main
Browse files Browse the repository at this point in the history
Updated hacking minigame with qb-minigames export
  • Loading branch information
GhzGarage authored Feb 16, 2024
2 parents 05af187 + caf0a64 commit e57d55b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
10 changes: 0 additions & 10 deletions cl_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ function Config.DoorlockAction(doorId, setLocked)
TriggerServerEvent('qb-doorlock:server:updateState', doorId, setLocked, false, false, true, false, false)
end

--- This function will be triggered once the hack is done
--- @param success boolean
--- @param bank number | string
--- @return nil
function Config.OnHackDone(success, bank)
TriggerEvent('mhacking:hide')
if not success then return end
TriggerServerEvent('qb-bankrobbery:server:setBankState', bank)
end

--- This will be triggered once an action happens that can drop evidence
--- @param pos vector3
--- @param chance number
Expand Down
13 changes: 4 additions & 9 deletions client/fleeca.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ local function OpenPacificDoor()
end
end

--- This is triggered once the hack at a small bank is done
--- @param success boolean
--- @return nil
local function OnHackDone(success)
Config.OnHackDone(success, closestBank)
end

--- This will load an animation dictionary so you can play an animation in that dictionary
--- @param dict string
--- @return nil
Expand Down Expand Up @@ -267,8 +260,10 @@ RegisterNetEvent('electronickit:UseElectronickit', function()
}, {}, {}, {}, function() -- Done
StopAnimTask(ped, "anim@gangops@facility@servers@", "hotwire", 1.0)
TriggerServerEvent('qb-bankrobbery:server:removeElectronicKit')
TriggerEvent("mhacking:show")
TriggerEvent("mhacking:start", math.random(6, 7), math.random(12, 15), OnHackDone)
local success = exports['qb-minigames']:Hacking(5, 30) -- code block size & seconds to solve
if success then
TriggerServerEvent('qb-bankrobbery:server:setBankState', closestBank)
end
if copsCalled or not Config.SmallBanks[closestBank]["alarm"] then return end
TriggerServerEvent("qb-bankrobbery:server:callCops", "small", closestBank, pos)
copsCalled = true
Expand Down
13 changes: 4 additions & 9 deletions client/pacific.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ local copsCalled = false

-- Functions

--- This will be triggered once the hack in the pacific bank is done
--- @param success boolean
--- @return nil
local function OnHackPacificDone(success)
Config.OnHackDone(success, "pacific")
end

--- This will load an animation dictionary so you can play an animation in that dictionary
--- @param dict string
--- @return nil
Expand Down Expand Up @@ -87,8 +80,10 @@ RegisterNetEvent('electronickit:UseElectronickit', function()
}, {}, {}, {}, function() -- Done
TriggerServerEvent('qb-bankrobbery:server:removeElectronicKit')
StopAnimTask(ped, "anim@gangops@facility@servers@", "hotwire", 1.0)
TriggerEvent("mhacking:show")
TriggerEvent("mhacking:start", math.random(5, 9), math.random(10, 15), OnHackPacificDone)
local success = exports['qb-minigames']:Hacking(5, 30) -- code block size & seconds to solve
if success then
TriggerServerEvent('qb-bankrobbery:server:setBankState', 'pacific')
end
if copsCalled or not Config.BigBanks["pacific"]["alarm"] then return end
TriggerServerEvent("qb-bankrobbery:server:callCops", "pacific", 0, pos)
copsCalled = true
Expand Down

0 comments on commit e57d55b

Please sign in to comment.