mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 14:56:02 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be43ade5fb | ||
|
|
5a3556ad2c | ||
|
|
597e8d9336 | ||
|
|
874eee530c |
@@ -44,7 +44,7 @@ if Config.Banks.enable then
|
|||||||
icon = "fas fa-receipt", label = locale("target", "cashin_gang"), gang = gangroles,
|
icon = "fas fa-receipt", label = locale("target", "cashin_gang"), gang = gangroles,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
jsonPrint(options)
|
|
||||||
createCircleTarget(
|
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)
|
{ 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
|
if Config.Banks.showBlips then
|
||||||
|
|||||||
@@ -71,6 +71,125 @@ RegisterNetEvent(getScript()..":client:Charge", function(data, outside)
|
|||||||
default = 1,
|
default = 1,
|
||||||
options = nearbyList
|
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
|
else -- If Config.List is false, create input text box for ID's
|
||||||
newinputs[#newinputs+1] = {
|
newinputs[#newinputs+1] = {
|
||||||
type = 'text',
|
type = 'text',
|
||||||
|
|||||||
@@ -47,6 +47,116 @@ RegisterNetEvent(getScript()..":client:PolCharge", function()
|
|||||||
default = 1,
|
default = 1,
|
||||||
options = nearbyList
|
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
|
||||||
|
|
||||||
else
|
else
|
||||||
newinputs[#newinputs+1] = {
|
newinputs[#newinputs+1] = {
|
||||||
type = 'text',
|
type = 'text',
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ Config = {
|
|||||||
General = {
|
General = {
|
||||||
ApGov = false, -- Toggle support for AP-Goverment Tax
|
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
|
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)
|
PaymentRadius = 15, -- This is how far the playerlist will check for nearby players (based on the person charging)
|
||||||
|
|
||||||
Usebzzz = true, -- enable if you're using the prop from bzzz
|
Usebzzz = true, -- enable if you're using the prop from bzzz
|
||||||
@@ -149,7 +151,8 @@ Config = {
|
|||||||
['ambulance'] = { Commission = 0.25, },
|
['ambulance'] = { Commission = 0.25, },
|
||||||
},
|
},
|
||||||
FineJobConfirmation = false, --"true" makes it so fines need confirmation, "false" skips this ands just removes the money
|
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,6 +1,6 @@
|
|||||||
name "Jim-Payments"
|
name "Jim-Payments"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "3.0.04"
|
version "3.0.05"
|
||||||
description "Payment Script"
|
description "Payment Script"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ onResourceStart(function()
|
|||||||
for _, v in pairs(GetPlayers()) do
|
for _, v in pairs(GetPlayers()) do
|
||||||
if v ~= nil or type(v) ~= "number" then
|
if v ~= nil or type(v) ~= "number" then
|
||||||
local Player = getPlayer(v)
|
local Player = getPlayer(v)
|
||||||
|
if Player.name then
|
||||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
|
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.name }
|
||||||
|
end
|
||||||
Wait(10)
|
Wait(10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -55,29 +57,21 @@ RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, bill
|
|||||||
if Config.General.PhoneBank == false or gang == true or billtype == "cash" then
|
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)
|
TriggerClientEvent(getScript()..":client:PayPopup", billed.source, amount, src, billtype, img, label, gang, outside)
|
||||||
else
|
else
|
||||||
if Config.General.PhoneType == "qb" then
|
if sendPhoneInvoice({
|
||||||
MySQL.Async.insert(
|
src = billed.source,
|
||||||
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
amount = amount,
|
||||||
{billed.citizenid, amount, biller.job, biller.firstname, biller.citizenid}, function(id)
|
billedCitizenid = billed.citizenId,
|
||||||
if id then
|
job = biller.job,
|
||||||
TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.source, id, biller.firstname, biller.job, biller.citizenid, amount, GetInvokingResource())
|
name = biller.firstname,
|
||||||
end
|
billerCitizenid = biller.citizenId,
|
||||||
end)
|
label = label,
|
||||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.source)
|
|
||||||
elseif Config.General.PhoneType == "gks" then
|
}) 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' })
|
|
||||||
end
|
|
||||||
triggerNotify(nil, locale("success", "inv_succ"), 'success', src)
|
triggerNotify(nil, locale("success", "inv_succ"), 'success', src)
|
||||||
triggerNotify(nil, locale("success", "inv_recieved"), nil, billed.source)
|
triggerNotify(nil, locale("success", "inv_recieved"), nil, billed.source)
|
||||||
|
else
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else triggerNotify(nil, locale("error", "charge_zero"), 'error', source) return end
|
else triggerNotify(nil, locale("error", "charge_zero"), 'error', source) return end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
3.0.04
|
3.0.05
|
||||||
|
|
||||||
- Fix custom cash register spawn offset locations
|
- Add extra check for if playerData exists when getting player list
|
||||||
- Fix job/gang lock on custom registers
|
- Add new lookAtCharge option to allow players to target who to charge
|
||||||
- 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
|
https://github.com/jimathy/jim-payments
|
||||||
Reference in New Issue
Block a user