5 Commits

Author SHA1 Message Date
Jim Shield
35c95f500d Merge pull request #49 from Dude495/patch-2 2025-10-22 16:38:26 +01:00
Jim Shield
0da4cfb191 Merge pull request #48 from Dude495/patch-1 2025-10-22 16:37:33 +01:00
Dude495
f723d6f444 Update charge.lua
fixed spacing
2025-10-17 17:59:10 -05:00
Dude495
26cf5f4cc9 Update charge.lua
updated function spawnCustomRegisters() to include custom images from Config.CustomCashRegisters
2025-10-17 17:45:40 -05:00
Dude495
f90161b82d Update config.lua
added img field to CustomCashRegisters to fix broken image display when using them
2025-10-17 17:42:26 -05:00
2 changed files with 18 additions and 15 deletions

View File

@@ -3,23 +3,22 @@ local Till = {}
function spawnCustomRegisters()
Wait(1000)
for k, v in pairs(Config.CustomCashRegisters) do
for i = 1, #v do
local job, gang = v[i].gang and nil or k, v[i].gang and k or nil
createBoxTarget({"CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=debugMode, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4}}, {
{
action = function()
TriggerEvent(getScript()..":client:Charge", { job = job, gang = gang, img = ""})
end,
for k, v in pairs(Config.CustomCashRegisters) do
for i = 1, #v do
local job, gang = v[i].gang and nil or k, v[i].gang and k or nil
local img = v.img or v[i].img
createBoxTarget({"CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, {name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly = debugMode, minZ = v[i].coords.z-0.1, maxZ = v[i].coords.z+0.4}}, {
{
action = function() TriggerEvent(getScript()..":client:Charge", {job = job, gang = gang, img = img}) end,
icon = "fas fa-credit-card",
label = locale("target", "charge"),
label = locale("target","charge"),
job = job,
gang = gang
}
}, 2.0)
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords + vec4(0,0,1.0, 0.0)}, 1, false) end
end
end
}, 2.0)
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords+vec4(0,0,1.0, 0.0)}, 1, false) end
end
end
end
onPlayerLoaded(function() spawnCustomRegisters() end, true)
@@ -311,4 +310,6 @@ RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billt
})
end,
})
end)
end)

View File

@@ -84,6 +84,7 @@ Config = {
CustomCashRegisters = {
-- ["jobname"] = { -- Player job role restriction
-- img = "https://i.ibb.co/HfVy87fW/image.png", -- url to image file
-- { coords = vector4(0, 0, 0, 0), }, -- vector4 to place the till and the way it faces
-- { coords = vector4(0, 0, 0, 0), prop = true, }, -- "prop = true" spawns a prop at the coords
-- },
@@ -166,4 +167,5 @@ function locale(section, string)
if not localTable[section] then return "["..section.."] Invalid" end
if not localTable[section][string] then return "["..string.."] Invalid" end
return localTable[section][string]
end
end