mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 14:26:02 +01:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be43ade5fb | ||
|
|
5a3556ad2c | ||
|
|
597e8d9336 | ||
|
|
874eee530c | ||
|
|
ee11d79fa6 | ||
|
|
784d13914f | ||
|
|
10f14f846e | ||
|
|
1ca2e45a37 | ||
|
|
2e3fef8846 | ||
|
|
1b69b44f5c | ||
|
|
d252ce6a02 | ||
|
|
4bc2aaa95f | ||
|
|
fdf92fde64 | ||
|
|
954b208016 | ||
|
|
51265681c1 | ||
|
|
6ab839e2a3 | ||
|
|
9eb2e987d4 | ||
|
|
e73520a10c | ||
|
|
f869c682c1 | ||
|
|
ca625c50e2 | ||
|
|
49f4d404e3 | ||
|
|
2b92f749b5 | ||
|
|
5e80192cef | ||
|
|
2eff1996c2 | ||
|
|
29b3b2ffb9 | ||
|
|
5cc7b60a1f | ||
|
|
41e146e35a |
17
.github/workflows/notify-discord.yml
vendored
Normal file
17
.github/workflows/notify-discord.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Discord Commit Notifier
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*' # triggers on all branches
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Discord Commits
|
||||
uses: Sniddl/discord-commits@v1.6
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
template: "avatar-with-link"
|
||||
include-extras: true
|
||||
13
README.md
13
README.md
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
|
||||
@@ -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,22 +55,165 @@ 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") return end
|
||||
if not nearbyList[1] then
|
||||
triggerNotify(nil, locale("error" ,"no_one"), "error")
|
||||
return
|
||||
end
|
||||
|
||||
newinputs[#newinputs+1] = {
|
||||
type = "select",
|
||||
text = locale("menu", "cus_id"),
|
||||
name = "citizen",
|
||||
label = locale("menu", "cus_id"),
|
||||
default = 1,
|
||||
options = nearbyList
|
||||
}
|
||||
elseif Config.General.lookAtCharge then
|
||||
local selectedPed = nil
|
||||
local highlightedPed = nil
|
||||
local running = true
|
||||
|
||||
CreateThread(function()
|
||||
while running do
|
||||
Wait(0)
|
||||
|
||||
-- Raycast to get entity being looked at
|
||||
local camCoord = GetGameplayCamCoord()
|
||||
local direction = RotationToDirection(GetGameplayCamRot(2))
|
||||
local targetCoord = camCoord + direction * 6.0
|
||||
|
||||
local hit, _ , hitCoords, _, entityHit = PerformRaycast(camCoord, targetCoord, PlayerPedId(), 4)
|
||||
if hit then
|
||||
DrawSphere(hitCoords.x, hitCoords.y, hitCoords.z, 0.05, 255, 255, 255, 0.5)
|
||||
end
|
||||
if entityHit and IsEntityAPed(entityHit) and entityHit ~= PlayerPedId() then
|
||||
if highlightedPed ~= entityHit then
|
||||
if highlightedPed and DoesEntityExist(highlightedPed) then
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
end
|
||||
highlightedPed = entityHit
|
||||
SetEntityAlpha(highlightedPed, 200, false)
|
||||
end
|
||||
elseif highlightedPed then
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
highlightedPed = nil
|
||||
end
|
||||
|
||||
local loc = vec2(0.89+0.037, 0.9)
|
||||
DrawSprite("timerbars", "all_black_bg", loc.x, loc.y, 0.12, 0.05, 0.0, 255, 255, 255, 255)
|
||||
SetTextScale(0.80, 0.80)
|
||||
SetTextWrap(0.75, 0.985)
|
||||
SetTextJustification(2)
|
||||
SetTextFont(4)
|
||||
SetTextColour(255, 255, 255, 255)
|
||||
BeginTextCommandDisplayText("STRING")
|
||||
AddTextComponentSubstringKeyboardDisplay(highlightedPed and "~s~Selected ID: ~g~"..GetPlayerServerId(NetworkGetPlayerIndexFromPed(highlightedPed)) or "~s~No Selection")
|
||||
EndTextCommandDisplayText(loc.x+0.06, loc.y - 0.026)
|
||||
|
||||
-- Show instructional UI
|
||||
local buttons = {
|
||||
{ keys = { 194 }, text = "Cancel" }
|
||||
}
|
||||
if highlightedPed then
|
||||
table.insert(buttons, { keys = { 86, 191 }, text = "Confirm" })
|
||||
end
|
||||
makeInstructionalButtons(buttons)
|
||||
|
||||
-- Handle controls
|
||||
if IsControlJustPressed(0, 194) then -- Backspace
|
||||
if highlightedPed then
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
end
|
||||
running = false
|
||||
return
|
||||
end
|
||||
|
||||
if highlightedPed and (IsControlJustPressed(0, 191) or IsControlJustPressed(0, 86)) then
|
||||
local serverId = GetPlayerServerId(NetworkGetPlayerIndexFromPed(highlightedPed))
|
||||
if serverId then
|
||||
running = false
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
|
||||
|
||||
--Grab Player Job name or Gang Name if needed
|
||||
local getInfo = getPlayer()
|
||||
--Check if image was given when opening the regsiter
|
||||
local img = data.img ~= nil and (Config.System.Menu == "qb" and "<center><img src="..(data.img).." width=200px></center>") or Jobs[getInfo.job].label
|
||||
|
||||
local newinputs = {
|
||||
{
|
||||
type = 'select',
|
||||
name = 'billtype',
|
||||
text = locale("menu", "type"),
|
||||
default = billPrev,
|
||||
options = {
|
||||
{ value = "cash", text = locale("menu", "cash"), label = locale("menu", "cash") },
|
||||
{ value = "bank", text = locale("menu", "card"), label = locale("menu", "card") }
|
||||
}
|
||||
},
|
||||
{
|
||||
type = 'number',
|
||||
isRequired = true,
|
||||
name = 'price',
|
||||
text = locale("menu", "amount_charge")
|
||||
}
|
||||
}
|
||||
|
||||
local dialog = createInput(img, newinputs)
|
||||
|
||||
if dialog then
|
||||
-- If ox_menu style input, fix indexes
|
||||
if dialog[1] then
|
||||
dialog.billtype = dialog[1]
|
||||
dialog.price = dialog[2]
|
||||
end
|
||||
|
||||
billPrev = dialog.billtype
|
||||
|
||||
TriggerServerEvent(getScript()..":server:Charge", serverId, dialog.price, dialog.billtype, data.img, outside, gang)
|
||||
|
||||
if Config.General.Usebzzz then
|
||||
destroyProp(prop)
|
||||
stopAnim('cellphone@', 'cellphone_text_read_base')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
return -- Skip continuing function until selection is made
|
||||
|
||||
else -- If Config.List is false, create input text box for ID's
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, required = true, name = 'citizen', label = locale("menu" ,"person_id"), text = locale("menu" ,"person_id") }
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'text',
|
||||
isRequired = true,
|
||||
required = true,
|
||||
name = 'citizen',
|
||||
label = locale("menu", "cus_id"),
|
||||
text = locale("menu", "cus_id")
|
||||
}
|
||||
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
|
||||
local img = data.img ~= nil and (Config.System.Menu == "qb" and "<center><img src="..(data.img).." width=200px></center>") or Jobs[getInfo.job].label
|
||||
|
||||
if Config.General.List then
|
||||
newinputs[#newinputs+1] = { type = "select", text = locale("menu" ,"cus_id"), name = "citizen", label = locale("menu" ,"cus_id"), default = 1, options = nearbyList }
|
||||
else
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = locale("menu" ,"cus_id") }
|
||||
end
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'select',
|
||||
name = 'billtype',
|
||||
@@ -73,7 +229,11 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
||||
local dialog = createInput(img, newinputs)
|
||||
|
||||
if dialog then
|
||||
if dialog[1] then
|
||||
if dialog[1] then -- if ox menu, auto adjust values
|
||||
if dialog[1] == "" then
|
||||
TriggerEvent(getScript()..":client:Charge", data, outside)
|
||||
return
|
||||
end
|
||||
dialog.citizen = dialog[1]
|
||||
dialog.billtype = dialog[2]
|
||||
dialog.price = dialog[3]
|
||||
@@ -81,11 +241,15 @@ 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)
|
||||
local setimage = ""
|
||||
print(billerjob)
|
||||
|
||||
if not img then
|
||||
setimage = billerjob
|
||||
else
|
||||
@@ -134,7 +298,7 @@ RegisterNetEvent(getScript()..":client:PayPopup", function(amount, biller, billt
|
||||
})
|
||||
end,
|
||||
}
|
||||
debugPrint(setimage)
|
||||
|
||||
openMenu(Menu, {
|
||||
header = setimage,
|
||||
onExit = function()
|
||||
|
||||
@@ -2,38 +2,179 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
||||
local Playerinfo = getPlayer()
|
||||
--Check if player is allowed to use /cashregister command
|
||||
local allowed = false
|
||||
for k in pairs(Config.PolCharge.FineJobs) do if k == Playerinfo.job then allowed = true end end
|
||||
if not allowed then triggerNotify(nil, locale("error", "no_job"), "error") return end
|
||||
for k in pairs(Config.PolCharge.FineJobs) do
|
||||
if k == Playerinfo.job then
|
||||
allowed = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not allowed then
|
||||
triggerNotify(nil, locale("error", "no_job"), "error")
|
||||
return
|
||||
end
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
local nearbyList = {}
|
||||
if Config.PolCharge.FineJobList then -- If nearby player list is wanted:
|
||||
--Retrieve a list of nearby players from server
|
||||
-- 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
|
||||
-- Convert list of players nearby into one an input script understands + add distance info
|
||||
for _, v in pairs(Core.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.General.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() or debugMode then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, label = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)', text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
nearbyList[#nearbyList+1] = {
|
||||
value = onlineList[i].value,
|
||||
label = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)',
|
||||
text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)'
|
||||
}
|
||||
end
|
||||
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") return end
|
||||
end
|
||||
if not nearbyList[1] then
|
||||
triggerNotify(nil, locale("error" ,"no_one"), "error")
|
||||
return
|
||||
end
|
||||
|
||||
newinputs[#newinputs+1] = {
|
||||
type = "select",
|
||||
text = locale("menu" ,"cus_id"),
|
||||
name = "citizen",
|
||||
label = locale("menu" ,"cus_id"),
|
||||
default = 1,
|
||||
options = nearbyList
|
||||
}
|
||||
|
||||
elseif Config.General.lookAtCharge then
|
||||
local selectedPed = nil
|
||||
local highlightedPed = nil
|
||||
local running = true
|
||||
|
||||
CreateThread(function()
|
||||
while running do
|
||||
Wait(0)
|
||||
|
||||
-- Raycast to get entity being looked at
|
||||
local camCoord = GetGameplayCamCoord()
|
||||
local direction = RotationToDirection(GetGameplayCamRot(2))
|
||||
local targetCoord = camCoord + direction * 6.0
|
||||
|
||||
local hit, _ , hitCoords, _, entityHit = PerformRaycast(camCoord, targetCoord, PlayerPedId(), 4)
|
||||
if hit then
|
||||
DrawSphere(hitCoords.x, hitCoords.y, hitCoords.z, 0.05, 0, 0, 255, 0.5)
|
||||
end
|
||||
if entityHit and IsEntityAPed(entityHit) and entityHit ~= PlayerPedId() then
|
||||
if highlightedPed ~= entityHit then
|
||||
if highlightedPed and DoesEntityExist(highlightedPed) then
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
end
|
||||
highlightedPed = entityHit
|
||||
SetEntityAlpha(highlightedPed, 200, false)
|
||||
end
|
||||
elseif highlightedPed then
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
highlightedPed = nil
|
||||
end
|
||||
|
||||
local loc = vec2(0.89+0.037, 0.9)
|
||||
DrawSprite("timerbars", "all_black_bg", loc.x, loc.y, 0.12, 0.05, 0.0, 255, 255, 255, 255)
|
||||
SetTextScale(0.80, 0.80)
|
||||
SetTextWrap(0.75, 0.985)
|
||||
SetTextJustification(2)
|
||||
SetTextFont(4)
|
||||
SetTextColour(255, 255, 255, 255)
|
||||
BeginTextCommandDisplayText("STRING")
|
||||
AddTextComponentSubstringKeyboardDisplay(highlightedPed and "~s~Selected ID: ~b~"..GetPlayerServerId(NetworkGetPlayerIndexFromPed(highlightedPed)) or "~s~No Selection")
|
||||
EndTextCommandDisplayText(loc.x+0.06, loc.y - 0.026)
|
||||
|
||||
-- Show instructional UI
|
||||
local buttons = {
|
||||
{ keys = { 194 }, text = "Cancel" }
|
||||
}
|
||||
if highlightedPed then
|
||||
table.insert(buttons, { keys = { 86, 191 }, text = "Confirm" })
|
||||
end
|
||||
makeInstructionalButtons(buttons)
|
||||
|
||||
-- Handle controls
|
||||
if IsControlJustPressed(0, 194) then -- Backspace
|
||||
if highlightedPed then
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
end
|
||||
running = false
|
||||
return
|
||||
end
|
||||
|
||||
if highlightedPed and (IsControlJustPressed(0, 191) or IsControlJustPressed(0, 86)) then
|
||||
local serverId = GetPlayerServerId(NetworkGetPlayerIndexFromPed(highlightedPed))
|
||||
if serverId then
|
||||
running = false
|
||||
SetEntityAlpha(highlightedPed, 255, false)
|
||||
ResetEntityAlpha(highlightedPed)
|
||||
|
||||
local newinputs = {
|
||||
{
|
||||
type = 'select',
|
||||
name = 'billtype',
|
||||
text = locale("menu", "type"),
|
||||
default = billPrev,
|
||||
options = {
|
||||
{ value = "cash", text = locale("menu", "cash"), label = locale("menu", "cash") },
|
||||
{ value = "bank", text = locale("menu", "card"), label = locale("menu", "card") }
|
||||
}
|
||||
},
|
||||
{
|
||||
type = 'number',
|
||||
isRequired = true,
|
||||
name = 'price',
|
||||
text = locale("menu", "amount_charge")
|
||||
}
|
||||
}
|
||||
|
||||
local dialog = createInput(Jobs[getPlayer().job].label, newinputs)
|
||||
|
||||
if dialog then
|
||||
-- If ox_menu style input, fix indexes
|
||||
if dialog[1] then
|
||||
dialog.billtype = dialog[1]
|
||||
dialog.price = dialog[2]
|
||||
end
|
||||
|
||||
billPrev = dialog.billtype
|
||||
|
||||
TriggerServerEvent(getScript()..":server:PolCharge", serverId, dialog.price)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
return -- Skip continuing function until selection is made
|
||||
|
||||
if Config.PolCharge.FineJobList then
|
||||
newinputs[#newinputs+1] = { type = "select", text = locale("menu" ,"cus_id"), name = "citizen", label = locale("menu" ,"cus_id"), default = 1, options = nearbyList }
|
||||
else
|
||||
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = locale("menu" ,"cus_id") }
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'text',
|
||||
isRequired = true,
|
||||
name = 'citizen',
|
||||
text = locale("menu" ,"cus_id")
|
||||
}
|
||||
end
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = locale("menu" ,"amount_charge") }
|
||||
newinputs[#newinputs+1] = {
|
||||
type = 'number',
|
||||
isRequired = true,
|
||||
name = 'price',
|
||||
text = locale("menu" ,"amount_charge")
|
||||
}
|
||||
|
||||
local dialog = createInput(Jobs[Playerinfo.job].label, newinputs)
|
||||
if dialog then
|
||||
jsonPrint(dialog)
|
||||
if dialog[1] then
|
||||
dialog.citizen = dialog[1]
|
||||
dialog.price = dialog[2]
|
||||
@@ -42,9 +183,13 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob)
|
||||
RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, billerjob, commPercent)
|
||||
local Menu = {}
|
||||
Menu[#Menu+1] = { isMenuHeader = true, header = "", txt = locale("menu" ,"bank_charge")..amount }
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = "",
|
||||
txt = locale("menu" ,"bank_charge")..amount
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check",
|
||||
header = locale("menu" ,"yes"),
|
||||
@@ -54,6 +199,7 @@ RegisterNetEvent(getScript()..":client:PolPopup", function(amount, biller, bille
|
||||
accept = true,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
commPercent = commPercent,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -25,10 +25,12 @@ Config = {
|
||||
General = {
|
||||
ApGov = false, -- Toggle support for AP-Goverment Tax
|
||||
|
||||
lookAtCharge = false, -- "true" to use the "look at charge" feature
|
||||
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
|
||||
|
||||
@@ -149,7 +151,8 @@ Config = {
|
||||
['ambulance'] = { Commission = 0.25, },
|
||||
},
|
||||
FineJobConfirmation = false, --"true" makes it so fines need confirmation, "false" skips this ands just removes the money
|
||||
FineJobList = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||
FineJobList = false, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||
lookAtCharge = true, -- "true" to use the "look at charge" feature
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name "Jim-Payments"
|
||||
author "Jimathy"
|
||||
version "3.0"
|
||||
description "Payment Script By Jimathy"
|
||||
version "3.0.05"
|
||||
description "Payment Script"
|
||||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
lua54 'yes'
|
||||
@@ -12,25 +12,12 @@ shared_scripts {
|
||||
'locales/*.lua',
|
||||
'config.lua',
|
||||
|
||||
-- Required core scripts
|
||||
'@ox_lib/init.lua',
|
||||
'@ox_core/lib/init.lua',
|
||||
|
||||
'@es_extended/imports.lua',
|
||||
|
||||
'@qbx_core/modules/playerdata.lua',
|
||||
|
||||
--Jim Bridge
|
||||
--Jim Bridge - https://github.com/jimathy/jim_bridge
|
||||
'@jim_bridge/starter.lua',
|
||||
|
||||
'shared/*.lua',
|
||||
}
|
||||
client_scripts {
|
||||
'@PolyZone/client.lua',
|
||||
'@PolyZone/BoxZone.lua',
|
||||
'@PolyZone/EntityZone.lua',
|
||||
'@PolyZone/CircleZone.lua',
|
||||
'@PolyZone/ComboZone.lua',
|
||||
|
||||
'client/*.lua',
|
||||
}
|
||||
|
||||
|
||||
BIN
images/terminal.png
Normal file
BIN
images/terminal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -1,10 +1,49 @@
|
||||
registerCommand("cashgive", {
|
||||
locale("command" , "pay_user"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:ATM:give", source)
|
||||
end
|
||||
})
|
||||
onResourceStart(function()
|
||||
registerCommand("cashgive", {
|
||||
locale("command" , "pay_user"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:ATM:give", source)
|
||||
end
|
||||
})
|
||||
|
||||
createCallback(getScript()..":GetInfo", function(source)
|
||||
local Player = getPlayer(source)
|
||||
local society, gsociety = 0, 0
|
||||
|
||||
society = getSocietyAccount(Player.job)
|
||||
if Player.gang ~= "none" then
|
||||
gsociety = getSocietyAccount(Player.gang)
|
||||
end
|
||||
|
||||
-- Savings account is only QBCore for now
|
||||
if isStarted(QBExport) and not isStarted(QBXExport) then
|
||||
-- Grab Savings account info
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
if result[1] then
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
else
|
||||
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, account_name, account_balance) VALUES (?, ?, ?)', { Player.citizenId, 'Savings_'..Player.citizenId, 0}, function() completed = true end) repeat Wait(0) until completed == true
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
end
|
||||
end
|
||||
local retTable = {
|
||||
name = Player.firstname..' '..Player.lastname,
|
||||
cash = Player.cash,
|
||||
bank = Player.bank,
|
||||
account = Player.account,
|
||||
cid = Player.citizenId.." ["..source.."]",
|
||||
savbal = savingBalance,
|
||||
aid = accountID,
|
||||
society = society,
|
||||
gsociety = gsociety
|
||||
}
|
||||
|
||||
return retTable
|
||||
end)
|
||||
end, true)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, baccount, account, society, gsociety)
|
||||
local src = source
|
||||
@@ -207,44 +246,6 @@ RegisterServerEvent(getScript()..":server:ATM:use", function(amount, billtype, b
|
||||
end
|
||||
end)
|
||||
|
||||
createCallback(getScript()..":GetInfo", function(source)
|
||||
local Player = getPlayer(source)
|
||||
local society, gsociety = 0, 0
|
||||
|
||||
society = getSocietyAccount(Player.job)
|
||||
if Player.gang ~= "none" then
|
||||
gsociety = getSocietyAccount(Player.gang)
|
||||
end
|
||||
|
||||
-- Savings account is only QBCore for now
|
||||
if isStarted(QBExport) and not isStarted(QBXExport) then
|
||||
-- Grab Savings account info
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
if result[1] then
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
else
|
||||
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, account_name, account_balance) VALUES (?, ?, ?)', { Player.citizenId, 'Savings_'..Player.citizenId, 0}, function() completed = true end) repeat Wait(0) until completed == true
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
accountID = result[1].citizenid
|
||||
savingBalance = result[1].account_balance
|
||||
end
|
||||
end
|
||||
local retTable = {
|
||||
name = Player.firstname..' '..Player.lastname,
|
||||
cash = Player.cash,
|
||||
bank = Player.bank,
|
||||
account = Player.account,
|
||||
cid = Player.citizenId.." ["..source.."]",
|
||||
savbal = savingBalance,
|
||||
aid = accountID,
|
||||
society = society,
|
||||
gsociety = gsociety
|
||||
}
|
||||
|
||||
return retTable
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:ATM:give", function(citizen, price)
|
||||
local Player = getPlayer(source)
|
||||
local Reciever = getPlayer(tonumber(citizen))
|
||||
|
||||
@@ -9,24 +9,38 @@ onResourceStart(function()
|
||||
if Items and not Items["payticket"] then
|
||||
debugPrint("^1Error^7: ^2Unable to find ^7'^3payticket^7' ^2item it in the Shared^7")
|
||||
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
|
||||
|
||||
if Items["terminal"] then
|
||||
createUseableItem("terminal", function(source, item)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end)
|
||||
end
|
||||
|
||||
createCallback(getScript()..":MakePlayerList", function(source)
|
||||
local onlineList = {}
|
||||
for _, v in pairs(GetPlayers()) do
|
||||
if v ~= nil or type(v) ~= "number" then
|
||||
local Player = getPlayer(v)
|
||||
if Player.name then
|
||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
|
||||
end
|
||||
Wait(10)
|
||||
end
|
||||
end
|
||||
return onlineList
|
||||
end)
|
||||
|
||||
end, true)
|
||||
|
||||
registerCommand("cashregister", {
|
||||
locale("command", "cash_reg"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end
|
||||
})
|
||||
|
||||
createCallback(getScript()..":MakePlayerList", function(source)
|
||||
local onlineList = {}
|
||||
for _, v in pairs(GetPlayers()) do
|
||||
local Player = getPlayer(v)
|
||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
|
||||
end
|
||||
return onlineList
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, billtype, img, outside, gang)
|
||||
local src = source
|
||||
local biller = getPlayer(src)
|
||||
@@ -43,29 +57,21 @@ RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, bill
|
||||
if Config.General.PhoneBank == false or gang == true or billtype == "cash" then
|
||||
TriggerClientEvent(getScript()..":client:PayPopup", billed.source, amount, src, billtype, img, label, gang, outside)
|
||||
else
|
||||
if Config.General.PhoneType == "qb" then
|
||||
MySQL.Async.insert(
|
||||
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
||||
{billed.citizenid, amount, biller.job, biller.firstname, biller.citizenid}, function(id)
|
||||
if id then
|
||||
TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.source, id, biller.firstname, biller.job, biller.citizenid, amount, GetInvokingResource())
|
||||
end
|
||||
end)
|
||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.source)
|
||||
elseif Config.General.PhoneType == "gks" then
|
||||
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', {
|
||||
['@citizenid'] = billed.citizenid,
|
||||
['@amount'] = amount,
|
||||
['@society'] = biller.job,
|
||||
['@sender'] = biller.firstname,
|
||||
['@sendercitizenid'] = biller.citizenid,
|
||||
['@label'] = label,
|
||||
})
|
||||
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = locale("success", "inv_succ"), img= '/html/static/img/icons/logo.png' })
|
||||
TriggerClientEvent('gksphone:notifi', billed.source, {title = 'Billing', message = locale("success", "inv_recieved"), img= '/html/static/img/icons/logo.png' })
|
||||
if sendPhoneInvoice({
|
||||
src = billed.source,
|
||||
amount = amount,
|
||||
billedCitizenid = billed.citizenId,
|
||||
job = biller.job,
|
||||
name = biller.firstname,
|
||||
billerCitizenid = biller.citizenId,
|
||||
label = label,
|
||||
|
||||
}) then
|
||||
triggerNotify(nil, locale("success", "inv_succ"), 'success', src)
|
||||
triggerNotify(nil, locale("success", "inv_recieved"), nil, billed.source)
|
||||
else
|
||||
|
||||
end
|
||||
triggerNotify(nil, locale("success", "inv_succ"), 'success', src)
|
||||
triggerNotify(nil, locale("success", "inv_recieved"), nil, billed.source)
|
||||
end
|
||||
else triggerNotify(nil, locale("error", "charge_zero"), 'error', source) return end
|
||||
end)
|
||||
@@ -90,12 +96,4 @@ RegisterServerEvent(getScript()..":server:PayPopup", function(data)
|
||||
triggerNotify(nil, locale("success", "declined"), "error", src)
|
||||
triggerNotify(nil, billed.firstname..locale("error", "decline_pay")..data.amount..locale("success", "payment"), "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
if Config.General.Usebzzz then
|
||||
createUseableItem('terminal', function(source, item)
|
||||
TriggerClientEvent(getScript()..":client:Charge", source, {}, true)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@@ -1,9 +1,11 @@
|
||||
registerCommand("polcharge", {
|
||||
locale("command", "charge"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:PolCharge", source)
|
||||
end
|
||||
})
|
||||
onResourceStart(function()
|
||||
registerCommand("polcharge", {
|
||||
locale("command", "charge"), {}, false,
|
||||
function(source)
|
||||
TriggerClientEvent(getScript()..":client:PolCharge", source)
|
||||
end
|
||||
})
|
||||
end, true)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
||||
local src = source
|
||||
@@ -12,12 +14,7 @@ RegisterServerEvent(getScript()..":server:PolCharge", function(citizen, price)
|
||||
local price = math.floor(tonumber(price))
|
||||
|
||||
local commPercent = Config.PolCharge.FineJobs[biller.job] and Config.PolCharge.FineJobs[biller.job].Commission or 0.25
|
||||
if Config.PolCharge.FineJobs[biller.job] then
|
||||
commPercent = Config.PolCharge.FineJobs[biller.job].Commission
|
||||
else
|
||||
commPercent = 0.25
|
||||
print("Can't find job in 'FineJobs', defaulting to 0.25 (25% commission)")
|
||||
end
|
||||
|
||||
local commission = math.floor(price * commPercent)
|
||||
|
||||
if price > 0 then
|
||||
|
||||
@@ -3,11 +3,9 @@ RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
|
||||
local activePlayers = GetPlayers()
|
||||
local commPercent = 0
|
||||
jsonPrint(data)
|
||||
if Config.Receipts.Jobs[data.society] then
|
||||
commPercent = Config.Receipts.Jobs[data.society].Commission
|
||||
else commPercent = 0.25
|
||||
print("^1Error^7: ^2Can't find job in ^7'^3Config^7.^3Receipts^7.^3Jobs^7', ^2defaulting to 0.25 (25% commission)^7")
|
||||
end
|
||||
|
||||
local commPercent = Config.PolCharge.FineJobs[data.society] and Config.PolCharge.FineJobs[data.society].Commission or 0.25
|
||||
|
||||
local takecomm = math.floor(data.amount * commPercent)
|
||||
|
||||
if biller ~= nil then -- If this is found, it ISN'T a phone payment, so add money to society here
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
3.0
|
||||
3.0.05
|
||||
|
||||
- Add extra check for if playerData exists when getting player list
|
||||
- Add new lookAtCharge option to allow players to target who to charge
|
||||
|
||||
https://github.com/jimathy/jim-payments
|
||||
Reference in New Issue
Block a user