mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-17 06:16:02 +01:00
Compare commits
162 Commits
v2.5.0
...
c6ef0897fc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6ef0897fc | ||
|
|
afe79273d5 | ||
|
|
bc694fa850 | ||
|
|
8cf3257da9 | ||
|
|
4e80be9b30 | ||
|
|
c657beb323 | ||
|
|
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 | ||
|
|
70fefa2a74 | ||
|
|
f2b82e0b8c | ||
|
|
cbc202f101 | ||
|
|
ecebdc801e | ||
|
|
10f477982d | ||
|
|
62e8242d9e | ||
|
|
ef6b664890 | ||
|
|
2ebfeff554 | ||
|
|
38f360fc26 | ||
|
|
a21ea9f1db | ||
|
|
0905c7489c | ||
|
|
84a7f0611e | ||
|
|
7b275735f6 | ||
|
|
00698be6c0 | ||
|
|
e27f5eef3a | ||
|
|
0a953bc5db | ||
|
|
01f9d1a255 | ||
|
|
0656afd7f1 | ||
|
|
813c25ad93 | ||
|
|
278c72193e | ||
|
|
ae738606d2 | ||
|
|
f973050dfd | ||
|
|
53a65bd4a3 | ||
|
|
d8ab207dc7 | ||
|
|
e1870b92b9 | ||
|
|
4a28bea810 | ||
|
|
72ecfea64b | ||
|
|
1b3878596e | ||
|
|
4ce9a753aa | ||
|
|
79c357aa65 | ||
|
|
0acfc606b7 | ||
|
|
ac309a6a07 | ||
|
|
d55d809b64 | ||
|
|
5425082cb2 | ||
|
|
eb8a17c5c3 | ||
|
|
1236f549d9 | ||
|
|
bf476c9ca3 | ||
|
|
a90129b4c6 | ||
|
|
065ad75dbd | ||
|
|
763dd613a4 | ||
|
|
16515eceea | ||
|
|
c967159d2b | ||
|
|
7188e36881 | ||
|
|
34a1d0d504 | ||
|
|
92b55d9d2d | ||
|
|
d9dbbfa485 | ||
|
|
4ec75a90fa | ||
|
|
baca1add62 | ||
|
|
890d8d67b0 | ||
|
|
5a849f1028 | ||
|
|
42e3c7d2be | ||
|
|
28d80261a2 | ||
|
|
a61716db2d | ||
|
|
1c8942a107 | ||
|
|
bfc3a372d3 | ||
|
|
2aefb7fa3b | ||
|
|
1f109ee4c9 | ||
|
|
4f120d7276 | ||
|
|
71a6d4d7dd | ||
|
|
fc902b34e2 | ||
|
|
89fa06507b | ||
|
|
61e2e6f32e | ||
|
|
ec40bd5cf1 | ||
|
|
70f2ed8005 | ||
|
|
f0f5f19af8 | ||
|
|
939026fd68 | ||
|
|
de4e6ad312 | ||
|
|
492bd53593 | ||
|
|
10fde7e6da | ||
|
|
8888fcdd9e | ||
|
|
2a86032299 | ||
|
|
92ba44355a | ||
|
|
1012e12d1e | ||
|
|
97b54cd482 | ||
|
|
fadb40e66d | ||
|
|
2bebb0c11f | ||
|
|
cb358f55b0 | ||
|
|
eed7fae066 | ||
|
|
5a6faf8337 | ||
|
|
ecec448d30 | ||
|
|
e28975d40b | ||
|
|
235e3d187c | ||
|
|
47dfcca052 | ||
|
|
a07382cca3 | ||
|
|
7b0757214b | ||
|
|
42f80fae77 | ||
|
|
c9ac3e8bbd | ||
|
|
8fcde5867c | ||
|
|
6b4c6a6779 | ||
|
|
55a25b59ac | ||
|
|
c136af4244 | ||
|
|
858c865b8b | ||
|
|
2c25faf2af | ||
|
|
ee2bfaaeca | ||
|
|
ab1096f977 | ||
|
|
3e9aa9676d | ||
|
|
3117ef68af | ||
|
|
2c1f1e8573 | ||
|
|
d71f3d29ed | ||
|
|
df640a1a08 | ||
|
|
8c1a6a11cc | ||
|
|
e2712da4b0 | ||
|
|
95eda3b471 | ||
|
|
120dae8066 | ||
|
|
0990422823 | ||
|
|
475ae9f827 | ||
|
|
9c1953ab92 | ||
|
|
d77d23e635 | ||
|
|
2a67217155 | ||
|
|
df43549e08 | ||
|
|
91a0cadad7 | ||
|
|
8cf1de1cf9 | ||
|
|
b543803194 | ||
|
|
da1a19eb2c | ||
|
|
41bedcc6ca | ||
|
|
a4413ea5c6 | ||
|
|
8adf3c3829 | ||
|
|
f5753df4b2 | ||
|
|
ec9dc51ccf | ||
|
|
4b028d75b1 | ||
|
|
2302ff987b | ||
|
|
d29d2d6904 | ||
|
|
f535df6b9c | ||
|
|
170f680ef8 | ||
|
|
2fc3b56e22 | ||
|
|
a18db3d6b9 | ||
|
|
da5e4c604f | ||
|
|
284700bafb | ||
|
|
ee532d5e3e |
12
.gitattributes
vendored
Normal file
12
.gitattributes
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# VCS / CI noise
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.github/** export-ignore
|
||||
.gitmodules export-ignore
|
||||
|
||||
# Dev tooling/config
|
||||
.vscode/** export-ignore
|
||||
*.code-workspace export-ignore
|
||||
.editorconfig export-ignore
|
||||
.eslintrc* export-ignore
|
||||
.prettier* export-ignore
|
||||
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: jixelpatterns
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: ['https://jimathy666.tebex.io/']
|
||||
18
.github/workflows/notify-discord.yml
vendored
Normal file
18
.github/workflows/notify-discord.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
name: Discord Commit Notifier
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send commit payload to Discord Bot
|
||||
env:
|
||||
URL: http://${{ secrets.DISCORDBOT }}:3000/github-commits
|
||||
run: |
|
||||
curl -sS -X POST "$URL" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary "@$GITHUB_EVENT_PATH"
|
||||
71
.github/workflows/notify-release.yml
vendored
Normal file
71
.github/workflows/notify-release.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Discord Release Notifier
|
||||
|
||||
on:
|
||||
# Manual or UI-published releases
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
# Releases created by your tag-driven workflow
|
||||
workflow_run:
|
||||
workflows: ["Package & Release"] # must match the 'name:' in release.yml
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# 1) Handle manual / UI / non-workflow-created releases
|
||||
notify-from-release:
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send release payload to Discord Bot
|
||||
env:
|
||||
URL: http://${{ secrets.DISCORDBOT }}:3000/github-releases
|
||||
run: |
|
||||
curl -sS -X POST "$URL" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary "@$GITHUB_EVENT_PATH"
|
||||
|
||||
# 2) Handle releases created by your 'Package & Release' workflow
|
||||
# (which won’t trigger `on: release` when using GITHUB_TOKEN)
|
||||
notify-from-workflow-run:
|
||||
if: >
|
||||
github.event_name == 'workflow_run' &&
|
||||
github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install jq
|
||||
run: sudo apt-get update && sudo apt-get install -y jq
|
||||
|
||||
- name: Fetch release JSON by tag
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
OWNER="${GITHUB_REPOSITORY%/*}"
|
||||
REPO="${GITHUB_REPOSITORY#*/}"
|
||||
TAG="${{ github.event.workflow_run.head_branch }}"
|
||||
# head_branch is the tag name for a tag push workflow_run
|
||||
curl -fsSL -H "Authorization: Bearer $GH_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/$OWNER/$REPO/releases/tags/$TAG" \
|
||||
> release.json
|
||||
|
||||
- name: Wrap as 'release' event payload & notify bot
|
||||
env:
|
||||
URL: http://${{ secrets.DISCORDBOT }}:3000/github-releases
|
||||
run: |
|
||||
set -euo pipefail
|
||||
jq -n --slurpfile rel release.json \
|
||||
--arg repo "$GITHUB_REPOSITORY" \
|
||||
--arg repo_url "https://github.com/$GITHUB_REPOSITORY" \
|
||||
--arg action "published" '
|
||||
{ action: $action,
|
||||
repository: { full_name: $repo, html_url: $repo_url },
|
||||
release: $rel[0],
|
||||
sender: { login: "github-actions[bot]" } }' > payload.json
|
||||
|
||||
curl -sS -X POST "$URL" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary "@payload.json"
|
||||
88
.github/workflows/release.yml
vendored
Normal file
88
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
name: Package & Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
- "*.*.*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout (full history)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Derive vars
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
echo "name=${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT # e.g. jim_bridge
|
||||
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT # strip leading v
|
||||
|
||||
- name: Build zip with folder prefix
|
||||
shell: bash
|
||||
run: |
|
||||
NAME='${{ steps.vars.outputs.name }}'
|
||||
VER='${{ steps.vars.outputs.version }}'
|
||||
git archive --format=zip --prefix="${NAME}/" -o "${NAME}-${VER}.zip" "$GITHUB_REF_NAME"
|
||||
ls -lh "${NAME}-${VER}.zip"
|
||||
|
||||
# --- Patch notes generation (commit titles + links) -------------------
|
||||
- name: Find previous tag (SemVer aware)
|
||||
id: prev
|
||||
shell: bash
|
||||
run: |
|
||||
CUR="${GITHUB_REF_NAME}"
|
||||
# Sort tags by version desc, drop the current, take the next newest
|
||||
PREV=$(git tag --sort=-v:refname | grep -v -x "$CUR" | head -n 1 || true)
|
||||
echo "prev=$PREV" >> $GITHUB_OUTPUT
|
||||
echo "Previous tag: ${PREV:-<none>}"
|
||||
|
||||
- name: Generate RELEASE_NOTES.md from commits
|
||||
shell: bash
|
||||
run: |
|
||||
REPO="${{ github.repository }}"
|
||||
CUR="${GITHUB_REF_NAME}"
|
||||
PREV='${{ steps.prev.outputs.prev }}'
|
||||
|
||||
if [ -n "$PREV" ]; then
|
||||
RANGE="$PREV..$CUR"
|
||||
HEADER="## Changes in $CUR"
|
||||
else
|
||||
# First release: include all commits
|
||||
ROOT=$(git rev-list --max-parents=0 HEAD | tail -n 1)
|
||||
RANGE="$ROOT..$CUR"
|
||||
HEADER="## Changes"
|
||||
fi
|
||||
|
||||
{
|
||||
echo "$HEADER"
|
||||
echo
|
||||
# Oldest → newest, subject only, skip merge commits
|
||||
# Escape '[' and ']' so markdown doesn't break on rare titles
|
||||
git log --reverse --no-merges --pretty=format:'- ['%h'] - %s' "$RANGE" \
|
||||
| perl -pe 's/([\[\]])/\\$1/g'
|
||||
} > RELEASE_NOTES.md
|
||||
|
||||
echo "--- RELEASE_NOTES.md ---"
|
||||
cat RELEASE_NOTES.md
|
||||
echo "------------------------"
|
||||
|
||||
- name: Create / Update GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: ${{ github.ref_name }}
|
||||
files: |
|
||||
*.zip
|
||||
body_path: RELEASE_NOTES.md # attach our generated notes
|
||||
# If you wanted GitHub's auto notes instead, set:
|
||||
# generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
118
README.md
118
README.md
@@ -1,90 +1,28 @@
|
||||
# jim-payments
|
||||
QBCore based payment system
|
||||
|
||||
If you think I did a good job here, consider donating as it keeps by lights on and my cat fat:
|
||||
https://ko-fi.com/jixelpatterns
|
||||
--------------
|
||||
|
||||
If you use a different phone/invoice system let me know and I will add support for it as best I can!
|
||||
|
||||
Enchanced QB-Input payment system from my other scripts now free on its own
|
||||
|
||||
 
|
||||
 
