Skip to content

Commit c1f72e7

Browse files
committed
v1.4.0
1 parent a6e875d commit c1f72e7

12 files changed

+886
-521
lines changed

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Lation's 24/7 Robbery
2-
An engaging 24/7 robbery script for ESX, QBCore & QBox FiveM servers. Rob the registers, hack the computer for a security code & use that code to get access to the safe for even more money! Creating exciting quick-cash opportunities for your players is vital for any successful roleplay server! Includes cooldowns that restrict players from chain-robbing. If you fail hacking the computer too many times (configurable) you will fail the robbery and have to start over. If you try unlocking the safe unsuccessfully too many times (configurable) you will fail the robbery and have to start over. Every robbery will generate a new & unique "PIN" to unlock the safe. Furthermore, there is a small chance you can get lucky & find a note under the register that gives you the safe's PIN and allows you to skip hacking the computer at all - giving the criminals an edge and buying themselves some much needed time before the police arrive! The chance to find the note is configured and/or could be disabled entirely.
2+
FiveM's most popular 24/7 store robbery script for ESX, QBCore & QBox servers!
33

44
## Preview
55
[![lation 247robbery preview](http://img.youtube.com/vi/L5fWSR1G_mA/0.jpg)](https://www.youtube.com/watch?v=L5fWSR1G_mA)
@@ -10,26 +10,26 @@ An engaging 24/7 robbery script for ESX, QBCore & QBox FiveM servers. Rob the re
1010

1111
## Features
1212
- Supports ESX, QBCore & QBox
13-
- Customizable Discord webhook logging
14-
- Highly detailed config file
13+
- Supports FiveManage & Fivemerr logging services
14+
- Intuitive & easy-to-use config
1515
- Preconfigured for default 24/7 (Gabz 24/7 coords included)
1616
- Customize payouts to player (dirty money, cash, items, etc)
17-
- Require police presence in the city
18-
- Increase reward payout based on number of police in the city
19-
- Default support for cd_dispatch, ps-dispatch, qs-dispatch, linden_outlawalert & custom option
20-
- Default support for ox_lib, ESX, QBCore, okok, sd-notify notifications & custom option
21-
- Configurable cooldowns for registers & safes
17+
- Optionally require a police presence to start robbery
18+
- Increase reward payout based on number of police
19+
- Supports 9 different police dispatching scripts
20+
- Supports ox_lib, ESX, QBCore, okok, sd-notify, wasabi_notify & custom option
21+
- Configurable per-player cooldowns
2222
- Configurable max attempts at hacking and/or unlocking the safe
2323
- Customizable computer hack minigame (choose skillcheck or questionnaire)
2424
- If using questionnaire hack, ability to fully customize each question & answer
2525
- Ability to easily create unlimited questions if enabled
26-
- Easily customize skillcheck difficulty and inputs
26+
- Easily change skillcheck minigame to any minigame
2727

2828
## Dependencies
2929
- [ox_lib](https://github.com/overextended/ox_lib/releases)
30-
- [ox_target](https://github.com/overextended/ox_target/releases), [qb-target](https://github.com/qbcore-framework/qb-target) or [qtarget](https://github.com/overextended/ox_target/releases)
30+
- [ox_target](https://github.com/overextended/ox_target/releases), [qb-target](https://github.com/qbcore-framework/qb-target) or [interact](https://github.com/darktrovx/interact)
3131

3232
## Installation
33-
- Ensure you have all dependencies above installed
34-
- Add lation_247robbery to your 'resources' directory
35-
- Add 'ensure lation_247robbery' in your 'server.cgf'
33+
- Install (or update) all dependencies listed above
34+
- Download & extract lation_247robbery into your 'resources' directory
35+
- Add 'ensure lation_247robbery' in your 'server.cfg' after all dependencies

bridge/client.lua

+120-72
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,142 @@
1+
-- Initialize global variables to store framework & inventory
2+
Framework, Inventory = nil, nil
3+
4+
-- Initialize global player variables
15
PlayerLoaded, PlayerData = nil, {}
2-
local ox_inv = GetResourceState('ox_inventory') == 'started'
36

47
-- Get framework
5-
if GetResourceState('es_extended') == 'started' then
6-
ESX = exports['es_extended']:getSharedObject()
7-
Framework = 'esx'
8-
9-
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
10-
PlayerData = xPlayer
11-
PlayerLoaded = true
12-
end)
13-
14-
RegisterNetEvent('esx:onPlayerLogout', function()
15-
table.wipe(PlayerData)
16-
PlayerLoaded = false
17-
end)
18-
19-
AddEventHandler('onResourceStart', function(resourceName)
20-
if GetCurrentResourceName() ~= resourceName or not ESX.PlayerLoaded then
21-
return
22-
end
23-
PlayerData = ESX.GetPlayerData()
24-
PlayerLoaded = true
25-
end)
8+
InitializeFramework = function()
9+
if GetResourceState('es_extended') == 'started' then
10+
ESX = exports['es_extended']:getSharedObject()
11+
Framework = 'esx'
2612

27-
elseif GetResourceState('qb-core') == 'started' then
28-
QBCore = exports['qb-core']:GetCoreObject()
29-
Framework = 'qb'
13+
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
14+
PlayerData = xPlayer
15+
PlayerLoaded = true
16+
TriggerEvent('lation_meth:onPlayerLoaded')
17+
end)
3018

31-
AddStateBagChangeHandler('isLoggedIn', '', function(_bagName, _key, value, _reserved, _replicated)
32-
if value then
33-
PlayerData = QBCore.Functions.GetPlayerData()
34-
else
19+
RegisterNetEvent('esx:onPlayerLogout', function()
3520
table.wipe(PlayerData)
36-
end
37-
PlayerLoaded = value
38-
end)
21+
PlayerLoaded = false
22+
end)
3923

40-
AddEventHandler('onResourceStart', function(resourceName)
41-
if GetCurrentResourceName() ~= resourceName or not LocalPlayer.state.isLoggedIn then
42-
return
43-
end
44-
PlayerData = QBCore.Functions.GetPlayerData()
45-
PlayerLoaded = true
46-
end)
47-
else
48-
-- Add support for a custom framework here
24+
AddEventHandler('onResourceStart', function(resourceName)
25+
if GetCurrentResourceName() ~= resourceName or not ESX.PlayerLoaded then return end
26+
PlayerData = GetPlayerData()
27+
PlayerLoaded = true
28+
TriggerEvent('lation_meth:onPlayerLoaded')
29+
end)
30+
31+
elseif GetResourceState('qbx_core') == 'started' then
32+
Framework = 'qbx'
33+
34+
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
35+
PlayerData = GetPlayerData()
36+
PlayerLoaded = true
37+
TriggerEvent('lation_meth:onPlayerLoaded')
38+
end)
39+
40+
RegisterNetEvent('qbx_core:client:playerLoggedOut', function()
41+
table.wipe(PlayerData)
42+
PlayerLoaded = false
43+
end)
44+
45+
AddEventHandler('onResourceStart', function(resourceName)
46+
if GetCurrentResourceName() ~= resourceName then return end
47+
PlayerData = GetPlayerData()
48+
PlayerLoaded = true
49+
TriggerEvent('lation_meth:onPlayerLoaded')
50+
end)
51+
elseif GetResourceState('qb-core') == 'started' then
52+
QBCore = exports['qb-core']:GetCoreObject()
53+
Framework = 'qb'
54+
55+
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
56+
PlayerData = GetPlayerData()
57+
PlayerLoaded = true
58+
TriggerEvent('lation_meth:onPlayerLoaded')
59+
end)
60+
61+
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
62+
table.wipe(PlayerData)
63+
PlayerLoaded = false
64+
end)
65+
66+
AddEventHandler('onResourceStart', function(resourceName)
67+
if GetCurrentResourceName() ~= resourceName or not LocalPlayer.state.isLoggedIn then return end
68+
PlayerData = GetPlayerData()
69+
PlayerLoaded = true
70+
TriggerEvent('lation_meth:onPlayerLoaded')
71+
end)
72+
else
73+
-- Add custom framework here
74+
end
4975
end
5076

