12 Commits

Author SHA1 Message Date
Jim Shield
ee11d79fa6 Version Bump
`3.0.03` - `3.0.04`
2025-06-01 21:48:25 +01:00
Jim Shield
784d13914f Separate and fix ped loading for tickets/banks
I unified the bank locations and ticket cash in locations and forgot that people disable the banking part of the script

Now, if Banks and `CashInAnywhere` is disabled, it creates a separate ped for tickets only (default location is pacific bank)

If Banks are enabled, but `CashInAnywhere` is disabled, it creates the separate ped also

If Banks are enabled AND `CashInAnywhere` is enabled, the separate ped won't be used and the bank peds will share the target options
2025-06-01 21:44:29 +01:00
Jim Shield
10f14f846e Fix typo for Gabz default cash in location 2025-06-01 21:38:56 +01:00
Jim Shield
1ca2e45a37 add workaround for if onlineList is nil 2025-05-26 18:59:10 +01:00
Jim Shield
2e3fef8846 fix job/gang lock of custom cash registers 2025-05-26 18:58:17 +01:00
Jim Shield
1b69b44f5c fix custom cash registers spawn offset location 2025-05-26 18:51:18 +01:00
Jim Shield
d252ce6a02 Version Bump
`3.0.02` - `3.0.03`
2025-05-21 11:00:23 +01:00
Jim Shield
4bc2aaa95f Re-add terminal item and info 2025-05-21 10:59:07 +01:00
Jim Shield
fdf92fde64 fix custom cash register function 2025-05-21 10:49:14 +01:00
Jim Shield
954b208016 add if statement to prop removal, just incase 2025-05-19 15:20:26 +01:00
Jim Shield
51265681c1 Update README.md 2025-05-19 15:16:53 +01:00
Jim Shield
6ab839e2a3 Unify cashregister and terminal commands
This makes `/cashregister` and `/terminal` the same, since they were already.

(I kept both as not to confuse people if one went missing)

`/terminal` originally was added to make use of the `bzzz_terminal` prop and anim, but now it works with both commands if enabled in the config
2025-05-19 15:04:28 +01:00
10 changed files with 124 additions and 30 deletions

View File

@@ -40,19 +40,24 @@ ensure [jim]
---
## BZZ Terminal Instructions
Free Package https://bzzz.tebex.io/package/5551076
Stream the prop and add the emote that is provided to rpemotes or dpemotes
If you enable Config.General.Usebzzz then the script will use `bzzz_terminal` to automatically create a prop and animation when using the commands:
- `/cashregister`
- `/terminal`
This is also available as an item users can use by adding this to your shared items
```lua
['terminal'] = {['name'] = 'terminal', ['label'] = 'Wireless Terminal', ['weight'] = 5000, ["type"] = "item", ["image"] = 'terminal.png', ['unique'] = true, ['useable'] = true, ["shouldClose"] = true, ["combinable"] = nil, ['description'] = ''},
terminal = { name = 'terminal', label = 'Wireless Terminal', weight = 5000, ["type"] = "item", ["image"] = 'terminal.png', unique = true, useable = true, ["shouldClose"] = true, ["combinable"] = nil, description = '' },
```
This payment terminal prop is available as a Free Package from https://bzzz.tebex.io/package/5551076
---
## Item installation
- To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua
- Naviage to `[qb] > qb-core / shared / items.lua` and add this line
```lua
payticket = { name = "payticket", label = "Receipt", weight = 10, type = "item", image = "ticket.png", unique = false, useable = false, shouldClose = false, description = "Cash these in at the bank!" },
payticket = { name = "payticket", label = "Receipt", weight = 10, type = "item", image = "ticket.png", unique = false, useable = false, shouldClose = false, description = "Cash these in at the bank!" },
```
- Add the ticket image to your inventory script:

View File

