mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-16 22:06:02 +01:00
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
This commit is contained in:
@@ -16,8 +16,8 @@ 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 = {}
|
||||
@@ -42,6 +42,7 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--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 +68,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 +108,8 @@ 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
|
||||
destroyProp(prop)
|
||||
stopAnim('cellphone@', 'cellphone_text_read_base')
|
||||
end)
|
||||
|
||||
RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -10,12 +10,14 @@ 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)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end
|
||||
})
|
||||
for _, v in pairs({"cashregister", "terminal"}) do
|
||||
registerCommand(v, {
|
||||
locale("command", "cash_reg"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
createCallback(getScript()..":MakePlayerList", function(source)
|
||||
local onlineList = {}
|
||||
@@ -29,12 +31,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)
|
||||
|
||||
Reference in New Issue
Block a user