51-
-- Function that returns true or false if player has item
77+
-- Get inventory
78+
InitializeInventory = function()
79+
if GetResourceState('ox_inventory') == 'started' then
80+
Inventory = 'ox_inventory'
81+
elseif GetResourceState('qb-inventory') == 'started' then
82+
Inventory = 'qb-inventory'
83+
elseif GetResourceState('qs-inventory') == 'started' then
84+
Inventory = 'qs-inventory'
85+
elseif GetResourceState('ps-inventory') == 'started' then
86+
Inventory = 'ps-inventory'
87+
elseif GetResourceState('lj-inventory') == 'started' then
88+
Inventory = 'lj-inventory'
89+
elseif GetResourceState('origen_inventory') == 'started' then
90+
Inventory = 'origen_inventory'
91+
elseif GetResourceState('codem-inventory') == 'started' then
92+
Inventory = 'codem-inventory'
93+
else
94+
-- Add custom inventory here
95+
end
96+
end
97+
98+
-- Returns player data
99+
GetPlayerData = function()
100+
if Framework == 'esx' then
101+
return ESX.GetPlayerData()
102+
elseif Framework == 'qb' then
103+
return QBCore.Functions.GetPlayerData()
104+
elseif Framework == 'qbx' then
105+
return exports.qbx_core:GetPlayerData()
106+
else
107+
-- Add custom framework here
108+
end
109+
end
110+
111+
-- Returns boolean if player has specified amount of item
52112
--- @param item string
53113
--- @param amount number
114+
--- @return boolean
54115
HasItem = function(item, amount)
55-
if not item or not amount then return end
56-
if ox_inv then
57-
local count = exports.ox_inventory:Search('count', item)
58-
if count >= amount then
59-
return true
60-
end
61-
return false
62-
end
63-
if Framework == 'esx' then
64-
if not ESX.GetPlayerData() or not ESX.GetPlayerData().inventory then
65-
return false
116+
if not item or not amount then return false end
117+
if Inventory then
118+
if Inventory == 'ox_inventory' then
119+
return exports[Inventory]:Search('count', item) >= amount
120+
else
121+
return exports[Inventory]:HasItem(item, amount)
66122
end
67-
local inventory = ESX.GetPlayerData().inventory
123+
else
124+
local playerData = GetPlayerData()
125+
if not playerData then return false end
126+
local inventory = Framework == 'esx' and playerData.inventory or playerData.items
127+
if not inventory then return false end
68128
for _, itemData in pairs(inventory) do
69-
if itemData.name == item then
70-
local count = itemData.count or itemData.amount
71-
if count >= amount then
72-
return true
73-
end
74-
end
75-
end
76-
return false
77-
elseif Framework == 'qb' then
78-
local PlayerData = QBCore.Functions.GetPlayerData()
79-
if not PlayerData or not PlayerData.items then
80-
return false
81-
end
82-
for _, itemData in pairs(PlayerData.items) do
83129
if itemData and itemData.name == item then
84-
local count = itemData.amount or itemData.count
130+
local count = itemData.amount or itemData.count or 0
85131
if count >= amount then
86132
return true
87133
end
88134
end
89135
end
90136
return false
91-
else
92-
-- Add support for a custom framework here
93137
end
94-
end
138+
end
139+
140+
-- Initialize defaults
141+
InitializeFramework()
142+
InitializeInventory()

0 commit comments

Comments
 (0)