Skip to content

Commit 6ab839e

Browse files
committed
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
1 parent 9eb2e98 commit 6ab839e

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

client/charge.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ end
1616

1717
onPlayerLoaded(function() spawnCustomRegisters() end, true)
1818

19-
local billPrev = "cash"
2019
RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
20+
local billPrev = "cash"
2121
--if not outside and not onDuty and data.gang == nil then triggerNotify(nil, locale("error", "not_onduty") return end
2222
local newinputs = {} -- Begin qb-input creation here.
2323
local nearbyList = {}
@@ -42,6 +42,7 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
4242
end
4343
end
4444
end
45+
4546
--If list is empty(no one nearby) show error and stop
4647
if not nearbyList[1] then
4748
triggerNotify(nil, locale("error" ,"no_one"), "error")
@@ -67,6 +68,14 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
6768
}
6869
end
6970

71+
local prop = nil
72+
if Config.General.Usebzzz then
73+
local Ped = PlayerPedId()
74+
prop = makeProp({ prop = 'bzzz_prop_payment_terminal', coords = vec4(0,0,0,0)}, false, true)
75+
AttachEntityToEntity(prop, Ped, GetPedBoneIndex(Ped, 57005), 0.17, 0.04, 0.01, 340.0, 200.0, 50.0, true, true, false, false, 1, true)
76+
playAnim('cellphone@', 'cellphone_text_read_base', -1, 49)
77+
end
78+
7079
--Grab Player Job name or Gang Name if needed
7180
local getInfo = getPlayer()
7281
--Check if image was given when opening the regsiter
@@ -99,6 +108,8 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
99108
billPrev = dialog.billtype
100109
TriggerServerEvent(getScript()..":server:Charge", dialog.citizen, dialog.price, dialog.billtype, data.img, outside, gang)
101110
end
111+
destroyProp(prop)
112+
stopAnim('cellphone@', 'cellphone_text_read_base')
102113
end)
103114

104115
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)

config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Config = {
2828
List = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
2929
PaymentRadius = 15, -- This is how far the playerlist will check for nearby players (based on the person charging)
3030

31-
Usebzzz = false, -- enable if you're using the prop from bzzz
31+
Usebzzz = true, -- enable if you're using the prop from bzzz
3232

3333
Enablecommand = true, -- Enables the /cashregister command
3434

server/chargerserver.lua

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ onResourceStart(function()
1010
debugPrint("^1Error^7: ^2Unable to find ^7'^3payticket^7' ^2item it in the Shared^7")
1111
end
1212

13-
registerCommand("cashregister", {
14-
locale("command", "cash_reg"), {}, false,
15-
function(source)
16-
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
17-
end
18-
})
13+
for _, v in pairs({"cashregister", "terminal"}) do
14+
registerCommand(v, {
15+
locale("command", "cash_reg"), {}, false,
16+
function(source)
17+
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
18+
end
19+
})
20+
end
1921

2022
createCallback(getScript()..":MakePlayerList", function(source)
2123
local onlineList = {}
@@ -29,12 +31,6 @@ onResourceStart(function()
2931
return onlineList
3032
end)
3133

32-
33-
if Config.General.Usebzzz then
34-
createUseableItem('terminal', function(source, item)
35-
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
36-
end)
37-
end
3834
end, true)
3935

4036
RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, billtype, img, outside, gang)

0 commit comments

Comments
 (0)