@@ -24,22 +24,29 @@ if Config.Banks.enable then
jobroles[k] = 0
end
end
createCircleTarget(
{ name, vec3(v[i].x, v[i].y, v[i].z+0.2), 2.0, { name = name, debugPoly = debugMode, useZ = true, }, }, {
{ action = function()
local options = {
{ action = function()
if Config.General.Peds and isStarted("jim-talktonpc") then
exports["jim-talktonpc"]:createCam(Peds[name], true, "generic", true)
end
TriggerEvent(getScript()..":Client:Bank", { ped = Config.General.Peds and Peds[name] })
end,
icon = "fas fa-piggy-bank", label = locale("target", "bank") },
icon = "fas fa-piggy-bank", label = locale("target", "bank")
},
}
if Config.Receipts.CashInAnywhere then
options[#options+1] =
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = false }) end,
icon = "fas fa-receipt", label = locale("target", "cashin_boss"), job = jobroles,
},
}
options[#options+1] =
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = true }) end,
icon = "fas fa-receipt", label = locale("target", "cashin_gang"), gang = gangroles,
},
}, 2.5)
}
end
jsonPrint(options)
createCircleTarget(
{ name, vec3(v[i].x, v[i].y, v[i].z+0.2), 2.0, { name = name, debugPoly = debugMode, useZ = true, }, }, options, 2.5)
if Config.Banks.showBlips then
makeBlip({coords = v[i], sprite = 814, col = 2, scale = 0.7, disp = 6, name = locale("blip", "blip_bank") })
end

View File

@@ -7,17 +7,25 @@ function spawnCustomRegisters()
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}}, {
{ onSelect = function() TriggerEvent(getScript()..":client:Charge", { job = job, gang = gang, img = ""}) end, icon = "fas fa-credit-card", label = locale("target", "charge"), }
{
action = function()
TriggerEvent(getScript()..":client:Charge", { job = job, gang = gang, img = ""})
end,
icon = "fas fa-credit-card",
label = locale("target", "charge"),
job = job,
gang = gang
}
}, 2.0)
if v[i].prop then makeProp({prop = "prop_till_03", coords = v[i].coords}, 1, false) end
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)
local billPrev = "cash"
RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
local billPrev = "cash"
--if not outside and not onDuty and data.gang == nil then triggerNotify(nil, locale("error", "not_onduty") return end
local newinputs = {} -- Begin qb-input creation here.
local nearbyList = {}
@@ -25,8 +33,13 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
--Retrieve a list of nearby players from server
local onlineList = triggerCallback(getScript()..":MakePlayerList")
--Convert list of players nearby into one qb-input understands + add distance info
local playerCoords = GetEntityCoords(PlayerPedId())
if onlineList == nil or #onlineList == 0 then
goto failed
end
for _, v in ipairs(GetPlayersFromCoords(playerCoords, Config.General.PaymentRadius)) do
local ped = GetPlayerPed(v)
local dist = #(GetEntityCoords(ped) - playerCoords)
@@ -42,6 +55,8 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
end
end
end
::failed::
--If list is empty(no one nearby) show error and stop
if not nearbyList[1] then
triggerNotify(nil, locale("error" ,"no_one"), "error")
@@ -67,6 +82,14 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
}
end
local prop = nil
if Config.General.Usebzzz then
local Ped = PlayerPedId()
prop = makeProp({ prop = 'bzzz_prop_payment_terminal', coords = vec4(0,0,0,0)}, false, true)
AttachEntityToEntity(prop, Ped, GetPedBoneIndex(Ped, 57005), 0.17, 0.04, 0.01, 340.0, 200.0, 50.0, true, true, false, false, 1, true)
playAnim('cellphone@', 'cellphone_text_read_base', -1, 49)
end
--Grab Player Job name or Gang Name if needed
local getInfo = getPlayer()
--Check if image was given when opening the regsiter
@@ -99,6 +122,10 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
billPrev = dialog.billtype
TriggerServerEvent(getScript()..":server:Charge", dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
end
if Config.General.Usebzzz then
destroyProp(prop)
stopAnim('cellphone@', 'cellphone_text_read_base')
end
end)
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)

View File