|
||||
# Installation
|
||||
|
||||
To make use of this payment system you need trigger the event
|
||||
|
||||
```jim-payments:client:Charge```
|
||||
|
||||
for example with qb-target
|
||||
```lua
|
||||
exports['qb-target']:AddBoxZone("Receipt", vector3(1589.14, 6458.26, 26.01), 0.6, 0.6, { name="Receipt", heading = 335.0, debugPoly=debugPoly, minZ = 26.01, maxZ = 26.81, },
|
||||
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = "Charge Customer", job = "popsdiner" } }, distance = 2.0 })
|
||||
```
|
||||
It currently requires you to be on duty to charge someone
|
||||
|
||||
This does not need to be added to **MY** job scripts, they already have built in support
|
||||
|
||||
--------------
|
||||
|
||||
To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua:
|
||||
```lua
|
||||
["payticket"] = {["name"] = "payticket", ["label"] = "Receipt", ["weight"] = 150, ["type"] = "item", ["image"] = "ticket.png", ["unique"] = false, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "Cash these in at the bank!"},
|
||||
```
|
||||
|
||||
Add the ticket image to your inventory script
|
||||
|
||||
[qb] > qb-inventory > html > images
|
||||
|
||||
--------------
|
||||
To get tickets from phone invoices you NEED to add it to the event when a payment is accepted:
|
||||
|
||||
For QB-Phone:
|
||||
Go to [qb] > qb-phone > client > main.lua
|
||||
- Around line 645 there should be the PayInvoice NUICallBack
|
||||
- Directly *above* this line:
|
||||
```lua
|
||||
TriggerServerEvent('qb-phone:server:BillingEmail', data, true)
|
||||
```
|
||||
|
||||
- Add this line:
|
||||
```lua
|
||||
TriggerServerEvent('jim-payments:Tickets:Give', data)
|
||||
```
|
||||
|
||||
For GKSPhone:
|
||||
Go to gks-phone > server > serverapi.lua
|
||||
|
||||
- Search for the event: ```gksphone:faturapayBill```
|
||||
- Under this line:
|
||||
```lua
|
||||
Ply.Functions.RemoveMoney('bank', amount, "paid-invoice")
|
||||
```
|
||||
|
||||
- Add these lines:
|
||||
```lua
|
||||
local data = { society = id.society, amount = amount }
|
||||
TriggerServerEvent('jim-payments:Tickets:Give', data)
|
||||
```
|
||||
|
||||
--------------
|
||||
|
||||
The latest banking systems are very simple to use and add,
|
||||
simply look in the atms.lua and change the config options at the top
|
||||
|
||||
Choose wether to use atm's, choose wether to use banking locations
|
||||
Choose wether to add bank blips (if you want to disable qb-banking)
|
||||
Choose wether to add ATM blips (if you like $ signs)
|
||||
|
||||
|
||||
--------------
|
||||
|
||||
New Commission system added
|
||||
|
||||
This brings more config options to find tune the script
|
||||
|
||||
Choose wether people get commission from every sale
|
||||
Choose if EVERY worker gets Commission that is on duty
|
||||
Choose if Commission is limited by MinAmountForTicket
|
||||
Choose if the worker charging the customer gets double commission
|
||||
# jim-payments
|
||||
|
||||
## FiveM MuliFramework based payment system
|
||||
|
||||
- Highly customisable via config.lua
|
||||
- Locations are easily changeable/removable
|
||||
|
||||
- Features:
|
||||
- Payment Tickets for successful payments over a specific amount player can cash in for extra bonus
|
||||
- ATM's become usable, with options to show them on your map when nearby
|
||||
- Adds Ped bank targets where players can manage their bank account balances
|
||||
- Supports police charges
|
||||
- Supports
|
||||
- QB-Core
|
||||
- ESX
|
||||
- QBOX
|
||||
- OX_Core
|
||||
|
||||
---
|
||||
|
||||
# Installation and Usage:
|
||||
## [JixelPatterns GitBook Documentation](https://jixelpatterns.gitbook.io/docs)
|
||||
|
||||
### If you need support I have a discord server available, it helps me keep track of issues and give better support.
|
||||
## [JixelPatterns Discord](https://discord.gg/9pCDHmjYwd)
|
||||
|
||||
### If you think I did a good job here, consider donating as it keeps by lights on and my cat round:
|
||||
## [JixelPatterns Kofi](https://ko-fi.com/jixelpatterns)
|
||||
342
atms.lua
342
atms.lua
@@ -1,342 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-- This script is a simple replacement for QB-Banking and QB-ATMs
|
||||
-- It uses QB-Input and server callbacks to retreive info about accounts and cash
|
||||
-- This requires QB-Target and has the location of every ATM, ATM prop and bank window
|
||||
|
||||
local Targets = {}
|
||||
local Peds = {}
|
||||
|
||||
local BankLoc = Config.VanBankLocations
|
||||
local ATMLoc = Config.VanATMLocations
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
while true do
|
||||
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
|
||||
if (k==0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return formatted
|
||||
end
|
||||
|
||||
local bossroles = {}
|
||||
local gangroles = {}
|
||||
CreateThread(function()
|
||||
if Config.Gabz then BankLoc = Config.GabzBankLocations ATMLoc = Config.GabzATMLocations end
|
||||
if Config.useATM then
|
||||
if Config.ATMBlips then
|
||||
for k, v in pairs(Config.WallATMLocations) do
|
||||
blip = AddBlipForCoord(v)
|
||||
SetBlipSprite(blip, 108)
|
||||
SetBlipDisplay(blip, 4)
|
||||
SetBlipScale(blip, 0.55)
|
||||
SetBlipColour(blip, 3)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString("ATM")
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
for k, v in pairs(ATMLoc) do
|
||||
blip = AddBlipForCoord(v)
|
||||
SetBlipSprite(blip, 108)
|
||||
SetBlipDisplay(blip, 4)
|
||||
SetBlipScale(blip, 0.55)
|
||||
SetBlipColour(blip, 3)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString("ATM")
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
end
|
||||
end
|
||||
if Config.useBanks then
|
||||
if Config.BankBlips then
|
||||
for k,v in pairs(BankLoc) do
|
||||
for l, b in pairs(v) do
|
||||
blip = AddBlipForCoord(b)
|
||||
SetBlipSprite(blip, 108)
|
||||
SetBlipDisplay(blip, 4)
|
||||
SetBlipScale(blip, 0.55)
|
||||
SetBlipColour(blip, 2)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentString("Bank")
|
||||
EndTextCommandSetBlipName(blip)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if Config.useATM or Config.useBanks then
|
||||
for k, v in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs
|
||||
if QBCore.Shared.Jobs[tostring(k)] then
|
||||
for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades
|
||||
if QBCore.Shared.Jobs[tostring(k)].grades[l].isboss == true then -- Checks the grade if is boss
|
||||
if bossroles[tostring(k)] ~= nil then -- checks if the line exists
|
||||
if bossroles[tostring(k)] > tonumber(l) then bossroles[tostring(k)] = tonumber(l) end -- the
|
||||
else bossroles[tostring(k)] = tonumber(l)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for k, v in pairs(QBCore.Shared.Gangs) do
|
||||
if QBCore.Shared.Gangs[tostring(k)] then
|
||||
for l, b in pairs(QBCore.Shared.Gangs[tostring(k)].grades) do
|
||||
if tostring(k) ~= "none" then
|
||||
if QBCore.Shared.Gangs[tostring(k)].grades[l].isboss == true then
|
||||
if gangroles[tostring(k)] ~= nil then
|
||||
if gangroles[tostring(k)] > tonumber(l) then gangroles[tostring(k)] = tonumber(l) end
|
||||
else gangroles[tostring(k)] = tonumber(l)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if Config.useATM then
|
||||
exports['qb-target']:AddTargetModel(Config.ATMModels, { options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },}, distance = 1.5, })
|
||||
for k,v in pairs(Config.WallATMLocations) do
|
||||
Targets["jimwallatm"..k] =
|
||||
exports['qb-target']:AddCircleZone("jimwallatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimwallatm"..k, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
|
||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
}, distance = 1.5 })
|
||||
end
|
||||
for k,v in pairs(ATMLoc) do
|
||||
Targets["jimatm"..k] =
|
||||
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(tonumber(v.x), tonumber(v.y), tonumber(v.z)+0.2), 0.5, { name="jimatm"..k, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-alt", label = "Use ATM", id = "atm" },
|
||||
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
}, distance = 1.5 })
|
||||
end
|
||||
end
|
||||
if Config.useBanks then
|
||||
for k,v in pairs(BankLoc) do
|
||||
for l, b in pairs(v) do
|
||||
Targets["jimbank"..k..l] =
|
||||
exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)+0.2), 2.0, { name="jimbank"..k..l, debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Client:ATM:use", icon = "fas fa-piggy-bank", label = "Use Bank", id = "bank" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Transfer Money", id = "transfer" },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = "Access Savings", id = "savings" },
|
||||
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Access Society Account", id = "society", job = bossroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Society Money Transfer", id = "societytransfer", job = bossroles },
|
||||
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = "Gang Society Account", id = "gang", gang = gangroles },
|
||||
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = "Gang Money Transfer", id = "gangtransfer", gang = gangroles }, },
|
||||
distance = 2.5 })
|
||||
if Config.Peds then
|
||||
local i = math.random(1, #Config.PedPool)
|
||||
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
||||
if Peds["jimbank"..k..l] == nil then Peds["jimbank"..k..l] = CreatePed(0, Config.PedPool[i], vector3(tonumber(b.x), tonumber(b.y), tonumber(b.z)), b[4], false, false) end
|
||||
if Config.Debug then print("Ped Created - 'jimbank"..k..l.."'") end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local function PlayATMAnimation(animation)
|
||||
if animation == 'enter' then RequestAnimDict('amb@prop_human_atm@male@enter')
|
||||
while not HasAnimDictLoaded('amb@prop_human_atm@male@enter') do Wait(1) end
|
||||
if HasAnimDictLoaded('amb@prop_human_atm@male@enter') then TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@enter', "enter", 1.0,-1.0, 1500, 1, 1, true, true, true) end
|
||||
end
|
||||
if animation == 'exit' then RequestAnimDict('amb@prop_human_atm@male@exit')
|
||||
while not HasAnimDictLoaded('amb@prop_human_atm@male@exit') do Wait(1) end
|
||||
if HasAnimDictLoaded('amb@prop_human_atm@male@exit') then TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@exit', "exit", 1.0,-1.0, 3000, 1, 1, true, true, true) end
|
||||
end
|
||||
end
|
||||
|
||||
local function GrabAccount(type, job)
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('jim-payments:ManageWrapper', function(cb) p:resolve(cb) end, type, job)
|
||||
return Citizen.Await(p)
|
||||
end
|
||||
|
||||
RegisterNetEvent('jim-payments:Client:ATM:use', function(data)
|
||||
--this grabs all the info from names to savings account numbers in the databases
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('jim-payments:ATM:Find', function(cb) p:resolve(cb) end) local info = Citizen.Await(p)
|
||||
local society local gsociety local cancelled = false
|
||||
if Config.Manage then
|
||||
society = GrabAccount("GetAccount", PlayerJob.name)
|
||||
Wait(200)
|
||||
gsociety = GrabAccount("GetGangAccount", PlayerGang.name)
|
||||
else
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) p:resolve(cb) end, PlayerJob.name) society = Citizen.Await(p)
|
||||
local p2 = promise.new()
|
||||
QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) p2:resolve(cb) end, PlayerGang.name) gsociety = Citizen.Await(p2)
|
||||
end
|
||||
local atmbartime = 2500
|
||||
local setoptions = {}
|
||||
|
||||
if data.id == "atm" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, }
|
||||
setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>Welcome back, "..info.name.."<br><br>- Citizen ID -<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br>💵Cash - $"..cv(info.cash)..'<br><br>- Options -'
|
||||
setheader = "💵 ATM Banking 💵"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
for k, v in pairs(Config.ATMModels) do
|
||||
local playerPed = PlayerPedId()
|
||||
local playerCoords = GetEntityCoords(playerPed, true)
|
||||
local hash = GetHashKey(v)
|
||||
local atm = IsObjectNearPoint(hash, playerCoords.x, playerCoords.y, playerCoords.z, 1.6)
|
||||
if atm then
|
||||
local obj = GetClosestObjectOfType(playerCoords.x, playerCoords.y, playerCoords.z, 1.6, v, false, false, false)
|
||||
local atmCoords = GetEntityCoords(obj, false)
|
||||
TaskTurnPedToFaceEntity(playerPed, obj, 1000)
|
||||
Wait(1000)
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing ATM", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
end
|
||||
end
|
||||
|
||||
elseif data.id == "bank" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Account -<br>"..info.account.."<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br>💵Cash - $"..cv(info.cash).."<br><br>- Options -"
|
||||
setheader = "🏦 Banking 🏦"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Bank", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "transfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Account -<br>"..info.account.."<br>"..info.cid.."<br><br>- Balances -<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
|
||||
setheader = "🔀 Transfer Services 🔀"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "savings" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Account Info -<br>Savings ID: "..info.aid.."<br>"..info.cid.."<br><br>- Balances -<br>💰Savings - $"..cv(info.savbal).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
|
||||
setheader = "💰 Savings 💰"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Savings", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "society" then
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(society).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
|
||||
setheader = "🏢 Society Banking 🏢"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "societytransfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerJob.label.."<br><br>- Balances -<br>🏢"..PlayerJob.label.." - $"..cv(society).."<br><br>- Options -"
|
||||
setheader = "🔀 Transfer Services 🔀"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "gang" then
|
||||
setheader = "🏢 Society Banking 🏢"
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(gsociety).."<br>🏦Bank - $"..cv(info.bank).."<br><br>- Options -"
|
||||
setoptions = { { value = "withdraw", text = "Withdrawl" }, { value = "deposit", text = "Deposit" } }
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💵 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Society Account", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
|
||||
elseif data.id == "gangtransfer" then
|
||||
setoptions = { { value = "transfer", text = "Transfer" } }
|
||||
setview = "Welcome back, "..info.name.."<br><br>- Society Account -<br>"..PlayerGang.label.."<br><br>- Balances -<br>🏢"..PlayerGang.label.." - $"..cv(gsociety).."<br><br>- Options -"
|
||||
setheader = "🔀 Transfer Services 🔀"
|
||||
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
|
||||
{ type = 'text', isRequired = true, name = 'account', text = '🏦 Account no.' },
|
||||
{ type = 'number', isRequired = true, name = 'amount', text = '💸 Amount to transfer' }, }
|
||||
PlayATMAnimation('enter')
|
||||
QBCore.Functions.Progressbar("accessing_atm", "Accessing Transfers", atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function() -- Done
|
||||
|
||||
end, function()
|
||||
TriggerEvent("QBCore:Notify", "Cancelled!", "error")
|
||||
cancelled = true
|
||||
end, data.icon)
|
||||
end
|
||||
|
||||
Wait(atmbartime+500)
|
||||
if not cancelled then
|
||||
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = "Transfer", inputs = setinputs })
|
||||
if dialog then
|
||||
if not dialog.amount then return end
|
||||
PlayATMAnimation('exit') Citizen.Wait(1000)
|
||||
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, society, gsociety)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('jim-payments:client:ATM:give', function()
|
||||
local onlineList = {}
|
||||
local nearbyList = {}
|
||||
QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) onlineList = cb if onlineList[1] == nil then Wait(200) end
|
||||
for k, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
end
|
||||
end
|
||||
end
|
||||
dist = nil
|
||||
end
|
||||
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
local dialog = exports['qb-input']:ShowInput({ header = "Give someone cash", submitText = "Give",
|
||||
inputs = {
|
||||
{ text = " ", name = "citizen", type = "select", options = nearbyList },
|
||||
{ type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Pay' }, }
|
||||
})
|
||||
if dialog then
|
||||
if not dialog.citizen or not dialog.price then return end
|
||||
TriggerServerEvent('jim-payments:server:ATM:give', dialog.citizen, dialog.price)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||
for k, v in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
|
||||
for k, v in pairs(Peds) do DeletePed(Peds[k]) end
|
||||
end)
|
||||
260
atmserver.lua
260
atmserver.lua
@@ -1,260 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
while true do
|
||||
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
|
||||
if (k==0) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return formatted
|
||||
end
|
||||
|
||||
---- BANK STUFF
|
||||
QBCore.Functions.CreateCallback('jim-payments:ManageWrapper', function(source, cb, type, account)
|
||||
local result = nil
|
||||
if type == "GetAccount" then result = exports["qb-management"]:GetAccount(account) end
|
||||
if type == "GetGangAccount" then result = exports["qb-management"]:GetGangAccount(account) end
|
||||
cb(result)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('jim-payments:server:ATM:use', function(amount, billtype, baccount, account, society, gsociety)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local cashB = Player.Functions.GetMoney("cash")
|
||||
local bankB = Player.Functions.GetMoney("bank")
|
||||
local amount = tonumber(amount)
|
||||
|
||||
--Simple transfers from bank to wallet --
|
||||
if account == "bank" or account == "atm" then
|
||||
if billtype == "withdraw" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
elseif bankB >= tonumber(amount) then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the bank", "success") -- Don't really need this as phone gets notified when money is withdrawn
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('cash', amount)
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if cashB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough cash", "error")
|
||||
elseif cashB >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount) Wait(1500)
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the Bank", "success")
|
||||
end
|
||||
end
|
||||
-- Transfers from bank to savings account --
|
||||
elseif account == "savings" then
|
||||
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
|
||||
if getSavingsAccount[1] ~= nil then savbal = tonumber(getSavingsAccount[1].amount) aid = getSavingsAccount[1].record_id end
|
||||
|
||||
if billtype == "withdraw" then
|
||||
if savbal >= amount then
|
||||
savbal = savbal - amount
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Withdrawn from savings into bank account", "success")
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
elseif savbal < amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Savings Balance too low", "error")
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if amount < bankB then
|
||||
savbal = savbal + amount
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "$"..cv(amount).." Deposited from bank account into savings", "success")
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET amount = ? WHERE citizenid = ? AND record_id = ?', { savbal, Player.PlayerData.citizenid, getSavingsAccount[1].record_id }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
else TriggerClientEvent("QBCore:Notify", src, "Bank Balance too low", "error")
|
||||
end
|
||||
end
|
||||
--Simple transfers from society account to bank --
|
||||
elseif account == "society" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(society) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
elseif tonumber(society) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.job.label.." account", "success")
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.job.label.." account", "success")
|
||||
end
|
||||
end
|
||||
-- Transfer from boss account to players --
|
||||
elseif account == "societytransfer" then
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for k, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if (society - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] ~= nil then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
if Config.Manage then exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.job.name), amount) end
|
||||
if Reciever ~= nil then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.job.label).." account", "success")
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif result[1] == nil then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
end
|
||||
end
|
||||
|
||||
--Simple transfers from gang society account to bank --
|
||||
elseif account == "gang" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(gsociety) < amount then TriggerClientEvent("QBCore:Notify", src, "Society balance too low", "error")
|
||||
elseif tonumber(gsociety) >= amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Withdrew $"..cv(amount).." from the "..Player.PlayerData.gang.label.." account", "success")
|
||||
Player.Functions.AddMoney('bank', amount)
|
||||
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-gangmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if bankB < amount then TriggerClientEvent("QBCore:Notify", src, "Not enough money in your bank", "error")
|
||||
elseif bankB >= amount then
|
||||
if Config.Manage then exports["qb-management"]:AddGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-gangmenu:server:addAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
Player.Functions.RemoveMoney('bank', amount) Wait(1500)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Deposited $"..cv(amount).." into the "..Player.PlayerData.gang.label.." account", "success")
|
||||
end
|
||||
end
|
||||
-- Transfer from gang account to players --
|
||||
elseif account == "gangtransfer" then
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for k, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if (gsociety - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] ~= nil then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
if Config.Manage then exports["qb-management"]:RemoveGangMoney(tostring(Player.PlayerData.gang.name), amount)
|
||||
else TriggerEvent("qb-bossmenu:server:removeAccountMoney", tostring(Player.PlayerData.gang.name), amount) end
|
||||
if Reciever ~= nil then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..amount.." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..tostring(Player.PlayerData.gang.label).." account", "success")
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif result[1] == nil then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
elseif account == "transfer" then
|
||||
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for k, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
if (Player.PlayerData.money.bank - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] ~= nil then
|
||||
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
if Reciever ~= nil then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
TriggerClientEvent("QBCore:Notify", src, "Sent $"..cv(amount).." to "..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success")
|
||||
TriggerClientEvent("QBCore:Notify", Reciever.PlayerData.source, "Recieved $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success")
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank = (RecieverMoney.bank + amount)
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif result[1] == nil then TriggerClientEvent("QBCore:Notify", src, "Error: Account '"..baccount.."' not found", "error")
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('jim-payments:ATM:Find', function(source, cb)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local name = Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname
|
||||
local cid = Player.PlayerData.citizenid.." ["..source.."]"
|
||||
local cash = Player.Functions.GetMoney("cash")
|
||||
local bank = Player.Functions.GetMoney("bank")
|
||||
local account = Player.PlayerData.charinfo.account
|
||||
|
||||
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
|
||||
if getSavingsAccount[1] ~= nil then
|
||||
aid = getSavingsAccount[1].record_id
|
||||
savbal = getSavingsAccount[1].amount
|
||||
else
|
||||
MySQL.Async.insert('INSERT INTO bank_accounts (citizenid, amount, account_type) VALUES (?, ?, ?)', { Player.PlayerData.citizenid, 0, 'Savings' }, function() completed = true end) repeat Wait(0) until completed == true
|
||||
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
|
||||
aid = getSavingsAccount[1].record_id
|
||||
savbal = getSavingsAccount[1].amount
|
||||
end
|
||||
local data = {
|
||||
name = name,
|
||||
cash = cash,
|
||||
bank = bank,
|
||||
account = account,
|
||||
cid = cid,
|
||||
savbal = savbal,
|
||||
aid = aid }
|
||||
cb(data)
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("cashgive", "Pay a user nearby", {}, false, function(source) TriggerClientEvent("jim-payments:client:ATM:give", source) end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:ATM:give", function(citizen, price)
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
local Reciever = QBCore.Functions.GetPlayer(tonumber(citizen))
|
||||
local amount = tonumber(price)
|
||||
local balance = Player.Functions.GetMoney("cash")
|
||||
|
||||
if amount and amount > 0 then
|
||||
if balance >= amount then
|
||||
Player.Functions.RemoveMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", source, "You gave "..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success")
|
||||
Reciever.Functions.AddMoney('cash', amount)
|
||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You got $"..cv(amount).." from "..Player.PlayerData.charinfo.firstname, "success")
|
||||
elseif balance < amount then
|
||||
TriggerClientEvent("QBCore:Notify", source, "You don't have enough cash to give", "error")
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't give $0", 'error') end
|
||||
end)
|
||||
90
client.lua
90
client.lua
@@ -1,90 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
PlayerJob = {}
|
||||
local onDuty = false
|
||||
local BankPed = {}
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang end) end)
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerJob = JobInfo onDuty = PlayerJob.onduty end)
|
||||
RegisterNetEvent('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
||||
RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo) PlayerGang = GangInfo end)
|
||||
|
||||
--Keeps track of duty on script restarts
|
||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
||||
QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job PlayerGang = PlayerData.gang onDuty = PlayerJob.onduty end)
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
local jobroles = {}
|
||||
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
|
||||
exports['qb-target']:AddCircleZone("JimBank", vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 2.0, { name="JimBank", debugPoly=Config.Debug, useZ=true, },
|
||||
{ options = { { event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles } }, distance = 2.0 })
|
||||
if Config.Peds then
|
||||
local i = math.random(1, #Config.PedPool)
|
||||
RequestModel(Config.PedPool[i]) while not HasModelLoaded(Config.PedPool[i]) do Wait(0) end
|
||||
if not BankPed[1] then BankPed[1] = CreatePed(0, Config.PedPool[i], vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z-1), Config.CashInLocation[4], false, false) end
|
||||
if Config.Debug then print("Ped Created for Ticket Trade") end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
|
||||
if outside == nil then outside = false end
|
||||
if not outside and not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
|
||||
local onlineList = {}
|
||||
local nearbyList = {}
|
||||
local p = promise.new()
|
||||
QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
|
||||
onlineList = Citizen.Await(p)
|
||||
for k, v in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
|
||||
local dist = #(GetEntityCoords(GetPlayerPed(v)) - GetEntityCoords(PlayerPedId()))
|
||||
for i = 1, #onlineList do
|
||||
if onlineList[i].value == GetPlayerServerId(v) then
|
||||
if v ~= PlayerId() then
|
||||
nearbyList[#nearbyList+1] = { value = onlineList[i].value, text = onlineList[i].text..' ('..math.floor(dist+0.05)..'m)' }
|
||||
end
|
||||
end
|
||||
end
|
||||
dist = nil
|
||||
end
|
||||
if not data.img then img = "" else img = data.img end
|
||||
if nearbyList[#nearbyList] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
|
||||
local newinputs = {}
|
||||
if Config.List then newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList } end
|
||||
if not Config.List then newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = '# Customer ID #' } end
|
||||
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "bank", text = "Card" } } }
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = '💵 Amount to Charge' }
|
||||
local dialog = exports['qb-input']:ShowInput({ header = img..PlayerJob.label.." Cash Register", submitText = "Send", inputs = newinputs})
|
||||
if dialog then
|
||||
if not dialog.citizen or not dialog.price then return end
|
||||
TriggerServerEvent('jim-payments:server:Charge', dialog.citizen, dialog.price, dialog.billtype, data.img, outside)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:Tickets:Menu', function()
|
||||
local amount = 0
|
||||
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end) amount = Citizen.Await(p)
|
||||
if amount == 0 or amount == nil then TriggerEvent("QBCore:Notify", "You don't have any tickets to trade", "error") return end
|
||||
for k, v in pairs(Config.Jobs) do if k ~= PlayerJob.name then
|
||||
else exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = "🧾 "..PlayerJob.label.." Receipts 🧾", txt = "Do you want trade your receipts for payment?" },
|
||||
{ isMenuHeader = true, header = "", txt = "Amount of Tickets: "..amount.."<br>Total Payment: $"..(Config.Jobs[PlayerJob.name].PayPerTicket * amount) },
|
||||
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
|
||||
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { event = "jim-payments:Tickets:Sell:no" } }, })
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob)
|
||||
if not img then img = "" end
|
||||
exports['qb-menu']:openMenu({
|
||||
{ isMenuHeader = true, header = img.."🧾 "..billerjob.." Payment 🧾", txt = "Do you want accept the payment?" },
|
||||
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper).." Payment: $"..amount },
|
||||
{ icon = "fas fa-circle-check", header = "Yes", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype } } },
|
||||
{ icon = "fas fa-circle-xmark", header = "No", txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype } } }, })
|
||||
end)
|
||||
|
||||
RegisterNetEvent('jim-payments:Tickets:Sell:yes', function() TriggerServerEvent('jim-payments:Tickets:Sell') end)
|
||||
RegisterNetEvent('jim-payments:Tickets:Sell:no', function() exports['qb-menu']:closeMenu() end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end
|
||||
exports['qb-target']:RemoveZone("JimBank") DeletePed(BankPed[1])
|
||||
end)
|
||||
171
client/atms.lua
Normal file
171
client/atms.lua
Normal file
@@ -0,0 +1,171 @@
|
||||
local Targets = {}
|
||||
|
||||
if Config.ATMs.enable then
|
||||
onPlayerLoaded(function() -- Automatic detection of models and make targets and blips
|
||||
Wait(2000)
|
||||
while true do
|
||||
local pedCoords = GetEntityCoords(PlayerPedId())
|
||||
for _, v in pairs(GetGamePool('CObject')) do
|
||||
for _, model in pairs(Config.ATMs.ATMModels) do
|
||||
if GetEntityModel(v) == model then
|
||||
local name, entCoords = getScript()..":ATMLocation:"..v, GetEntityCoords(v)
|
||||
if #(pedCoords - entCoords) <= 150 then
|
||||
if not Targets[name] then
|
||||
Targets[name] =
|
||||
createCircleTarget({name, vec3(entCoords.x, entCoords.y, entCoords.z+1.03), 0.5, { name=name, debugPoly = debugMode, useZ=true, },},
|
||||
{ { action = function() lookEnt(v) TriggerEvent(getScript()..":Client:ATM") end,
|
||||
icon = "fas fa-money-check-alt", label = locale("target", "atm"),
|
||||
}, }, 1.5)
|
||||
end
|
||||
if Config.ATMs.showBlips then
|
||||
if not DoesBlipExist(GetBlipFromEntity(v)) then
|
||||
makeEntityBlip({entity = v, sprite = 434, col = 3, name = "ATM" })
|
||||
end
|
||||
end
|
||||
else
|
||||
removeZoneTarget(name)
|
||||
Targets[name] = nil
|
||||
if DoesBlipExist(GetBlipFromEntity(v)) then RemoveBlip(GetBlipFromEntity(v)) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Wait(5000)
|
||||
end
|
||||
end, true)
|
||||
end
|
||||
|
||||
RegisterNetEvent(getScript()..":Client:ATM", function() local setheader = nil
|
||||
--this grabs all the info from names to savings account numbers in the databases
|
||||
local info = triggerCallback(getScript()..":GetInfo")
|
||||
|
||||
playAnim("amb@prop_human_atm@male@enter", "enter", 2000, 1)
|
||||
|
||||
if progressBar({ label = locale("menu", "acc_atm"), time = 3000 }) then
|
||||
local Menu = {}
|
||||
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = locale("menu", "welcome")..info.name,
|
||||
txt = info.cid,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = locale("menu", "header_balance"),
|
||||
txt = locale("menu", "bank_balance")..cv(info.bank)..br..locale("menu", "cash_balance")..cv(info.cash)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("menu", "withdraw"),
|
||||
onSelect = function()
|
||||
atmWithdrawl(info)
|
||||
end,
|
||||
}
|
||||
local header = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then
|
||||
header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then
|
||||
header = ''
|
||||
end
|
||||
openMenu(Menu, { header = header, canClose = true, onExit = function() playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1) end, })
|
||||
else
|
||||
triggerNotify(nil, locale("error", "cancel"), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
function atmWithdrawl(info)
|
||||
local setimage = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then setimage = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then setimage = ''
|
||||
end
|
||||
local dialog = createInput(locale("menu", "header_atm"), {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and locale("menu", "bank_balance")..cv(info.bank)..locale("menu", "cash_balance")..cv(info.cash)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||
locale("menu", "cash_balance")..cv(info.cash)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
} },
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount"),
|
||||
min = 0,
|
||||
max = info.bank,
|
||||
},
|
||||
})
|
||||
if dialog then
|
||||
if dialog[1] then
|
||||
dialog.billtype = dialog[1]
|
||||
dialog.amount = dialog[2] or 1
|
||||
end
|
||||
if not dialog.amount then return end
|
||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||
Wait(1000)
|
||||
TriggerServerEvent(getScript()..":server:ATM:use", dialog.amount, dialog.billtype, dialog.account, "atm", info.society, info.gsociety)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent(getScript()..":client:ATM:give", function()
|
||||
|
||||
local newinputs = {} -- Begin qb-input creation here.
|
||||
local nearbyList = {}
|
||||
if Config.General.List then -- If nearby player list is wanted:
|
||||
--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())
|
||||
|
||||
for _, v in ipairs(GetPlayersFromCoords(playerCoords, Config.General.PaymentRadius)) do
|
||||
local ped = GetPlayerPed(v)
|
||||
local dist = #(GetEntityCoords(ped) - playerCoords)
|
||||
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)'
|
||||
}
|
||||
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
|
||||
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") }
|
||||
end
|
||||
|
||||
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',
|
||||
text = locale("menu" ,"type"),
|
||||
default = billPrev,
|
||||
options = {
|
||||
{ value = "cash", text = locale("menu" ,"cash"), label = locale("menu" ,"cash") },
|
||||
}
|
||||
}
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = locale("menu" ,"amount_charge") }
|
||||
|
||||
local dialog = createInput(locale("menu", "give_cash"), newinputs)
|
||||
|
||||
if dialog then
|
||||
if dialog[1] then
|
||||
dialog.citizen = dialog[1]
|
||||
dialog.billtype = dialog[2]
|
||||
dialog.price = dialog[3]
|
||||
end
|
||||
billPrev = dialog.billtype
|
||||
TriggerServerEvent('jim-payments:server:ATM:give', dialog.citizen, dialog.price)
|
||||
end
|
||||
end)
|
||||
372
client/banks.lua
Normal file
372
client/banks.lua
Normal file
@@ -0,0 +1,372 @@
|
||||
Peds = {}
|
||||
|
||||
RegisterNetEvent('QBCore:Client:SetDuty', function(duty) onDuty = duty end)
|
||||
|
||||
if Config.Banks.enable then
|
||||
onPlayerLoaded(function()
|
||||
for k, v in pairs(BankLocations) 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
|
||||
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")
|
||||
},
|
||||
}
|
||||
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,
|
||||
}
|
||||
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
|
||||
end
|
||||
end
|
||||
end, true)
|
||||
end
|
||||
|
||||
RegisterNetEvent(getScript()..":Client:Bank", function(data) local setheader = nil
|
||||
--this grabs all the info from names to savings account numbers in the databases
|
||||
local bankinfo = triggerCallback(getScript()..":GetInfo")
|
||||
local info = getPlayer()
|
||||
info.ped = data.ped or nil
|
||||
|
||||
playAnim("amb@prop_human_atm@male@enter", "enter", 2000, 1)
|
||||
|
||||
if progressBar({ label = locale("menu", "acc_bank"), time = 3000 }) then
|
||||
local Menu = {}
|
||||
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = locale("menu", "welcome")..info.name,
|
||||
txt = locale("menu", "header_acc").." "..info.account..br..locale("menu", "citizenid").." "..info.citizenId,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = locale("menu", "header_acc")..locale("menu", "header_balance"),
|
||||
txt = locale("menu", "bank_balance")..cv(info.bank)..br..locale("menu", "cash_balance")..cv(info.cash)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("menu", "deposit").."/"..locale("menu", "withdraw"),
|
||||
icon = "fas fa-piggy-bank",
|
||||
onSelect = function()
|
||||
info.id = "bank"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if isStarted(QBExport) and not isStarted(QBXExport) then -- only supports qbcore account transfers
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "transfer"),
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function()
|
||||
info.id = "transfer"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "saving"),
|
||||
icon = "fas fa-money-check-dollar",
|
||||
onSelect = function()
|
||||
info.id = "savings"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
end
|
||||
if info.jobBoss then
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "soc_saving"),
|
||||
txt = Jobs[info.job].label..br.." 🏦 $"..bankinfo.society or "Error",
|
||||
icon = "fas fa-building",
|
||||
onSelect = function()
|
||||
info.id = "society"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if isStarted(QBExport) and not isStarted(QBXExport) then -- only supports qbcore account transfers
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "soc_trans"),
|
||||
txt = Jobs[info.job].label or "Error",
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function()
|
||||
info.id = "societytransfer"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
if info.gangBoss then
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "gang_acct"),
|
||||
txt = Gangs[info.gang].label or "Error",
|
||||
icon = "fas fa-building",
|
||||
onSelect = function()
|
||||
info.id = "gang"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
if isStarted(QBExport) then
|
||||
Menu[#Menu+1] = {
|
||||
header = locale("target", "gang_trans"),
|
||||
txt = Gangs[info.gang].label or "Error",
|
||||
icon = "fas fa-arrow-right-arrow-left",
|
||||
onSelect = function()
|
||||
info.id = "gangtransfer"
|
||||
bankTransaction(info, bankinfo)
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
local header = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then header = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then header = ''
|
||||
end
|
||||
openMenu(Menu, { header = header, canClose = true, onExit = function()
|
||||
if Config.General.Peds and isStarted("jim-talktonpc") then
|
||||
exports["jim-talktonpc"]:stopCam()
|
||||
end
|
||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||
end, })
|
||||
else
|
||||
triggerNotify(nil, locale("error", "cancel"), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
function bankTransaction(info, bankinfo)
|
||||
local setimage = locale("menu", "header_atm")
|
||||
if Config.System.Menu == "qb" then setimage = "<center><img src="..Config.General.menuLogo.." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then setimage = ''
|
||||
end
|
||||
|
||||
playAnim("amb@prop_human_atm@male@idle_a", "idle_a", nil, 1)
|
||||
if isStarted("jim-talktonpc") then exports["jim-talktonpc"]:injectEmotion("thanks", info.ped) end
|
||||
local setinputs, setheader = {}, ""
|
||||
|
||||
if info.id == "bank" then
|
||||
setheader = locale("menu", "header_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and locale("menu", "bank_balance")..cv(info.bank)..locale("menu", "cash_balance")..cv(info.cash)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||
locale("menu", "cash_balance")..cv(info.cash)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
},
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "transfer" then
|
||||
setheader = locale("menu", "header_trans")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "transfer", text = locale("menu", "transfer") }
|
||||
},
|
||||
},
|
||||
{ type = 'text',
|
||||
isRequired = true,
|
||||
name = 'account',
|
||||
text = locale("menu", "header_account_no")
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount"),
|
||||
min = 0,
|
||||
max = info.bank,
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "savings" then
|
||||
setheader = locale("menu", "header_saving")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and locale("menu", "saving_balance")..cv(bankinfo.savbal)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
locale("menu", "saving_balance")..cv(bankinfo.savbal)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
}
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "society" then
|
||||
setheader = Jobs[info.job].label.." - "..locale("menu", "header_soc_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and Jobs[info.job].label.." - $"..cv(bankinfo.society)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
Jobs[info.job].label.." - $"..cv(bankinfo.society)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
}
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "societytransfer" then
|
||||
setheader =Jobs[info.job].label.." - "..locale("menu", "header_trans")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and Jobs[info.job].label.." - $"..cv(bankinfo.society)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
Jobs[info.job].label.." - $"..cv(bankinfo.society)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = { { value = "transfer", text = locale("menu", "transfer") } }
|
||||
},
|
||||
{ type = 'text',
|
||||
isRequired = true,
|
||||
name = 'account',
|
||||
text = locale("menu", "header_account_no")
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "gang" then
|
||||
setheader = Gangs[info.gang].label.." - "..locale("menu", "header_soc_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "withdraw", text = locale("menu", "withdraw") },
|
||||
{ value = "deposit", text = locale("menu", "deposit") }
|
||||
}
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
|
||||
elseif info.id == "gangtransfer" then
|
||||
setheader = Gangs[info.gang].label.." - "..locale("menu", "header_soc_bank")
|
||||
setinputs = {
|
||||
{ type = 'radio',
|
||||
name = 'billtype',
|
||||
text = Config.System.Menu == "ox" and Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..locale("menu", "bank_balance")..cv(info.bank)
|
||||
or
|
||||
setimage..
|
||||
locale("menu", "header_balance")..br..
|
||||
Gangs[info.gang].label.." - $"..cv(bankinfo.gsociety)..br..
|
||||
locale("menu", "bank_balance")..cv(info.bank)..br..br..
|
||||
locale("menu", "header_option"),
|
||||
options = {
|
||||
{ value = "transfer", text = locale("menu", "transfer") }
|
||||
}
|
||||
},
|
||||
{ type = 'text',
|
||||
isRequired = true,
|
||||
name = 'account',
|
||||
text = locale("menu", "header_account_no")
|
||||
},
|
||||
{ type = 'number',
|
||||
isRequired = true,
|
||||
name = 'amount',
|
||||
text = locale("menu", "header_trans_amount")
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
local dialog = createInput(setheader, setinputs)
|
||||
if dialog then
|
||||
if dialog[1] then
|
||||
dialog.billtype = dialog[1]
|
||||
dialog.amount = dialog[2] or 1
|
||||
end
|
||||
if not dialog.amount then
|
||||
TriggerEvent(getScript()..":Client:Bank", { ped = info.ped })
|
||||
return
|
||||
end
|
||||
if Config.General.Peds and isStarted("jim-talktonpc") then
|
||||
exports["jim-talktonpc"]:stopCam()
|
||||
end
|
||||
playAnim("amb@prop_human_atm@male@exit", "exit", 3000, 1)
|
||||
Wait(1000)
|
||||
TriggerServerEvent(getScript()..":server:ATM:use", dialog.amount, dialog.billtype, dialog.account, info.id, bankinfo.society, bankinfo.gsociety)
|
||||
end
|
||||
end
|
||||
314
client/charge.lua
Normal file
314
client/charge.lua
Normal file
@@ -0,0 +1,314 @@
|
||||
local BankPed = nil
|
||||
local Till = {}
|
||||
|
||||
function spawnCustomRegisters()
|
||||
Wait(1000)
|
||||
for k, v in pairs(Config.CustomCashRegisters) do
|
||||
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}}, {
|
||||
{
|
||||
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 + vec4(0,0,1.0, 0.0)}, 1, false) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
onPlayerLoaded(function() spawnCustomRegisters() end, true)
|
||||
|
||||
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 = {}
|
||||
if Config.General.List then -- If nearby player list is wanted:
|
||||
--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)
|
||||
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)'
|
||||
}
|
||||
end
|
||||
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
|
||||
|
||||
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", "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
|
||||
|
||||
newinputs[#newinputs+1] = {
|
||||
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") }
|
||||
}
|
||||
}
|
||||
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = locale("menu" ,"amount_charge") }
|
||||
|
||||
local dialog = createInput(img, newinputs)
|
||||
|
||||
if dialog 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]
|
||||
end
|
||||
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 = ""
|
||||
|
||||
if not img then
|
||||
setimage = billerjob
|
||||
else
|
||||
if Config.System.Menu == "qb" then
|
||||
setimage = "<center><img src="..(img and img or "").." width=200px></center>"
|
||||
elseif Config.System.Menu == "ox" then
|
||||
setimage = '..')'
|
||||
end
|
||||
end
|
||||
|
||||
local Menu = {}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = "🧾 "..locale("menu" ,"payment"),
|
||||
txt = locale("menu" ,"accept_payment")
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
header = "",
|
||||
txt = billtype:gsub("^%l", string.upper)..locale("menu" ,"payment_amount")..amount
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check",
|
||||
header = locale("menu" ,"yes"),
|
||||
txt = "",
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
accept = true,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
billtype = billtype,
|
||||
outside = outside
|
||||
})
|
||||
end,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-xmark",
|
||||
header = locale("menu" ,"no"),
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
billtype = billtype,
|
||||
outside = outside
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
openMenu(Menu, {
|
||||
header = setimage,
|
||||
onExit = function()
|
||||
TriggerServerEvent(getScript()..":server:PayPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
billtype = billtype,
|
||||
outside = outside
|
||||
})
|
||||
end,
|
||||
})
|
||||
end)
|
||||
228
client/polcharge.lua
Normal file
228
client/polcharge.lua
Normal file
@@ -0,0 +1,228 @@
|
||||
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
|
||||
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
|
||||
local onlineList = triggerCallback(getScript()..":MakePlayerList")
|
||||
-- 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)'
|
||||
}
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
else
|
||||
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")
|
||||
}
|
||||
|
||||
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]
|
||||
end
|
||||
TriggerServerEvent(getScript()..":server:PolCharge", dialog.citizen, dialog.price)
|
||||
end
|
||||
end)
|
||||
|
||||
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] = {
|
||||
icon = "fas fa-circle-check",
|
||||
header = locale("menu" ,"yes"),
|
||||
txt = "",
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = true,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
commPercent = commPercent,
|
||||
})
|
||||
end,
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-xmark",
|
||||
header = locale("menu" ,"no"),
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
})
|
||||
end,
|
||||
}
|
||||
openMenu(Menu, {
|
||||
header = "🧾 "..billerjob..locale("menu" ,"payment"),
|
||||
headertxt = locale("menu" ,"accept_payment"),
|
||||
onExit = function()
|
||||
TriggerServerEvent(getScript()..":server:PolPopup", {
|
||||
accept = false,
|
||||
amount = amount,
|
||||
biller = biller,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end)
|
||||
70
client/tickets.lua
Normal file
70
client/tickets.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
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)
|
||||
if not hasItem then
|
||||
triggerNotify(nil, locale("error" ,"no_ticket"), "error")
|
||||
return
|
||||
end
|
||||
local amount, sellable, name, label = hasTable["payticket"].count, false, "", ""
|
||||
for k, v in pairs(Config.Receipts.Jobs) do
|
||||
sellable = (data.gang and v.gang and k == PlayerInfo.gang) or (not data.gang and not v.gang and k == PlayerInfo.job)
|
||||
if sellable then name, label = k, (data.gang and Gangs[PlayerInfo.gang].label) or (not data.gang and Jobs[PlayerInfo.job].label) break end
|
||||
end
|
||||
if sellable then local Menu = {}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
txt = locale("menu" ,"ticket_amount")..amount..locale("menu" ,"total_pay")..(Config.Receipts.Jobs[name].PayPerTicket * amount)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check", header = locale("menu" ,"yes"),
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":Tickets:Sell")
|
||||
playAnim("pickup_object", "putdown_low", 2000, 1)
|
||||
end,
|
||||
}
|
||||
openMenu(Menu, { header = "🧾 "..label..locale("menu" ,"receipt"), headertxt = locale("menu" ,"trade_confirm"), canClose = true, })
|
||||
end
|
||||
end)
|
||||
391
config.lua
391
config.lua
@@ -1,222 +1,169 @@
|
||||
print("Jim-Payments v2.5 - Payments Script by Jimathy")
|
||||
|
||||
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
|
||||
|
||||
-- https://discord.gg/xKgQZ6wZvS
|
||||
|
||||
Config = {}
|
||||
|
||||
Config.Debug = false
|
||||
|
||||
Config.Manage = false -- "true" if using qb-management
|
||||
-- "false" if using qb-bossmenu
|
||||
|
||||
Config.TicketSystem = true -- Enable this if you want to use the ticket system false
|
||||
|
||||
Config.List = true -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
|
||||
Config.PaymentRadius = 30 -- This is how far the playerlist will check for nearby players (based on the person charging)
|
||||
|
||||
Config.Peds = true -- "true" to enable peds spawning in banks
|
||||
Config.PedPool = {
|
||||
[1] = `IG_Bankman`,
|
||||
[2] = `U_M_M_BankMan`,
|
||||
[3] = `S_F_M_Shop_HIGH`,
|
||||
[4] = `S_M_M_HighSec_02`,
|
||||
[5] = `S_M_M_HighSec_03`,
|
||||
[6] = `S_M_M_HighSec_04`,
|
||||
[7] = `A_F_Y_Business_01`,
|
||||
[8] = `A_F_Y_Business_02`,
|
||||
[9] = `A_F_Y_Business_03`,
|
||||
[10] = `A_F_Y_Business_04`,
|
||||
[11] = `A_M_M_Business_01`,
|
||||
[12] = `A_M_Y_Business_02`,
|
||||
[13] = `A_M_Y_Business_03`,
|
||||
[14] = `U_F_M_CasinoShop_01`,
|
||||
}
|
||||
|
||||
Config.Gabz = true -- "true" to enable Gabz Banking locations
|
||||
Config.useATM = true -- Enable this to use my ATM's
|
||||
Config.useBanks = true -- Enable this to use my banking stuff
|
||||
Config.BankBlips = true -- Enable this if you disabled qb-banking and need bank locations
|
||||
Config.ATMBlips = false -- Enable this if you are a pyscho and need every ATM to be on the map too
|
||||
|
||||
Config.PhoneBank = true -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
|
||||
-- This doesn't affect Cash payments as they by default use confirmation now
|
||||
-- This is helpful for phones that don't support invoices well
|
||||
|
||||
Config.PhoneType = "qb" -- Change this setting to make invoices work with your phone script [still testing this currently]
|
||||
-- "qb" for qb-phone
|
||||
-- "gks"" for GKSPhone
|
||||
|
||||
Config.Commission = false -- Set this to true to enable Commissions and give the person charging a percentage of the total
|
||||
Config.CommissionAll = false -- Set this to true to give commission to workers clocked in
|
||||
Config.CommissionDouble = false -- Set this to true if you want the person charging to get double Commission
|
||||
Config.CommissionLimit = false -- If true, this limits the Commission to only be given if over the "MinAmountForTicket". If false, Commission will be given for any amount
|
||||
|
||||
-- MinAmountforTicket should be your cheapest item
|
||||
-- PayPerTicket should never be higher than MinAmountforTicket
|
||||
-- Commission is a percentage eg "0.10" becomes 10%
|
||||
|
||||
Config.CashInLocation = vector4(252.23, 223.11, 106.29, 159.2) -- Default Third Window along in Pacific Bank
|
||||
if Config.Gabz then Config.CashInLocation = vector4(269.28, 217.24, 106.28, 69.0) end -- Middle along in Pacific Bank (Gabz)
|
||||
|
||||
Config.Jobs = {
|
||||
['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10,},
|
||||
['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['henhouse'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['pizzathis'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['popsdiner'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||
}
|
||||
|
||||
Config.ATMModels = {"prop_atm_01", "prop_atm_02", "prop_atm_03", "prop_fleeca_atm" }
|
||||
|
||||
Config.GabzATMLocations = {
|
||||
--PACIFIC BANK 12 ATMS (GABZ)
|
||||
vector3(239.02, 212.37, 106.28),
|
||||
vector3(239.46, 213.6, 106.28),
|
||||
vector3(239.9, 214.82, 106.28),
|
||||
vector3(240.35, 216.03, 106.28),
|
||||
vector3(241.42, 218.96, 106.28),
|
||||
vector3(241.86, 220.16, 106.28),
|
||||
vector3(242.3, 221.41, 106.28),
|
||||
vector3(242.76, 222.63, 106.28),
|
||||
vector3(263.46, 203.86, 106.28),
|
||||
vector3(263.96, 205.03, 106.28),
|
||||
vector3(264.37, 206.28, 106.28),
|
||||
vector3(264.77, 207.51, 106.28),
|
||||
}
|
||||
|
||||
Config.VanATMLocations = {
|
||||
--PACIFIC BANK 10 ATMS
|
||||
vector3(265.9, 213.86, 106.28),
|
||||
vector3(265.56, 212.98, 106.28),
|
||||
vector3(265.19, 211.91, 106.28),
|
||||
vector3(264.86, 211.03, 106.28),
|
||||
vector3(264.52, 210.06, 106.28),
|
||||
vector3(236.64, 219.72, 106.29),
|
||||
vector3(237.04, 218.72, 106.29),
|
||||
vector3(237.5, 217.87, 106.29),
|
||||
vector3(237.93, 216.94, 106.29),
|
||||
vector3(238.36, 216.03, 106.29),
|
||||
}
|
||||
|
||||
--QB-Target doesn't seem to like ALL ATM Props so need to manually add locations
|
||||
Config.WallATMLocations = {
|
||||
vector3(-386.54, 6046.29, 31.5),
|
||||
vector3(-282.82, 6226.24, 31.49),
|
||||
vector3(-132.74, 6366.79, 31.48),
|
||||
vector3(-95.76, 6457.41, 31.46),
|
||||
vector3(-97.52, 6455.65, 31.47),
|
||||
vector3(155.95, 6642.99, 31.6),
|
||||
vector3(173.92, 6638.16, 31.57),
|
||||
vector3(2558.65, 350.92, 108.62),
|
||||
vector3(1077.78, -776.64, 58.35),
|
||||
vector3(1138.14, -468.88, 66.73),
|
||||
vector3(1166.93, -455.96, 66.81),
|
||||
vector3(285.37, 143.07, 104.17),
|
||||
vector3(-165.43, 234.81, 94.92),
|
||||
vector3(-165.4, 232.73, 94.92),
|
||||
vector3(-1410.41, -98.76, 52.43),
|
||||
vector3(-1409.85, -100.51, 52.38),
|
||||
vector3(-1206.0, -324.94, 37.86),
|
||||
vector3(-1205.23, -326.55, 37.86),
|
||||
vector3(-2072.28, -317.27, 13.32),
|
||||
vector3(-2974.7, 380.15, 15.0),
|
||||
vector3(-2959.01, 487.45, 15.46),
|
||||
vector3(-2956.87, 487.36, 15.46),
|
||||
vector3(-3043.98, 594.32, 7.74),
|
||||
vector3(-3241.35, 997.74, 12.55),
|
||||
vector3(-1305.59, -706.64, 25.32),
|
||||
vector3(-537.85, -854.69, 29.28),
|
||||
vector3(-709.98, -818.71, 23.73),
|
||||
vector3(-712.87, -818.71, 23.73),
|
||||
vector3(-526.71, -1223.18, 18.45),
|
||||
vector3(-256.47, -715.94, 33.55),
|
||||
vector3(-259.13, -723.29, 33.54),
|
||||
vector3(-203.82, -861.3, 30.27),
|
||||
vector3(111.38, -774.96, 31.44),
|
||||
vector3(114.56, -776.13, 31.42),
|
||||
vector3(112.46, -819.65, 31.34),
|
||||
vector3(118.93, -883.68, 31.12),
|
||||
vector3(-846.97, -340.29, 38.68),
|
||||
vector3(-846.41, -341.41, 38.68),
|
||||
vector3(-262.21, -2012.17, 30.15),
|
||||
vector3(-273.23, -2024.32, 30.15),
|
||||
vector3(24.46, -945.94, 29.36),
|
||||
vector3(-254.48, -692.74, 33.61),
|
||||
vector3(-1569.95, -546.94, 34.96),
|
||||
vector3(-1570.91, -547.63, 34.96),
|
||||
vector3(289.14, -1282.29, 29.6),
|
||||
vector3(289.18, -1256.84, 29.44),
|
||||
vector3(296.04, -896.22, 29.24),
|
||||
vector3(296.74, -894.26, 29.24),
|
||||
vector3(-301.63, -829.73, 32.43),
|
||||
vector3(-303.23, -829.44, 32.43),
|
||||
vector3(5.27, -919.87, 29.56),
|
||||
vector3(-1200.61, -885.62, 13.26),
|
||||
}
|
||||
|
||||
Config.VanBankLocations = {
|
||||
["legion"] = {
|
||||
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
||||
},
|
||||
["hawick"] = {
|
||||
vector4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
|
||||
},
|
||||
["vinewood"] = {
|
||||
vector4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
|
||||
},
|
||||
["delperro"] = {
|
||||
vector4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
|
||||
},
|
||||
["route1"] = {
|
||||
vector4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
|
||||
},
|
||||
["route68"] = {
|
||||
vector4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
|
||||
},
|
||||
["paleto"] = {
|
||||
vector4(-111.22, 6470.03, 31.63, 133.86), -- Paleto Bank
|
||||
},
|
||||
["pacific"] = {
|
||||
vector4(243.58, 226.25, 106.29, 169.06), -- Pacific Bank Window 1
|
||||
vector4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
|
||||
},
|
||||
}
|
||||
|
||||
Config.GabzBankLocations = {
|
||||
["legion"] = {
|
||||
vector4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
||||
},
|
||||
["hawick"] = {
|
||||
vector4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
|
||||
},
|
||||
["vinewood"] = {
|
||||
vector4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
|
||||
},
|
||||
["delperro"] = {
|
||||
vector4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
|
||||
},
|
||||
["route1"] = {
|
||||
vector4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
|
||||
},
|
||||
["route68"] = {
|
||||
vector4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
|
||||
},
|
||||
["paleto"] = {
|
||||
vector4(-110.72, 6469.82, 31.63, 222.94), -- Paleto Bank (GABZ) - 1
|
||||
vector4(-108.98, 6471.56, 31.63, 222.92), -- Paleto Bank (GABZ) - 2
|
||||
},
|
||||
["pacific"] = {
|
||||
vector4(258.55, 227.63, 106.28, 160.96), -- Pacficic Gabz 1+2
|
||||
vector4(263.21, 225.93, 106.28, 158.25), -- Pacficic Gabz 3+4
|
||||
vector4(267.95, 224.24, 106.28, 158.5), -- Pacficic Gabz 5+6
|
||||
vector4(263.71, 212.63, 106.28, 337.53), -- Pacficic Gabz 7+8
|
||||
vector4(259.02, 214.32, 106.28, 337.82), -- Pacficic Gabz 9+10
|
||||
vector4(254.27, 216.06, 106.28, 336.37), -- Pacficic Gabz 11+12
|
||||
},
|
||||
}
|
||||
-- If you need support I now have a discord available, it helps me keep track of issues and give better support.
|
||||
|
||||
-- https://discord.gg/9pCDHmjYwd
|
||||
|
||||
Config = {
|
||||
Lan = "en",
|
||||
System = {
|
||||
Debug = false,
|
||||
EventDebug = false,
|
||||
|
||||
Menu = "qb", -- "qb", "ox", "gta"
|
||||
Notify = "gta", -- "qb", "ox", "gta", "esx"
|
||||
ProgressBar = "gta", -- "qb", "ox", "gta", "esx"
|
||||
|
||||
DontUseTarget = false, -- uses drawtext targets instead of alt targets
|
||||
},
|
||||
|
||||
Crafting = {
|
||||
craftCam = true,
|
||||
MultiCraft = true,
|
||||
MultiCraftAmounts = { [1], [5], [10] },
|
||||
showItemBox = true,
|
||||
},
|
||||
|
||||
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
|
||||
|
||||
Enablecommand = true, -- Enables the /cashregister command
|
||||
|
||||
PhoneBank = false, -- Set this to false to use the popup payment system FOR CARD/BANK PAYMENTS instead of using phone invoices
|
||||
-- This doesn't affect Cash payments as they by default use a confirmation window
|
||||
-- This is helpful for phones that don't support invoices well
|
||||
|
||||
Peds = true, -- "true" to enable peds spawning in banks
|
||||
PedPool = { -- If Peds is true, use this pool of ped models to pick from
|
||||
"IG_Bankman",
|
||||
"U_M_M_BankMan",
|
||||
"S_F_M_Shop_HIGH",
|
||||
"S_M_M_HighSec_02",
|
||||
"S_M_M_HighSec_03",
|
||||
"S_M_M_HighSec_04",
|
||||
"A_F_Y_Business_01",
|
||||
"A_F_Y_Business_02",
|
||||
"A_F_Y_Business_03",
|
||||
"A_F_Y_Business_04",
|
||||
"A_M_M_Business_01",
|
||||
"A_M_Y_Business_02",
|
||||
"A_M_Y_Business_03",
|
||||
"U_F_M_CasinoShop_01",
|
||||
},
|
||||
|
||||
PhoneType = "qb", -- Change this setting to make invoices work with your phone script [still testing this currently]
|
||||
-- "qb" for qb-phone
|
||||
-- "gks" for GKSPhone
|
||||
|
||||
|
||||
Gabz = false, -- "true" to enable Gabz Bank locations
|
||||
-- this corrects the ATM/Bank Cashier + Ticket Cash in locations
|
||||
|
||||
menuLogo = "https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png",
|
||||
|
||||
},
|
||||
|
||||
ATMs = {
|
||||
enable = true, -- Enable this if wanting to use jim-payments atm systems
|
||||
showBlips = true,
|
||||
|
||||
ATMModels = { `prop_atm_01`, `prop_atm_02`, `prop_atm_03`, `prop_fleeca_atm`, `gabz_sm_pb_atmframe` },
|
||||
|
||||
},
|
||||
|
||||
Banks = {
|
||||
enable = true, -- Enable this if wanting to use jim-payments banking systems
|
||||
showBlips = true,
|
||||
|
||||
},
|
||||
|
||||
CustomCashRegisters = {
|
||||
-- ["jobname"] = { -- Player job role restriction
|
||||
-- { coords = vector4(0, 0, 0, 0), }, -- vector4 to place the till and the way it faces
|
||||
-- { coords = vector4(0, 0, 0, 0), prop = true, }, -- "prop = true" spawns a prop at the coords
|
||||
-- },
|
||||
},
|
||||
|
||||
Receipts = {
|
||||
TicketSystem = true, -- Enable this if you want to use the ticket system false
|
||||
TicketSystemAll = true, -- Enable this to give tickets to all workers clocked in
|
||||
|
||||
Commission = true, -- Set this to true to enable Commissions and give the person charging a percentage of the total
|
||||
CommissionAll = false, -- Set this to true to give commission to workers clocked in
|
||||
CommissionDouble = false, -- Set this to true if you want the person charging to get double Commission
|
||||
CommissionLimit = false, -- If true, this limits the Commission to only be given if over the "MinAmountForTicket".
|
||||
-- If false, Commission will be given for any amount
|
||||
|
||||
CashInLocations = {
|
||||
vec4(252.23, 223.11, 106.29, 159.2), -- Default Third Window along in Pacific Bank
|
||||
},
|
||||
|
||||
CashInAnywhere = true, -- enable this to add cash ticket option to any banking location
|
||||
|
||||
-- MinAmountforTicket should be your cheapest item
|
||||
-- PayPerTicket should never be higher than MinAmountforTicket
|
||||
-- Commission is a percentage eg "0.10" becomes 10%
|
||||
Jobs = {
|
||||
-- Jim Businesses | https://jimathy666.tebex.io/
|
||||
['bakery'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 , Commission = 0.10, },
|
||||
['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['henhouse'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['pizzathis'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['popsdiner'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['upnatom'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['hornys'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
|
||||
-- JixelTay Businesses | https://jixeltay.tebex.io/
|
||||
['cigarbar'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['cluckinbell'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['smokeshop'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['pearls'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['kois'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['whitewidow'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
['bestbuds'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
|
||||
|
||||
-- Jim Mechanic | https://jimathy666.tebex.io/
|
||||
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||
['tuners'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||
['ottos'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||
['lscustoms'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||
['bennys'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
|
||||
|
||||
-- Gangs | Example of a gang being supported
|
||||
['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true, },
|
||||
},
|
||||
|
||||
},
|
||||
PolCharge = {
|
||||
-- The /polcharge command requires specific jobs to be set
|
||||
-- No tickets for these, it's just commission (0.25 = 25%)
|
||||
FineJobs = {
|
||||
['police'] = { Commission = 0.25, },
|
||||
['ambulance'] = { Commission = 0.25, },
|
||||
},
|
||||
FineJobConfirmation = false, --"true" makes it so fines need confirmation, "false" skips this ands just removes the money
|
||||
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
|
||||
},
|
||||
}
|
||||
|
||||
PlayerGang, PlayerJob, onDuty = {}, {}, nil
|
||||
|
||||
-- Test function for locales
|
||||
function locale(section, string)
|
||||
if not Config.Lan or Config.Lan == "" then return print("Error, no langauge set") end
|
||||
local localTable = Loc[Config.Lan]
|
||||
if not localTable then return "Locale Table Not Found" end
|
||||
if not localTable[section] then return "["..section.."] Invalid" end
|
||||
if not localTable[section][string] then return "["..string.."] Invalid" end
|
||||
return localTable[section][string]
|
||||
end
|
||||
@@ -1,26 +1,26 @@
|
||||
name "Jim-Payments"
|
||||
author "Jimathy"
|
||||
version "v2.5"
|
||||
description "Payment Script By Jimathy"
|
||||
version "3.0.05"
|
||||
description "Payment Script"
|
||||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
lua54 'yes'
|
||||
|
||||
dependencies {
|
||||
'qb-input',
|
||||
'qb-target',
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'client.lua',
|
||||
'atms.lua'
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
'server.lua',
|
||||
'atmserver.lua'
|
||||
}
|
||||
server_script '@oxmysql/lib/MySQL.lua'
|
||||
|
||||
shared_scripts {
|
||||
'config.lua',
|
||||
}
|
||||
'locales/*.lua',
|
||||
'config.lua',
|
||||
|
||||
--Jim Bridge - https://github.com/jimathy/jim_bridge
|
||||
'@jim_bridge/starter.lua',
|
||||
|
||||
'shared/*.lua',
|
||||
}
|
||||
client_scripts {
|
||||
'client/*.lua',
|
||||
}
|
||||
|
||||
server_script 'server/*.lua'
|
||||
|
||||
dependency 'jim_bridge'
|
||||
BIN
images/terminal.png
Normal file
BIN
images/terminal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
136
locales/da.lua
Normal file
136
locales/da.lua
Normal file
@@ -0,0 +1,136 @@
|
||||
-- Provided by iplayer1337fivem on Github
|
||||
Loc = Loc or {}
|
||||
|
||||
Loc["da"] = {
|
||||
error = {
|
||||
["cancel"] = "Afbestilt",
|
||||
["no_one"] = "Ingen i nærheden at opkræve",
|
||||
["not_onduty"] = "Ikke logget ind!",
|
||||
["no_job"] = "Du har ikke det påkrævede job",
|
||||
["no_ticket"] = "Du har ingen billetter at handle med",
|
||||
["bank_low"] = "Bankbalance for lav",
|
||||
["no_cash"] = "Ikke nok kontanter",
|
||||
["saving_low"] = "Savings balance for lav",
|
||||
["soc_low"] = "Society balance for lav",
|
||||
["nomoney_bank"] = "Ikke nok penge på din bankkonto",
|
||||
["error_start"] = "Fejl: Konto '",
|
||||
["error_end"] = "' ikke fundet",
|
||||
["not_enough"] = "Du har ikke nok kontanter til at give",
|
||||
["zero"] = "Du kan ikke give DKK0",
|
||||
["charge_zero"] = "Du kan ikke opkræve 0 DKK",
|
||||
["no_ticket_to"] = "Ingen billetter at handle med",
|
||||
["customer_nocash"] = "Kunden har ikke nok kontanter til at betale",
|
||||
["you_nocash"] = "Du har ikke nok kontanter til at betale",
|
||||
["decline_pay"] = " afslog DKK",
|
||||
["declined_payment"] = "Du afslog betalingen",
|
||||
},
|
||||
success = {
|
||||
["draw"] = "Hævet DKK",
|
||||
["from_bank"] = " fra banken",
|
||||
["deposited"] = "Indsat DKK",
|
||||
["into_bank"] = " på bankkontoen",
|
||||
["draw_save"] = " Trukket fra opsparingskontoen til bankkontoen",
|
||||
["depos_save"] = " Indsat fra bankkontoen til opsparingen",
|
||||
["fromthe"] = " fra ",
|
||||
["into"] = " til ",
|
||||
["account"] = " konto",
|
||||
["sent"] = "Sendt DKK",
|
||||
["recieved"] = "Modtaget DKK",
|
||||
["to"] = " til ",
|
||||
["from"] = " fra ",
|
||||
["you_gave"] = "Du gav ",
|
||||
["you_got"] = "Du fik DKK",
|
||||
["invoice_start"] = " Betalte deres DKK",
|
||||
["invoice_end"] = " faktura",
|
||||
["rec_rec"] = "Kvittering modtaget",
|
||||
["commission"] = " i provision",
|
||||
["trade_ticket_start"] = "Billetter handlet: ",
|
||||
["trade_ticket_end"] = " I alt: DKK",
|
||||
["inv_succ"] = "Faktura sendt med succes",
|
||||
["inv_recieved"] = "Ny faktura modtaget",
|
||||
["declined"] = "Du afslog betalingen",
|
||||
["accepted_pay"] = " accepterede DKK",
|
||||
["payment"] = " betaling",
|
||||
["charged"] = " blev opkrævet for DKK",
|
||||
["you_charged"] = "Du blev opkrævet for DKK",
|
||||
["charge_end"] = " opkrævning",
|
||||
},
|
||||
blip = {
|
||||
["blip_atm"] = "Hæveautomat",
|
||||
["blip_bank"] = "Bank",
|
||||
},
|
||||
command = {
|
||||
["pay_user"] = "Betal en bruger i nærheden",
|
||||
["cash_reg"] = "Brug mobil kontantregister",
|
||||
["charge"] = "Opkræv en anden person",
|
||||
},
|
||||
target = {
|
||||
["atm"] = "Brug hæveautomat",
|
||||
["bank"] = "Brug bank",
|
||||
["transfer"] = "Overfør penge",
|
||||
["saving"] = "Adgang til opsparing",
|
||||
["soc_saving"] = "Adgang til society-konto",
|
||||
["soc_trans"] = "Society pengetransfer",
|
||||
["gang_acct"] = "Gang Society-konto",
|
||||
["gang_trans"] = "Gang pengetransfer",
|
||||
["charge"] = "Opkræv kunde",
|
||||
["cashin_boss"] = "Indbetal jobkvitteringer",
|
||||
["cashin_gang"] = "Indbetal gangkvitteringer",
|
||||
},
|
||||
menu = {
|
||||
["close"] = "Luk",
|
||||
["withdraw"] = "Hæv",
|
||||
["deposit"] = "Indsæt",
|
||||
["transfer"] = "Overfør",
|
||||
["transfer_money"] = "Overfør penge",
|
||||
["header_atm"] = "💵 Hæveautomat Bank 💵",
|
||||
["header_trans_amount"] = "💵 Beløb at overføre",
|
||||
["header_bank"] = "🏦 Bankvæsen 🏦",
|
||||
["header_trans"] = "🔀 Overførselsservice 🔀",
|
||||
["header_account_no"] = "🏦 Kontonr.",
|
||||
["header_saving"] = "💰 Opsparing 💰",
|
||||
["acc_atm"] = "Adgang til hæveautomat",
|
||||
["acc_bank"] = "Adgang til bank",
|
||||
["acc_trans"] = "Adgang til overførsler",
|
||||
["acc_saving"] = "Adgang til opsparing",
|
||||
["acc_boss"] = "Adgang til society-konto",
|
||||
["acc_boss_trans"] = "Adgang til society-overførsler",
|
||||
["acc_gang"] = "Adgang til gang-society-konto",
|
||||
["acc_gang_trans"] = "Adgang til gangoverførsler",
|
||||
["header_soc"] = "- Society-konto -",
|
||||
["header_soc_bank"] = "🏢 Society Bank 🏢",
|
||||
["amount_pay"] = "💵 Beløb at betale",
|
||||
["give_cash"] = "Giv nogen kontanter",
|
||||
["give"] = "Giv",
|
||||
["welcome"] = "Velkommen tilbage, ",
|
||||
["citizenid"] = "- Borger-ID -",
|
||||
["header_acc"] = "- Konto -",
|
||||
["header_info"] = "- Kontoinformation -Opsparings-ID: ",
|
||||
["header_balance_bank"] = "- Balancer -🏦Bank - DKK",
|
||||
["header_option"] = "- Valg -",
|
||||
["cash_balance"] = "💵Kontanter - DKK",
|
||||
["bank_balance"] = "🏦Bank - DKK",
|
||||
["saving_balance"] = "- Balancer -💰Opsparing - DKK",
|
||||
["cus_id"] = "# Kundens ID #",
|
||||
["type"] = "Betalingstype",
|
||||
["amount_charge"] = "💵 Beløb at opkræve",
|
||||
["cash_reg"] = "Kontantregister",
|
||||
["person_id"] = "# Personens ID #",
|
||||
["charge"] = "Opkræv",
|
||||
["send"] = "Send",
|
||||
["receipt"] = "Kvitteringer 🧾",
|
||||
["payment"] = " Betaling 🧾",
|
||||
["trade_confirm"] = "Vil du bytte dine kvitteringer til betaling?",
|
||||
["accept_payment"] = "Vil du acceptere betalingen?",
|
||||
["accept_charge"] = "Vil du acceptere opkrævningen?",
|
||||
["ticket_amount"] = "Antal billetter: ",
|
||||
["total_pay"] = "Total betaling: DKK",
|
||||
["confirm"] = "Ja",
|
||||
["yes"] = "Ja",
|
||||
["no"] = "Nej",
|
||||
["cash"] = "Kontanter",
|
||||
["card"] = "Kort",
|
||||
["payment_amount"] = " Betaling: DKK",
|
||||
["bank_charge"] = "Bankgebyr: DKK",
|
||||
},
|
||||
}
|
||||
135
locales/de.lua
Normal file
135
locales/de.lua
Normal file
@@ -0,0 +1,135 @@
|
||||
Loc = Loc or {}
|
||||
|
||||
Loc["de"] = {
|
||||
error = {
|
||||
["cancel"] = "Abgebrochen",
|
||||
["no_one"] = "Keiner in der Nähe zum Aufladen",
|
||||
["not_onduty"] = "Nicht eingestempelt!",
|
||||
["no_job"] = "Sie haben nicht den gewünschten Beruf",
|
||||
["no_ticket"] = "Sie haben keine Tickets zum Tauschen",
|
||||
["bank_low"] = "Kontostand zu niedrig",
|
||||
["no_cash"] = "Nicht genug Bargeld",
|
||||
["saving_low"] = "Sparguthaben zu niedrig",
|
||||
["soc_low"] = "Firmenkontoguthaben zu niedrig",
|
||||
["nomoney_bank"] = "Nicht genug Geld auf Ihrer Bank",
|
||||
["error_start"] = "Fehler: Konto '",
|
||||
["error_end"] = "' nicht gefunden",
|
||||
["not_enough"] = "Sie haben nicht genug Geld zum übergeben",
|
||||
["zero"] = "Sie können nicht 0$ geben",
|
||||
["charge_zero"] = "Sie können keine $0 berechnen",
|
||||
["no_ticket_to"] = "Keine Tickets zum Tauschen",
|
||||
["customer_nocash"] = "Der Kunde hat nicht genug Bargeld, um zu bezahlen",
|
||||
["you_nocash"] = "Sie haben nicht genug Geld, um zu bezahlen",
|
||||
["decline_pay"] = " lehnte die $ ab",
|
||||
["declined_payment"] = "Sie haben die Zahlung abgelehnt",
|
||||
},
|
||||
success = {
|
||||
["draw"] = "Abgehoben $",
|
||||
["from_bank"] = " von der Bank",
|
||||
["deposited"] = "Eingezahlt $",
|
||||
["into_bank"] = " in die Bank",
|
||||
["draw_save"] = " Abhebung von Ersparnissen auf ein Bankkonto",
|
||||
["depos_save"] = " Vom Bankkonto auf das Sparkonto eingezahlt",
|
||||
["fromthe"] = " von der ",
|
||||
["into"] = " in die ",
|
||||
["account"] = " Konto",
|
||||
["sent"] = "Gesendet $",
|
||||
["recieved"] = "Empfangen $",
|
||||
["to"] = " zu ",
|
||||
["from"] = " von ",
|
||||
["you_gave"] = "Sie gaben ",
|
||||
["you_got"] = "Sie haben $",
|
||||
["invoice_start"] = " Bezahlten ihre $",
|
||||
["invoice_end"] = " Rechnung",
|
||||
["rec_rec"] = "Erhaltene Quittung",
|
||||
["commission"] = " in der Kommission",
|
||||
["trade_ticket_start"] = "Gehandelte Tickets: ",
|
||||
["trade_ticket_end"] = " Total: $",
|
||||
["inv_succ"] = "Rechnung erfolgreich gesendet",
|
||||
["inv_recieved"] = "Neue Rechnung erhalten",
|
||||
["declined"] = "Sie haben die Zahlung abgelehnt",
|
||||
["accepted_pay"] = " akzeptierte die $",
|
||||
["payment"] = " Zahlung",
|
||||
["charged"] = " wurde berechnet für $",
|
||||
["you_charged"] = "Sie wurden berechnet für $",
|
||||
["charge_end"] = " Gebühr",
|
||||
},
|
||||
blip = {
|
||||
["blip_atm"] = "ATM",
|
||||
["blip_bank"] = "Bank",
|
||||
},
|
||||
command = {
|
||||
["pay_user"] = "Einen Bürger in der Nähe bezahlen",
|
||||
["cash_reg"] = "Mobile Registrierkasse verwenden",
|
||||
["charge"] = "Eine andere Person belasten",
|
||||
},
|
||||
target = {
|
||||
["atm"] = "ATM benutzen",
|
||||
["bank"] = "Bank benutzen",
|
||||
["transfer"] = "Geld überweisen",
|
||||
["saving"] = "Zugang Ersparnisse",
|
||||
["soc_saving"] = "Zugang Firmenkonto",
|
||||
["soc_trans"] = "Firmenkonto Geldüberweisung",
|
||||
["gang_acct"] = "Gang Konto",
|
||||
["gang_trans"] = "Gang Geldtransfer",
|
||||
["charge"] = "Gebühr für den Kunden",
|
||||
["cashin_boss"] = "Bargeld in Job-Einnahmen",
|
||||
["cashin_gang"] = "Bargeld in Bandeneinnahmen",
|
||||
},
|
||||
menu = {
|
||||
["close"] = "Schließen",
|
||||
["withdraw"] = "Abheben",
|
||||
["deposit"] = "Einzahlen",
|
||||
["transfer"] = "Überweißen",
|
||||
["transfer_money"] = "Geld überweisen",
|
||||
["header_atm"] = "💵 ATM Banking 💵",
|
||||
["header_trans_amount"] = "💵 Überweisungsbetrag",
|
||||
["header_bank"] = "🏦 Banking 🏦",
|
||||
["header_trans"] = "🔀 Transferdienste 🔀",
|
||||
["header_account_no"] = "🏦 Kontonummer.",
|
||||
["header_saving"] = "💰 Ersparnisse 💰",
|
||||
["acc_atm"] = "Zugang zu ATM",
|
||||
["acc_bank"] = "Zugang Bank",
|
||||
["acc_trans"] = "Zugriff auf Überweisungen",
|
||||
["acc_saving"] = "Zugang zu Ersparnissen",
|
||||
["acc_boss"] = "Zugriff auf das Firmenkonto",
|
||||
["acc_boss_trans"] = "Zugang zu Firmenkontotransfers",
|
||||
["acc_gang"] = "Zugriff auf das Gangkonto",
|
||||
["acc_gang_trans"] = "Zugang zu Gangkontotransfers",
|
||||
["header_soc"] = "- Firmenkonto -",
|
||||
["header_soc_bank"] = "🏢 Firmen Banking 🏢",
|
||||
["amount_pay"] = "💵 Zu zahlender Betrag'",
|
||||
["give_cash"] = "Jemandem Bargeld geben",
|
||||
["give"] = "Geben",
|
||||
["welcome"] = "Willkommen zurück, ",
|
||||
["citizenid"] = "- Ausweisnummer -",
|
||||
["header_acc"] = "- Konto -",
|
||||
["header_info"] = "- Konto Info -Ersparnis-ID: ",
|
||||
["header_balance_bank"] = "- Kontostand -🏦Bank - $",
|
||||
["header_option"] = "- Optionen -",
|
||||
["cash_balance"] = "💵Bargeld - $",
|
||||
["bank_balance"] = "🏦Bank - $",
|
||||
["saving_balance"] = "- Kontostand -💰Ersparnisses - $",
|
||||
["cus_id"] = "# Kunden ID #",
|
||||
["type"] = "Zahlungsart",
|
||||
["amount_charge"] = "💵 Zu berechnender Betrag",
|
||||
["cash_reg"] = " Registrierkasse",
|
||||
["person_id"] = "# Bürger ID #",
|
||||
["charge"] = " Laden Sie",
|
||||
["send"] = "Send",
|
||||
["receipt"] = " Quittungen 🧾",
|
||||
["payment"] = " Zahlung 🧾",
|
||||
["trade_confirm"] = "Möchten Sie Ihre Quittungen gegen Bezahlung eintauschen??",
|
||||
["accept_payment"] = "Möchten Sie die Zahlung akzeptieren?",
|
||||
["accept_charge"] = "Möchten Sie die Gebühr akzeptieren?",
|
||||
["ticket_amount"] = "Anzahl der Tickets: ",
|
||||
["total_pay"] = "Gesamte Zahlung: $",
|
||||
["confirm"] = "Ja",
|
||||
["yes"] = "Ja",
|
||||
["no"] = "Nein",
|
||||
["cash"] = "Bargeld",
|
||||
["card"] = "Karte",
|
||||
["payment_amount"] = " Zahlung: $",
|
||||
["bank_charge"] = "Bankgebühr: $",
|
||||
},
|
||||
}
|
||||
135
locales/en.lua
Normal file
135
locales/en.lua
Normal file
@@ -0,0 +1,135 @@
|
||||
Loc = Loc or {}
|
||||
|
||||
Loc["en"] = {
|
||||
error = {
|
||||
["cancel"] = "Cancelled",
|
||||
["no_one"] = "No one near by to charge",
|
||||
["not_onduty"] = "Not Clocked in!",
|
||||
["no_job"] = "You don't have the required job",
|
||||
["no_ticket"] = "You don't have any tickets to trade",
|
||||
["bank_low"] = "Bank Balance too low",
|
||||
["no_cash"] = "Not enough cash",
|
||||
["saving_low"] = "Savings Balance too low",
|
||||
["soc_low"] = "Society balance too low",
|
||||
["nomoney_bank"] = "Not enough money in your bank",
|
||||
["error_start"] = "Error: Account '",
|
||||
["error_end"] = "' not found",
|
||||
["not_enough"] = "You don't have enough cash to give",
|
||||
["zero"] = "You can't give $0",
|
||||
["charge_zero"] = "You can't charge $0",
|
||||
["no_ticket_to"] = "No tickets to trade",
|
||||
["customer_nocash"] = "Customer doesn't have enough cash to pay",
|
||||
["you_nocash"] = "You don't have enough cash to pay",
|
||||
["decline_pay"] = " declined the $",
|
||||
["declined_payment"] = "You declined the payment",
|
||||
},
|
||||
success = {
|
||||
["draw"] = "Withdrew $",
|
||||
["from_bank"] = " from the bank",
|
||||
["deposited"] = "Deposited $",
|
||||
["into_bank"] = " into the Bank",
|
||||
["draw_save"] = " Withdrawn from savings into bank account",
|
||||
["depos_save"] = " Deposited from bank account into savings",
|
||||
["fromthe"] = " from the ",
|
||||
["into"] = " into the ",
|
||||
["account"] = " account",
|
||||
["sent"] = "Sent $",
|
||||
["recieved"] = "Recieved $",
|
||||
["to"] = " to ",
|
||||
["from"] = " from ",
|
||||
["you_gave"] = "You gave ",
|
||||
["you_got"] = "You got $",
|
||||
["invoice_start"] = " Paid their $",
|
||||
["invoice_end"] = " invoice",
|
||||
["rec_rec"] = "Receipt received",
|
||||
["commission"] = " in Commission",
|
||||
["trade_ticket_start"] = "Tickets traded: ",
|
||||
["trade_ticket_end"] = " Total: $",
|
||||
["inv_succ"] = "Invoice Successfully Sent",
|
||||
["inv_recieved"] = "New Invoice Received",
|
||||
["declined"] = "You declined the payment",
|
||||
["accepted_pay"] = " accepted the $",
|
||||
["payment"] = " payment",
|
||||
["charged"] = " was charged for $",
|
||||
["you_charged"] = "You were charged for $",
|
||||
["charge_end"] = " charge",
|
||||
},
|
||||
blip = {
|
||||
["blip_atm"] = "ATM",
|
||||
["blip_bank"] = "Bank",
|
||||
},
|
||||
command = {
|
||||
["pay_user"] = "Pay a user nearby",
|
||||
["cash_reg"] = "Use mobile cash register",
|
||||
["charge"] = "Charge another person",
|
||||
},
|
||||
target = {
|
||||
["atm"] = "Use ATM",
|
||||
["bank"] = "Use Bank",
|
||||
["transfer"] = "Transfer Money",
|
||||
["saving"] = "Access Savings",
|
||||
["soc_saving"] = "Access Society Account",
|
||||
["soc_trans"] = "Society Money Transfer",
|
||||
["gang_acct"] = "Gang Society Account",
|
||||
["gang_trans"] = "Gang Money Transfer",
|
||||
["charge"] = "Charge Customer",
|
||||
["cashin_boss"] = "Cash in Job Receipts",
|
||||
["cashin_gang"] = "Cash in Gang Receipts",
|
||||
},
|
||||
menu = {
|
||||
["close"] = "Close",
|
||||
["withdraw"] = "Withdrawal",
|
||||
["deposit"] = "Deposit",
|
||||
["transfer"] = "Transfer",
|
||||
["transfer_money"] = "Transfer Money",
|
||||
["header_atm"] = "💵 ATM Banking 💵",
|
||||
["header_trans_amount"] = "💵 Amount to transfer",
|
||||
["header_bank"] = "🏦 Banking 🏦",
|
||||
["header_trans"] = "🔀 Transfer Services 🔀",
|
||||
["header_account_no"] = "🏦 Account no.",
|
||||
["header_saving"] = "💰 Savings 💰",
|
||||
["acc_atm"] = "Accessing ATM",
|
||||
["acc_bank"] = "Accessing Bank",
|
||||
["acc_trans"] = "Accessing Transfers",
|
||||
["acc_saving"] = "Accessing Savings",
|
||||
["acc_boss"] = "Accessing Society Account",
|
||||
["acc_boss_trans"] = "Accessing Society Transfers",
|
||||
["acc_gang"] = "Accessing Gang Society Account",
|
||||
["acc_gang_trans"] = "Accessing Gang Transfers",
|
||||
["header_soc"] = "Society Account -",
|
||||
["header_soc_bank"] = "Society Banking",
|
||||
["amount_pay"] = "💵 Amount to Pay'",
|
||||
["give_cash"] = "Give someone cash",
|
||||
["give"] = "Give",
|
||||
["welcome"] = "Welcome back, ",
|
||||
["citizenid"] = "Citizen ID -",
|
||||
["header_acc"] = "Account -",
|
||||
["header_info"] = "Account Info - Savings ID: ",
|
||||
["header_balance"] = "Balances -",
|
||||
["header_option"] = "Options -",
|
||||
["cash_balance"] = "💵Cash - $",
|
||||
["bank_balance"] = "🏦Bank - $",
|
||||
["saving_balance"] = "💰Savings - $",
|
||||
["cus_id"] = "# Customer ID #",
|
||||
["type"] = "Payment Type",
|
||||
["amount_charge"] = "💵 Amount to Charge",
|
||||
["cash_reg"] = " Cash Register",
|
||||
["person_id"] = "# Person's ID #",
|
||||
["charge"] = " Charge",
|
||||
["send"] = "Send",
|
||||
["receipt"] = " Receipts 🧾",
|
||||
["payment"] = " Payment 🧾",
|
||||
["trade_confirm"] = "Do you want trade your receipts for payment?",
|
||||
["accept_payment"] = "Do you want accept the payment?",
|
||||
["accept_charge"] = "Do you want accept the charge?",
|
||||
["ticket_amount"] = "Amount of Tickets: ",
|
||||
["total_pay"] = "<br>Total Payment: $",
|
||||
["confirm"] = "Confirm",
|
||||
["yes"] = "Yes",
|
||||
["no"] = "No",
|
||||
["cash"] = "Cash",
|
||||
["card"] = "Card",
|
||||
["payment_amount"] = " Payment: $",
|
||||
["bank_charge"] = "Bank Charge: $",
|
||||
},
|
||||
}
|
||||
151
server.lua
151
server.lua
@@ -1,151 +0,0 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function cv(amount)
|
||||
local formatted = amount
|
||||
while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end Wait(0) end
|
||||
return formatted
|
||||
end
|
||||
|
||||
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() ~= resource then return end
|
||||
for k, v in pairs(Config.Jobs) do if not QBCore.Shared.Jobs[k] then print("Jim-Payments: Config.Jobs searched for job '"..k.."' and couldn't find it in the Shared") end end
|
||||
end)
|
||||
|
||||
QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller)
|
||||
--Find the biller from their citizenid
|
||||
if not biller then
|
||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', biller.PlayerData.source, data.sender.." Paid their $"..data.amount.." invoice", "success")
|
||||
end
|
||||
local duty = true
|
||||
if biller.PlayerData.job.onduty then duty = true else duty = false end
|
||||
if Config.Manage then exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount)
|
||||
if Config.Debug then print("QB-Management: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
||||
else TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), data.amount)
|
||||
if Config.Debug then print("QB-BossMenu: Adding $"..data.amount.." to account '"..tostring(biller.PlayerData.job.name).."'") end
|
||||
end
|
||||
-- If ticket system enabled, do this
|
||||
if duty and Config.TicketSystem then
|
||||
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
|
||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player ~= nil then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddItem('payticket', 1, false, {["quality"] = nil})
|
||||
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, 'Receipt received', 'success')
|
||||
TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Commission section, does each config option separately
|
||||
local comm = tonumber(Config.Jobs[data.society].Commission)
|
||||
if Config.Commission and comm ~= 0 then
|
||||
if Config.CommissionLimit and data.amount < Config.Jobs[data.society].MinAmountforTicket then return end
|
||||
if Config.CommissionDouble then
|
||||
biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * (comm *2)))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * (comm *2)).." in Commission", "success")
|
||||
else biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) *comm))
|
||||
TriggerClientEvent("QBCore:Notify", biller.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
end
|
||||
if Config.CommissionAll then
|
||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local Player = QBCore.Functions.GetPlayer(v)
|
||||
if Player ~= nil and Player ~= biller then
|
||||
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
|
||||
Player.Functions.AddMoney("bank", math.floor(tonumber(data.amount) * comm))
|
||||
TriggerClientEvent("QBCore:Notify", Player.PlayerData.source, "Recieved $"..math.floor(tonumber(data.amount) * comm).." in Commission", "success")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('jim-payments:Tickets:Sell', function()
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if Player.Functions.GetItemByName("payticket") == nil then TriggerClientEvent('QBCore:Notify', source, "No tickets to trade", 'error') return
|
||||
else
|
||||
tickets = Player.Functions.GetItemByName("payticket").amount
|
||||
Player.Functions.RemoveItem('payticket', tickets)
|
||||
pay = (tickets * Config.Jobs[Player.PlayerData.job.name].PayPerTicket)
|
||||
Player.Functions.AddMoney('bank', pay, 'ticket-payment')
|
||||
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['payticket'], "remove", tickets)
|
||||
TriggerClientEvent('QBCore:Notify', source, "Tickets traded: "..tickets.." Total: $"..cv(pay), 'success')
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb)
|
||||
if QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket') == nil then amount = 0
|
||||
else amount = QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket').amount end
|
||||
cb(amount)
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside)
|
||||
local src = source
|
||||
local biller = QBCore.Functions.GetPlayer(src)
|
||||
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
|
||||
local amount = tonumber(price)
|
||||
local balance = billed.Functions.GetMoney(billtype)
|
||||
if amount and amount > 0 then
|
||||
if balance < amount then
|
||||
TriggerClientEvent("QBCore:Notify", src, "Customer doesn't have enough cash to pay", "error")
|
||||
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
|
||||
return
|
||||
end
|
||||
if billtype == "cash" then
|
||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
||||
elseif billtype == "bank" then
|
||||
if Config.PhoneBank == false then
|
||||
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, biller.PlayerData.job.label)
|
||||
else
|
||||
if Config.PhoneType == "qb" then
|
||||
MySQL.Async.insert(
|
||||
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
|
||||
{billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
|
||||
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
|
||||
elseif Config.PhoneType == "gks" then
|
||||
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid)', {
|
||||
['@citizenid'] = billed.PlayerData.citizenid,
|
||||
['@amount'] = amount,
|
||||
['@society'] = biller.PlayerData.job.name,
|
||||
['@sender'] = biller.PlayerData.charinfo.firstname,
|
||||
['@sendercitizenid'] = biller.PlayerData.citizenid
|
||||
})
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', src, 'Invoice Successfully Sent', 'success')
|
||||
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
|
||||
end
|
||||
end
|
||||
else TriggerClientEvent('QBCore:Notify', source, "You can't charge $0", 'error') return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("jim-payments:server:PayPopup", function(data)
|
||||
local src = source
|
||||
local billed = QBCore.Functions.GetPlayer(src)
|
||||
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
|
||||
local newdata = { senderCitizenId = biller.PlayerData.citizenid, society = biller.PlayerData.job.name, amount = data.amount }
|
||||
if data.accept == true then
|
||||
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
|
||||
TriggerEvent('jim-payments:Tickets:Give', newdata, biller)
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." accepted the $"..data.amount.." payment", "success")
|
||||
elseif data.accept == false then
|
||||
TriggerClientEvent("QBCore:Notify", src, "You declined the payment")
|
||||
TriggerClientEvent("QBCore:Notify", data.biller, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount.." payment", "error")
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, cb)
|
||||
local onlineList = {}
|
||||
for k, v in pairs(QBCore.Functions.GetPlayers()) do
|
||||
local P = QBCore.Functions.GetPlayer(v)
|
||||
onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname }
|
||||
end
|
||||
cb(onlineList)
|
||||
end)
|
||||
266
server/atmserver.lua
Normal file
266
server/atmserver.lua
Normal file
@@ -0,0 +1,266 @@
|
||||
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
|
||||
local Player = getPlayer(src)
|
||||
local amount = tonumber(amount)
|
||||
local bankScript, newAmount = "", 0
|
||||
|
||||
--Simple transfers from bank to wallet --
|
||||
if account == "bank" or account == "atm" then
|
||||
if billtype == "withdraw" then
|
||||
if Player.bank < amount then
|
||||
triggerNotify(nil, locale("error" ,"bank_low"), "error", src)
|
||||
elseif Player.bank >= tonumber(amount) then
|
||||
triggerNotify(nil, locale("success" ,"draw")..cv(amount)..locale("success" ,"from_bank"), "success") -- Don't really need this as phone gets notified when money is withdrawn
|
||||
chargePlayer(amount, "bank", src) Wait(1500)
|
||||
fundPlayer(amount, "cash", src)
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if Player.cash < amount then
|
||||
triggerNotify(nil, locale("error" ,"no_cash"), "error", src)
|
||||
elseif Player.cash >= amount then
|
||||
chargePlayer(amount, "cash", src) Wait(1500)
|
||||
fundPlayer(amount, "bank", src)
|
||||
triggerNotify(nil, locale("success" ,"deposited")..cv(amount)..locale("success" ,"into_bank"), "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfers from bank to savings account --
|
||||
elseif account == "savings" then
|
||||
local getSavingsAccount = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_name = ?', { Player.citizenId, 'Savings_'..Player.citizenId, })
|
||||
if getSavingsAccount[1] ~= nil then savbal = tonumber(getSavingsAccount[1].account_balance) aid = getSavingsAccount[1].citizenid end
|
||||
|
||||
if billtype == "withdraw" then
|
||||
if savbal >= amount then
|
||||
savbal -= amount
|
||||
fundPlayer(amount, "cash", src)
|
||||
triggerNotify(nil, "$"..cv(amount)..locale("success" ,"draw_save"), "success", src)
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.citizenId }, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
elseif savbal < amount then
|
||||
triggerNotify(nil, locale("error" ,"saving_low"), "error")
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if amount < Player.bank then
|
||||
savbal += amount
|
||||
chargePlayer(amount, "bank", src)
|
||||
triggerNotify(nil, "$"..cv(amount)..locale("success", "depos_save"), "success", src)
|
||||
MySQL.Async.execute('UPDATE bank_accounts SET account_balance = ? WHERE citizenid = ?', { savbal, Player.citizenId}, function(success)
|
||||
if success then return true else return false end
|
||||
end)
|
||||
else triggerNotify(nil, locale("error" ,"bank_low"), "error", src)
|
||||
end
|
||||
end
|
||||
--Simple transfers from society account to bank --
|
||||
elseif account == "society" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(society) < amount then
|
||||
triggerNotify(nil, locale("error" ,"soc_low"), "error", src)
|
||||
elseif tonumber(society) >= amount then
|
||||
|
||||
chargeSociety(Player.job, amount)
|
||||
fundPlayer(amount, "bank", src)
|
||||
|
||||
triggerNotify(nil, locale("success", "draw")..cv(amount)..locale("success", "fromthe")..Jobs[Player.job].label..locale("success" ,"account"), "success", src)
|
||||
end
|
||||
elseif billtype == "deposit" then
|
||||
if Player.bank < amount then triggerNotify(nil, locale("error", "nomoney_bank"), "error", src)
|
||||
elseif Player.bank >= amount then
|
||||
fundSociety(Player.job, amount)
|
||||
chargePlayer(amount, "bank", src) Wait(1500)
|
||||
triggerNotify(nil, locale("success", "deposited")..cv(amount)..locale("success", "into")..Jobs[Player.job].label..locale("success", "account"), "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfer from boss account to players --
|
||||
--[[ disabled until i work out a system for other frameworks
|
||||
elseif account == "societytransfer" then
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for _, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = Core.Functions.GetPlayer(src)
|
||||
if (society - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = Core.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
if Config.Banking == "renewed" then
|
||||
exports['Renewed-Banking']:removeAccountMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "qb-management" then
|
||||
exports["qb-management"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "qb-banking" then
|
||||
exports["qb-banking"]:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
elseif Config.Banking == "fd" then
|
||||
exports.fd_banking:RemoveMoney(tostring(Player.PlayerData.job.name), amount)
|
||||
end
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
triggerNotify(nil, locale("success" ,"sent"]..amount..locale("success" ,"to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, locale("success" ,"recieved"]..cv(amount)..locale("success" ,"from"]..tostring(Player.PlayerData.job.label)..locale("success" ,"account"], "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank += amount
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then triggerNotify(nil, locale("error" ,"error_start"]..baccount..locale("error" ,"error_end"], "error", src)
|
||||
end
|
||||
end]]
|
||||
|
||||
--Simple transfers from gang society account to bank --
|
||||
elseif account == "gang" then
|
||||
if billtype == "withdraw" then
|
||||
if tonumber(gsociety) < amount then
|
||||
triggerNotify(nil, locale("error" ,"soc_low"), "error", src)
|
||||
elseif tonumber(gsociety) >= amount then
|
||||
chargeSociety(Player.gang, amount)
|
||||
end
|
||||
|
||||
fundPlayer(amount, "bank", src)
|
||||
triggerNotify(nil, locale("success" ,"draw")..cv(amount)..locale("success" ,"fromthe")..Gangs[Player.gang].label..locale("success" ,"account"), "success", src)
|
||||
|
||||
elseif billtype == "deposit" then
|
||||
if Player.bank < amount then
|
||||
triggerNotify(nil, locale("error" ,"nomoney_bank"), "error", src)
|
||||
elseif Player.bank >= amount then
|
||||
fundSociety(Player.gang, amount)
|
||||
chargePlayer(amount, "bank", Player.source) Wait(1500)
|
||||
triggerNotify(nil, locale("success" ,"deposited")..cv(amount)..locale("success" ,"into")..Gangs[Player.gang].label..locale("success" ,"account"), "success", src)
|
||||
end
|
||||
end
|
||||
-- Transfer from gang account to players --
|
||||
elseif account == "gangtransfer" then
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for _, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = Core.Functions.GetPlayer(src)
|
||||
if (gsociety - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = Core.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
chargeSociety(Player.PlayerData.gang.nameg, amount)
|
||||
if not Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
triggerNotify(nil, locale("success" ,"sent")..amount..locale("success" ,"to")..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, Reciever.PlayerData.source, locale("success" ,"recieved")..cv(amount)..locale("success" ,"from")..tostring(Player.PlayerData.gang.label)..locale("success" ,"account"), "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank += amount
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then triggerNotify(nil, locale("error" ,"error_start")..baccount..locale("error" ,"error_end"), "error", src)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
elseif account == "transfer" then
|
||||
local bannedCharacters = {'%','$',';'}
|
||||
local newAmount = tostring(amount)
|
||||
local newiban = tostring(baccount)
|
||||
for _, v in pairs(bannedCharacters) do
|
||||
newAmount = string.gsub(newAmount, '%' .. v, '')
|
||||
newiban = string.gsub(newiban, '%' .. v, '')
|
||||
end
|
||||
baccount = newiban
|
||||
amount = tonumber(newAmount)
|
||||
|
||||
local Player = Core.Functions.GetPlayer(src)
|
||||
if (Player.PlayerData.money.bank - amount) >= 0 then
|
||||
local query = '%"account":"' .. baccount .. '"%'
|
||||
local result = MySQL.Sync.fetchAll('SELECT * FROM players WHERE charinfo LIKE ?', {query})
|
||||
if result[1] then
|
||||
local Reciever = Core.Functions.GetPlayerByCitizenId(result[1].citizenid)
|
||||
Player.Functions.RemoveMoney('bank', amount)
|
||||
if Reciever then
|
||||
Reciever.Functions.AddMoney('bank', amount)
|
||||
triggerNotify(nil, locale("success" ,"sent")..cv(amount)..locale("success" ,"to")..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
|
||||
triggerNotify(nil, locale("success" ,"recieved")..cv(amount)..locale("success" ,"from")..Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname, "success", Reciever.PlayerData.source)
|
||||
else
|
||||
local RecieverMoney = json.decode(result[1].money)
|
||||
RecieverMoney.bank += amount
|
||||
MySQL.Async.execute('UPDATE players SET money = ? WHERE citizenid = ?', {json.encode(RecieverMoney), result[1].citizenid})
|
||||
end
|
||||
elseif not result[1] then
|
||||
triggerNotify(nil, locale("error" ,"error_start")..baccount..locale("error" ,"error_end"), "error", src)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:ATM:give", function(citizen, price)
|
||||
local Player = getPlayer(source)
|
||||
local Reciever = getPlayer(tonumber(citizen))
|
||||
local amount = tonumber(price)
|
||||
local balance = Player.cash
|
||||
|
||||
if amount and amount > 0 then
|
||||
if balance >= amount then
|
||||
chargePlayer(amount, "cash", source)
|
||||
triggerNotify(nil, locale("success" ,"you_gave")..Reciever.name.." $"..cv(amount), "success", source)
|
||||
fundPlayer(amount, "cash", Reciever.source)
|
||||
triggerNotify(nil, locale("success" ,"you_got")..cv(amount)..locale("success" ,"from")..Player.name, "success", tonumber(citizen))
|
||||
elseif balance < amount then
|
||||
triggerNotify(nil, locale("error" ,"not_enough"), "error", source)
|
||||
end
|
||||
else triggerNotify(nil, locale("error" ,"zero"), 'error', source) end
|
||||
end)
|
||||
|
||||
99
server/chargerserver.lua
Normal file
99
server/chargerserver.lua
Normal file
@@ -0,0 +1,99 @@
|
||||
onResourceStart(function()
|
||||
for k in pairs(Config.Receipts.Jobs) do
|
||||
while not Jobs do Wait(10) end
|
||||
if not Jobs[k] and not Gangs[k] then
|
||||
debugPrint("^1Error^7: ^5Config^7.^5Receipts^7.^5Jobs ^2searched for job/gang ^7'^3"..k.."^7' ^2and couldn't find it in the Shared^7")
|
||||
end
|
||||
end
|
||||
|
||||
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)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:Charge", function(citizen, price, billtype, img, outside, gang)
|
||||
local src = source
|
||||
local biller = getPlayer(src)
|
||||
local billed = getPlayer(tonumber(citizen))
|
||||
local amount = tonumber(price)
|
||||
local balance = billed[billtype]
|
||||
if amount and amount > 0 then
|
||||
if balance < amount then
|
||||
triggerNotify(nil, locale("error", "customer_nocash"), "error", src)
|
||||
triggerNotify(nil, locale("error", "you_nocash"), "error", tonumber(citizen))
|
||||
return
|
||||
end
|
||||
local label = gang == true and Gangs[biller.gang].label or Jobs[biller.job].label
|
||||
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 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
|
||||
end
|
||||
else triggerNotify(nil, locale("error", "charge_zero"), 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:PayPopup", function(data)
|
||||
local src = source
|
||||
local billed = getPlayer(src)
|
||||
local biller = getPlayer(tonumber(data.biller))
|
||||
local newdata = {
|
||||
senderCitizenId = biller.citizenid,
|
||||
society = data.gang and biller.gang or biller.job,
|
||||
amount = data.amount
|
||||
}
|
||||
if data.accept then
|
||||
chargePlayer(data.amount, data.billtype, src)
|
||||
if Config.General.ApGov then
|
||||
exports['ap-government']:chargeCityTax(billed.source, "Item", data.amount)
|
||||
end
|
||||
TriggerEvent(getScript()..":Tickets:Give", newdata, biller, data.gang)
|
||||
triggerNotify(nil, billed.firstname..locale("success", "accepted_pay")..data.amount..locale("success", "payment"), "success", data.biller)
|
||||
elseif not data.accept then
|
||||
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)
|
||||
100
server/polchargeserver.lua
Normal file
100
server/polchargeserver.lua
Normal file
@@ -0,0 +1,100 @@
|
||||
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
|
||||
local biller = getPlayer(src)
|
||||
local billed = getPlayer(tonumber(citizen))
|
||||
local price = math.floor(tonumber(price))
|
||||
|
||||
local commPercent = Config.PolCharge.FineJobs[biller.job] and Config.PolCharge.FineJobs[biller.job].Commission or 0.25
|
||||
|
||||
local commission = math.floor(price * commPercent)
|
||||
|
||||
if price > 0 then
|
||||
if not Config.PolCharge.FineJobConfirmation then
|
||||
polCharge({
|
||||
biller = biller,
|
||||
billed = billed,
|
||||
price = price,
|
||||
commission = commission,
|
||||
billerJob = tostring(biller.job),
|
||||
amountChange = (price - commission)
|
||||
})
|
||||
|
||||
triggerNotify(nil, billed.firstname..locale("success", "charged")..(price - commission), "success", src)
|
||||
triggerNotify(nil, locale("success", "you_charged")..(price - commission), nil, billed.source)
|
||||
else
|
||||
TriggerClientEvent(getScript()..":client:PolPopup", billed.source, price, src, biller.job, commPercent)
|
||||
end
|
||||
else triggerNotify(nil, locale("error", "charge_zero"), 'error', source) return end
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":server:PolPopup", function(data)
|
||||
local src = source
|
||||
local billed = getPlayer(src)
|
||||
local biller = getPlayer(tonumber(data.biller))
|
||||
local price = math.floor(data.amount)
|
||||
local commission = math.floor(tonumber(data.amount) * data.commPercent)
|
||||
if data.accept then
|
||||
polCharge({
|
||||
biller = biller,
|
||||
billed = billed,
|
||||
price = price,
|
||||
commission = commission,
|
||||
billerJob = tostring(biller.job),
|
||||
amountChange = (price - commission)
|
||||
})
|
||||
elseif not data.accept then
|
||||
triggerNotify(nil, locale("error", "declined_payment"), nil, src)
|
||||
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount..locale("success", "charge_end"), "error", data.biller)
|
||||
end
|
||||
end)
|
||||
|
||||
function polCharge(data)
|
||||
local billedSource, billerSource, newAmount = data.billed.source, data.biller.source, 0
|
||||
local bankScript = nil
|
||||
|
||||
chargePlayer(data.price, "bank", billedSource)
|
||||
debugPrint("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billedSource.."^7) ^2charged ^7$^6"..data.price.."^7")
|
||||
|
||||
if Config.ApGov then
|
||||
exports['ap-government']:chargeCityTax(billedSource, "Item", data.price)
|
||||
end
|
||||
|
||||
fundPlayer(data.commission, "bank", billerSource)
|
||||
debugPrint("^5Debug^7: ^3PolCharge^7 - ^2Commission of ^7$^6"..data.commission.." ^2sent to Player^7(^6"..billerSource.."^7)")
|
||||
|
||||
if isStarted("Renewed-Banking") then
|
||||
bankScript = "Renewed-Banking"
|
||||
exports["Renewed-Banking"]:addAccountMoney(data.billerJob, data.amountChange)
|
||||
newAmount = exports["Renewed-Banking"]:getAccountMoney(data.billerJob)
|
||||
|
||||
elseif isStarted("qb-banking") then
|
||||
bankScript = "qb-banking"
|
||||
exports["qb-banking"]:AddMoney(data.billerJob, data.amountChange, "Cash Register Payment")
|
||||
newAmount = exports["qb-banking"]:GetAccountBalance(data.billerJob)
|
||||
|
||||
elseif isStarted("fd_banking") then
|
||||
bankScript = "fd_banking"
|
||||
if gang then
|
||||
exports["fd_banking"]:AddGangMoney(data.billerJob, data.amountChange)
|
||||
newAmount = exports["fd_banking"]:GetGangAccount(data.billerJob)
|
||||
else
|
||||
exports["fd_banking"]:AddMoney(data.billerJob, data.amountChange)
|
||||
newAmount = exports["fd_banking"]:GetAccount(data.billerJob)
|
||||
end
|
||||
elseif isStarted("okokBanking") then
|
||||
bankScript = "okokBanking"
|
||||
exports['okokBanking']:AddMoney(data.billerJob, data.amountChange)
|
||||
newAmount = exports['okokBanking']:GetAccount(data.billerJob)
|
||||
end
|
||||
|
||||
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3Job^7): ^2Adding ^7$"..data.amountChange.." ^2to account ^7'^6"..data.billerJob.."^7' ($"..newAmount..")")
|
||||
end
|
||||
121
server/ticketserver.lua
Normal file
121
server/ticketserver.lua
Normal file
@@ -0,0 +1,121 @@
|
||||
RegisterServerEvent(getScript()..":Tickets:Give", function(data, biller, gang)
|
||||
local src = source
|
||||
local activePlayers = GetPlayers()
|
||||
local commPercent = 0
|
||||
jsonPrint(data)
|
||||
|
||||
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
|
||||
local amountChange, newAmount = (data.amount - takecomm), 0
|
||||
local society = gang and tostring(biller.gang) or tostring(biller.job)
|
||||
local bankScript = nil
|
||||
if isStarted("Renewed-Banking") then
|
||||
bankScript = "Renewed-Banking"
|
||||
exports["Renewed-Banking"]:addAccountMoney(society, amountChange)
|
||||
newAmount = exports["Renewed-Banking"]:getAccountMoney(society)
|
||||
|
||||
elseif isStarted("qb-banking") then
|
||||
bankScript = "qb-banking"
|
||||
exports["qb-banking"]:AddMoney(society, amountChange, "Cash Register Payment")
|
||||
newAmount = exports["qb-banking"]:GetAccountBalance(society)
|
||||
|
||||
elseif isStarted("fd_banking") then
|
||||
bankScript = "fd_banking"
|
||||
if gang then
|
||||
exports["fd_banking"]:AddGangMoney(society, amountChange)
|
||||
newAmount = exports["fd_banking"]:GetGangAccount(society)
|
||||
else
|
||||
exports["fd_banking"]:AddMoney(society, amountChange)
|
||||
newAmount = exports["fd_banking"]:GetAccount(society)
|
||||
end
|
||||
elseif isStarted("okokBanking") then
|
||||
bankScript = "okokBanking"
|
||||
exports['okokBanking']:AddMoney(society, amountChange)
|
||||
newAmount = exports['okokBanking']:GetAccount(society)
|
||||
end
|
||||
|
||||
debugPrint("^5Debug^7: ^3"..bankScript.."^7(^3"..(gang and "Gang" or "Job").."^7): ^2Adding ^7$"..amountChange.." ^2to account ^7'^6"..society.."^7' ($"..newAmount..")")
|
||||
elseif not biller then --Find the biller from their citizenid
|
||||
for _, v in pairs(activePlayers) do
|
||||
local Player = getPlayer(v)
|
||||
if Player.citizenid == data.senderCitizenId then
|
||||
biller = Player
|
||||
end
|
||||
end
|
||||
triggerNotify(nil, data.sender..locale("success", "invoice_start")..data.amount..locale("success", "invoice_end"), "success", biller.source)
|
||||
end
|
||||
|
||||
-- If ticket system enabled, do this
|
||||
if (biller.onDuty or gang) and Config.Receipts.TicketSystem then
|
||||
if not Config.Receipts.Jobs[data.society] then
|
||||
print("^1Error^7: Failed to find job "..data.society.." in ^2Config.Receipts.Jobs^7")
|
||||
return
|
||||
end
|
||||
if data.amount >= Config.Receipts.Jobs[data.society].MinAmountforTicket then
|
||||
if Config.Receipts.TicketSystemAll then
|
||||
for _, v in pairs(activePlayers) do
|
||||
local Player = getPlayer(v)
|
||||
if v ~= src then
|
||||
if gang then
|
||||
if Player.gang == data.society then
|
||||
addItem("payticket", 1, nil, Player.source)
|
||||
triggerNotify(nil, locale("success", "rec_rec"), 'success', Player.source)
|
||||
end
|
||||
else
|
||||
if Player.job == data.society and Player.onDuty then
|
||||
print("player on duty, giving tickets")
|
||||
addItem("payticket", 1, nil, Player.source)
|
||||
triggerNotify(nil, locale("success", "rec_rec"), 'success', Player.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
addItem("payticket", 1, nil, biller.source)
|
||||
triggerNotify(nil, locale("success", "rec_rec"), 'success', biller.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Commission section, does each config option separately
|
||||
local comm = tonumber(Config.Receipts.Jobs[data.society].Commission)
|
||||
if Config.Receipts.Commission and comm ~= 0 then
|
||||
if Config.Receipts.CommissionLimit and data.amount < Config.Receipts.Jobs[data.society].MinAmountforTicket then return end
|
||||
if Config.Receipts.CommissionDouble then
|
||||
fundPlayer(math.floor(tonumber(data.amount) * (comm *2)), "bank", biller.source)
|
||||
triggerNotify(nil, locale("success", "recieved")..math.floor(tonumber(data.amount) * (comm *2))..locale("success", "commission"), "success", biller.source)
|
||||
else
|
||||
fundPlayer(math.floor(tonumber(data.amount) *comm), "bank", biller.source)
|
||||
triggerNotify(nil, locale("success", "recieved")..math.floor(tonumber(data.amount) * comm)..locale("success", "commission"), "success", biller.source)
|
||||
end
|
||||
if Config.Receipts.CommissionAll then
|
||||
for _, v in pairs(activePlayers) do
|
||||
local Player = getPlayer(v)
|
||||
if v ~= biller.source then
|
||||
if Player.job == data.society and Player.onDuty then
|
||||
fundPlayer(math.floor(tonumber(data.amount) * comm), "bank", Player.source)
|
||||
triggerNotify(nil, locale("success", "recieved")..math.floor(tonumber(data.amount) * comm)..locale("success", "commission"), "success", Player.source)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent(getScript()..":Tickets:Sell", function() local src = source
|
||||
local Player = getPlayer(src)
|
||||
local hasItem, hasTable = hasItem("payticket", 1, src)
|
||||
if not hasItem then
|
||||
triggerNotify(nil, locale("error", "no_ticket_to"), 'error', src)
|
||||
return
|
||||
else
|
||||
local tickets = hasTable["payticket"].count
|
||||
removeItem("payticket", tickets, src)
|
||||
local pay = (tickets * Config.Receipts.Jobs[Player.job].PayPerTicket)
|
||||
fundPlayer(pay, "bank", src)
|
||||
triggerNotify(nil, locale("success", "trade_ticket_start")..tickets..locale("success", "trade_ticket_end")..cv(pay), 'success', src)
|
||||
end
|
||||
end)
|
||||
65
shared/banklocs.lua
Normal file
65
shared/banklocs.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
BankLocations = {
|
||||
["legion"] = {
|
||||
vec4(149.5, -1042.08, 29.37, 342.74), -- Legion Fleeca
|
||||
},
|
||||
["hawick"] = {
|
||||
vec4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
|
||||
},
|
||||
["vinewood"] = {
|
||||
vec4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
|
||||
},
|
||||
["delperro"] = {
|
||||
vec4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
|
||||
},
|
||||
["route1"] = {
|
||||
vec4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
|
||||
},
|
||||
["route68"] = {
|
||||
vec4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
|
||||
},
|
||||
["paleto"] = {
|
||||
vec4(-111.22, 6470.03, 31.63, 133.86), -- Paleto Bank
|
||||
},
|
||||
["pacific"] = {
|
||||
vec4(243.58, 226.25, 106.29, 169.06), -- Pacific Bank Window 1
|
||||
vec4(247.08, 224.98, 106.29, 157.75), -- Pacific Bank Window 2
|
||||
},
|
||||
}
|
||||
|
||||
if Config.General.Gabz then
|
||||
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
|
||||
},
|
||||
["hawick"] = {
|
||||
vec4(313.81, -280.43, 54.16, 342.29), -- Hawick Fleeca
|
||||
},
|
||||
["vinewood"] = {
|
||||
vec4(-351.4, -51.24, 49.04, 338.4), -- Vinewood Fleeca
|
||||
},
|
||||
["delperro"] = {
|
||||
vec4(-1212.11, -332.01, 37.78, 25.33), -- Del Perro Fleeca
|
||||
},
|
||||
["route1"] = {
|
||||
vec4(-2961.17, 482.9, 15.7, 84.68), -- Route 1 Fleeca
|
||||
},
|
||||
["route68"] = {
|
||||
vec4(1175.03, 2708.2, 38.09, 180.0), -- Route 68 Fleeca
|
||||
},
|
||||
["paleto"] = {
|
||||
vec4(-110.72, 6469.82, 31.63, 222.94), -- Paleto Bank (GABZ) - 1
|
||||
vec4(-108.98, 6471.56, 31.63, 222.92), -- Paleto Bank (GABZ) - 2
|
||||
},
|
||||
["pacific"] = {
|
||||
vec4(258.55, 227.63, 106.28, 160.96), -- Pacficic Gabz 1+2
|
||||
vec4(263.21, 225.93, 106.28, 158.25), -- Pacficic Gabz 3+4
|
||||
vec4(267.95, 224.24, 106.28, 158.5), -- Pacficic Gabz 5+6
|
||||
vec4(263.71, 212.63, 106.28, 337.53), -- Pacficic Gabz 7+8
|
||||
vec4(259.02, 214.32, 106.28, 337.82), -- Pacficic Gabz 9+10
|
||||
vec4(254.27, 216.06, 106.28, 336.37), -- Pacficic Gabz 11+12
|
||||
},
|
||||
}
|
||||
end
|
||||
6
version.txt
Normal file
6
version.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
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