Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Customisable points for Selling materials
- Nicely animated for better immersion

- Supports QBOX
- Supports QBOX and ESX
- Easily adaptable to your own framework

---
Expand Down
12 changes: 8 additions & 4 deletions client/functions.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
lib.locale()

function AddNetworkPropTarget(entity, options)
if Config.Integrations.target == "ox_target" then
exports.ox_target:addEntity(entity, options)
Expand All @@ -11,14 +13,16 @@ function Notif(src, msg)
if Config.Integrations.notify == "ox_lib" then
TriggerEvent('ox_lib:notify', {
type = 'success',
title = 'Construction Robbery',
title = locale('name_robbery'),
description = msg,
duration = 5000,
position = 'top-right'
})
return
elseif Config.Integrations.notify == 'esx' then
exports["esx_notify"]:Notify("success", 3000, msg, locale('name_robbery'))
else
print("[ERROR] No Notify integration found.")
end
print("[ERROR] No Notify integration found.")
end
function RandomMiniGame()
local minigames = {'qte', 'circle', 'memory', 'math', 'reaction'}
Expand All @@ -30,7 +34,7 @@ function ProgressBar(label, duration, options)
if Config.Integrations.progressbar == "ox_lib" then
return lib.progressBar({
duration = duration or 3000,
label = label or 'Working...',
label = label or locale('work'),
useWhileDead = options.useWhileDead or false,
canCancel = options.canCancel ~= false,
disable = options.disable or {
Expand Down
6 changes: 3 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ Citizen.CreateThread(function()
{
name = 'loot_construction_safe',
icon = 'fa-solid fa-box-open',
label = 'Loot '.. lootData.name,
label = locale('loot_name', lootData.name) ,
distance = 3.0,
onSelect = function()

local success = ProgressBar('Looting '.. lootData.name ..'...', 5000, {
local success = ProgressBar(locale('loot',lootData.name), 5000, {

anim = {
dict = lootData.lootAnimation.dict,
Expand All @@ -336,7 +336,7 @@ Citizen.CreateThread(function()
local success = RunMiniGame(lootData.minigame)

if not success then
Notif(PlayerId(), 'You failed to loot the '.. lootData.name ..'.')
Notif(PlayerId(), locale('fail_loot',lootData.name))
return
end
TriggerServerEvent('UC-PatrolRobbery:lootLootable', lootData.netId)
Expand Down
6 changes: 3 additions & 3 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Config.Debug = false
Config.Integrations = {
target = "ox_target",
progressbar = "ox_lib",
notify = "ox_lib",
notify = "ox_lib", --esx, ox_lib
inventory = "ox_inventory",
}
--Add new minigames here
Expand Down Expand Up @@ -70,7 +70,7 @@ Config.Locations = {
},
},
lootables = {
["Safe"] = {
["Safe"] = {
model = "xm3_prop_xm3_safe_01a", --Find here https://forge.plebmasters.de/
lootAnimation = {
dict = 'mini@safe_cracking',
Expand Down Expand Up @@ -99,4 +99,4 @@ Config.Locations = {
},
},

}
}
4 changes: 3 additions & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ dependencies {
lua54 'yes'
use_experimental_fxv2_oal 'yes'


files {
'locales/*.json'
}
9 changes: 9 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name_robbery": "Construction Robbery",
"cooldown_robbery": "Lootable is on cooldown, please wait %s seconds.",
"work": "Working...",
"loot_name": "Loot %s",
"loot": "Looting %s ...",
"fail_loot": "You failed to loot the %s.",
"not_enought_space": "You cannot carry any more %s."
}
9 changes: 9 additions & 0 deletions locales/pl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name_robbery": "Napad na budowę",
"cooldown_robbery": "Jest pusty, poczekaj %s sekund.",
"work": "Pracowanie...",
"loot_name": "Łup %s",
"loot": "Przeszukiwanie %s ...",
"fail_loot": "Nie udało ci się ukraść %s.",
"not_enought_space": "Nie masz już miejsca w ekwipunku %s."
}
13 changes: 8 additions & 5 deletions server/functions.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
lib.locale()

function AddItem(item, amount, src)
if Config.Integrations.inventory == "ox_inventory" then
if not exports.ox_inventory:CanCarryItem(src, item, 1) then
NotifServer(src, "You cannot carry any more "..item..".")
NotifServer(src, locale('not_enought_space', item))
return
end
exports.ox_inventory:AddItem(src, item, amount)
Expand All @@ -14,15 +16,16 @@ function NotifServer(src, msg)
if Config.Integrations.notify == "ox_lib" then
TriggerClientEvent('ox_lib:notify', src, {
type = 'success',
title = 'Construction Robbery',
title = locale('name_robbery'),
description = msg,
duration = 5000,
position = 'top-right'
})
return
elseif Config.Integrations.notify == "esx" then
TriggerClientEvent("ESX:Notify", src, "success", 3000, msg, locale('name_robbery'))
else
print("[ERROR] No Notify integration found.")
end
print("[ERROR] No Notify integration found.")

end

function CallPolice(coords)
Expand Down
2 changes: 1 addition & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RegisterNetEvent('UC-PatrolRobbery:lootLootable', function(netID)
GiveRewards(l, src)
else

NotifServer(src, "Lootable is on cooldown, please wait "..math.floor(l.cooldown / 1000).." seconds.")
NotifServer(src, locale('cooldown_robbery', math.floor(l.cooldown / 1000)))
end
break
end
Expand Down