@@ -1,3 +1,46 @@
if not Config.Banks.enable or not Config.Receipts.CashInAnywhere then
onPlayerLoaded(function()
local locations = BankLocations
if not Config.Receipts.CashInAnywhere then
locations = {
["receipts"] = Config.Receipts.CashInLocations
}
end
for k, v in pairs(locations) do
for i = 1, #v do
local name = getScript()..":BankLocation:"..k..i
if Config.General.Peds then
if not Config.Gabz then CreateModelHide(v[i].xyz, 1.0, `v_corp_bk_chair3`, true) end
if not Peds[name] then
Peds[name] = makePed(Config.General.PedPool[math.random(1, #Config.General.PedPool)], v[i], false, false)
if isStarted("jim-talktonpc") then
exports["jim-talktonpc"]:createDistanceMessage("hi", Peds[name], 3.0, false)
end
end
end
local jobroles = {}
local gangroles = {}
for k, v in pairs(Config.Receipts.Jobs) do
if v.gang then
gangroles[k] = 0
else
jobroles[k] = 0
end
end
createCircleTarget(
{ name, vec3(v[i].x, v[i].y, v[i].z+0.2), 2.0, { name = name, debugPoly = debugMode, useZ = true, }, }, {
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = false }) end,
icon = "fas fa-receipt", label = locale("target", "cashin_boss"), job = jobroles,
},
{ action = function() TriggerEvent(getScript()..":Tickets:Menu", { gang = true }) end,
icon = "fas fa-receipt", label = locale("target", "cashin_gang"), gang = gangroles,
},
}, 2.5)
end
end
end, true)
end
RegisterNetEvent(getScript()..":Tickets:Menu", function(data)
local PlayerInfo = getPlayer()
local hasItem, hasTable = hasItem("payticket", 1)

View File

@@ -28,7 +28,7 @@ Config = {
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
PaymentRadius = 15, -- This is how far the playerlist will check for nearby players (based on the person charging)
Usebzzz = false, -- enable if you're using the prop from bzzz
Usebzzz = true, -- enable if you're using the prop from bzzz
Enablecommand = true, -- Enables the /cashregister command

View File

@@ -1,6 +1,6 @@
name "Jim-Payments"
author "Jimathy"
version "3.0.02"
version "3.0.04"
description "Payment Script"
fx_version "cerulean"
game "gta5"
@@ -12,7 +12,7 @@ shared_scripts {
'locales/*.lua',
'config.lua',
--Jim Bridge - https://github.com/jimathy/jim-bridge
--Jim Bridge - https://github.com/jimathy/jim_bridge
'@jim_bridge/starter.lua',
'shared/*.lua',

BIN
images/terminal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -10,12 +10,20 @@ onResourceStart(function()
debugPrint("^1Error^7: ^2Unable to find ^7'^3payticket^7' ^2item it in the Shared^7")
end
registerCommand("cashregister", {
locale("command", "cash_reg"), {}, false,
function(source)
for _, v in pairs({"cashregister", "terminal"}) do
registerCommand(v, {
locale("command", "cash_reg"), {}, false,
function(source)
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
end
})
end
if Items["terminal"] then
createUseableItem("terminal", function(source, item)
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
end
})
end)
end
createCallback(getScript()..":MakePlayerList", function(source)
local onlineList = {}
@@ -29,12 +37,6 @@ onResourceStart(function()
return onlineList
end)
if Config.General.Usebzzz then
createUseableItem('terminal', function(source, item)
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
end)
end
end, true)
RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, billtype, img, outside, gang)

View File

@@ -27,7 +27,9 @@ BankLocations = {
}
if Config.General.Gabz then
Config.Receipts.CashInLocation = vec4(269.28, 217.24, 106.28, 69.0)
Config.Receipts.CashInLocations = {
vec4(269.28, 217.24, 106.28, 69.0)
}
BankLocations = {
["legion"] = {
vec4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca

View File

@@ -1 +1,9 @@
3.0.02
3.0.04
- Fix custom cash register spawn offset locations
- Fix job/gang lock on custom registers
- Add workaround for if `onlineList` is `nil`
- Fix type for Gabz default ticket cash in location
- Separate and fix ped creation for banks and tickets
https://github.com/jimathy/jim-payments