159 Commits

Author SHA1 Message Date
Jim Shield
71a6d4d7dd Merge pull request #13 from jimathy/v2.8.4
v2.8.4
2022-10-08 19:48:02 +01:00
Jim Shield
fc902b34e2 v2.8.4 - Reset default config.lua 2022-10-08 19:46:31 +01:00
Jim Shield
89fa06507b v2.8.4 - Fix logic of the ticket systems 2022-10-08 19:43:57 +01:00
Jim Shield
61e2e6f32e v2.8.4 - Discontinue support for qb-bossmenu 2022-10-08 19:26:21 +01:00
Jim Shield
ec40bd5cf1 v2.8.3 - Renewed's QB-Phone support 2022-09-20 21:06:56 +01:00
Jim Shield
70f2ed8005 2.8.2 - Fix renewed banking support + debug prints 2022-09-19 09:20:55 +01:00
Jim Shield
f0f5f19af8 v2.8.1 - Support added for Renewed-Banking + lua54 2022-09-18 15:32:10 +01:00
Jim Shield
939026fd68 Revert "Version 1.8.1 - Support added for Renewed Banking"
This reverts commit de4e6ad312.
2022-09-18 15:30:31 +01:00
Jim Shield
de4e6ad312 Version 1.8.1 - Support added for Renewed Banking 2022-09-18 15:29:47 +01:00
Jim Shield
492bd53593 locale fix 2022-09-11 22:43:20 +01:00
Jim Shield
10fde7e6da Merge pull request #10 from AbrahamMoody/patch-1
Create de.lua
2022-09-05 22:58:15 +01:00
AbrahamMoody
8888fcdd9e Create de.lua
German Language for jim-payments
2022-09-04 01:10:43 +02:00
Jim Shield
2a86032299 Merge pull request #9 from vosscat/main
Locale Support
2022-09-03 20:32:25 +01:00
Jim Shield
92ba44355a Add support for AP-Goverment Tax 2022-09-03 20:25:11 +01:00
Jim Shield
1012e12d1e Support for Ap-Goverment tax 2022-09-03 20:06:37 +01:00
Vosscat
97b54cd482 Locale Support 2022-09-02 21:03:02 +08:00
Vosscat
fadb40e66d Locale Support 2022-09-02 21:02:26 +08:00
Vosscat
2bebb0c11f Locale Support 2022-09-02 21:01:40 +08:00
Vosscat
cb358f55b0 Locale Support 2022-09-02 21:00:52 +08:00
Vosscat
eed7fae066 Locale Support 2022-09-02 20:04:22 +08:00
Vosscat
5a6faf8337 Locale Support 2022-09-02 19:36:09 +08:00
Vosscat
ecec448d30 Locale Support 2022-09-02 19:25:19 +08:00
Jim Shield
e28975d40b fix script finding no tickets to trade 2022-08-25 17:15:43 +01:00
Jim Shield
235e3d187c Fix ticket amount coming back as nil 2022-08-25 17:10:25 +01:00
Jim Shield
47dfcca052 Fix support for older versions of qb-target 2022-08-23 16:45:53 +01:00
Jim Shield
a07382cca3 fix prop location loading 2022-08-23 16:44:55 +01:00
Jim Shield
7b0757214b fucking debug mode 2022-08-22 22:18:42 +01:00
Jim Shield
42f80fae77 Merge pull request #8 from jimathy/jimathy-v2.8-patch
Jimathy v2.8 patch
2022-08-22 22:17:45 +01:00
Jim Shield
c9ac3e8bbd remove toggleItem(), not needed 2022-08-22 22:17:19 +01:00
Jim Shield
8fcde5867c triggerNotify() 2022-08-22 22:13:56 +01:00
Jim Shield
6b4c6a6779 keep gks info up to date 2022-08-22 21:58:38 +01:00
Jim Shield
55a25b59ac Add commission to be taken as standard 2022-08-22 21:49:53 +01:00
Jim Shield
c136af4244 Fix "till" error on restart 2022-08-22 21:48:36 +01:00
Jim Shield
858c865b8b move server.lua to /server 2022-08-22 21:33:48 +01:00
Jim Shield
2c25faf2af move client.lua to /client 2022-08-22 21:33:39 +01:00
Jim Shield
ee2bfaaeca move atmserver.lua to /server 2022-08-22 21:33:27 +01:00
Jim Shield
ab1096f977 move atms.lua to /client 2022-08-22 21:33:11 +01:00
Jim Shield
3e9aa9676d Optimize, refactor and tidy 2022-08-22 21:32:15 +01:00
Jim Shield
3117ef68af Fix gks install info 2022-08-03 10:01:38 +01:00
Jim Shield
2c1f1e8573 Small banking changes 2022-07-28 19:35:35 +01:00
Jim Shield
d71f3d29ed Add files via upload 2022-07-28 18:34:17 +01:00
Jim Shield
df640a1a08 I hate github announces 1 letter changes 2022-07-28 18:06:20 +01:00
Jim Shield
8c1a6a11cc ran out of indents 2022-07-28 18:05:13 +01:00
Jim Shield
e2712da4b0 Update README.md 2022-07-28 18:00:45 +01:00
Jim Shield
95eda3b471 Quick rearrange of preview images 2022-07-28 16:00:21 +01:00
Jim Shield
120dae8066 Update README.md 2022-07-28 15:56:57 +01:00
Jim Shield
0990422823 Re-order the config to make more sense 2022-07-28 11:10:00 +01:00
Jim Shield
475ae9f827 typo fix 2022-07-19 14:53:34 +01:00
Jim Shield
9c1953ab92 Custom cash register spawning support built in 2022-07-19 14:52:02 +01:00
Jim Shield
d77d23e635 polcharge fixes 2022-07-16 09:21:12 +01:00
Jim Shield
2a67217155 Hotfix for confirmation polcharge's 2022-07-13 18:28:36 +01:00
Jim Shield
df43549e08 fucking stay false 2022-07-13 18:12:52 +01:00
Jim Shield
91a0cadad7 Polcharge Commission now taken from society charge 2022-07-13 18:09:08 +01:00
Jim Shield
8cf1de1cf9 server print new society balance in debug mode 2022-07-13 17:36:45 +01:00
Jim Shield
b543803194 PolCharge fixes + debug 2022-07-11 19:59:57 +01:00
Jim Shield
da1a19eb2c Config options to recommended defaults 2022-07-05 19:55:40 +01:00
Jim Shield
41bedcc6ca /polcharge for police billing + Optimize + Fixes 2022-07-05 19:52:33 +01:00
Jim Shield
a4413ea5c6 Stop asking me about gks-phone 2022-07-04 00:04:35 +01:00
Jim Shield
8adf3c3829 Stop giving the charged person tickets 2022-06-22 14:34:24 +01:00
Jim Shield
f5753df4b2 rollback notification changes 2022-06-22 14:20:36 +01:00
Jim Shield
ec9dc51ccf Quick fix for job tickets 2022-06-21 15:18:01 +01:00
Jim Shield
4b028d75b1 Gang Support in cash registers 2022-06-21 15:11:31 +01:00
Jim Shield
2302ff987b I hate github 2022-06-21 15:11:02 +01:00
Jim Shield
d29d2d6904 Gang support for cash regsiters 2022-06-21 15:10:35 +01:00
Jim Shield
f535df6b9c Rollback code to fix notification breaking 2022-06-16 00:03:10 +01:00
Jim Shield
170f680ef8 Update/Fix gks install support info 2022-06-15 20:24:38 +01:00
Jim Shield
2fc3b56e22 Rollback 2022-06-10 14:35:46 +01:00
Jim Shield
a18db3d6b9 Trying to fix inventory space checks 2022-06-10 14:32:05 +01:00
Jim Shield
da5e4c604f Tiny optimization 2022-06-08 22:15:39 +01:00
Jim Shield
284700bafb Fix for double phone payments 2022-06-06 20:42:02 +01:00
Jim Shield
ee532d5e3e Improved support of gks-phone 2022-05-23 17:19:49 +01:00
Jim Shield
c63fbc7144 Version Bump + small formatting changes 2022-05-21 11:36:51 +01:00
Jim Shield
c3d6425476 Better account loading + ps-progressbar support 2022-05-21 11:23:36 +01:00
Jim Shield
eb31c78bc6 qb-menu icon support 2022-05-21 11:01:47 +01:00
jimathy
d78fdf85df Add notify for phone payments being accepted 2022-05-18 11:18:07 +01:00
jimathy
05d4dfc984 /cashregister command now usable for outside payments
Jimathy patch 1
2022-05-05 21:42:17 +01:00
jimathy
100323927e Explanation of new duty variables 2022-05-05 21:39:09 +01:00
jimathy
35e166d049 don't need the variable here 2022-05-05 21:37:45 +01:00
jimathy
9a14e004e9 Attempting restricted payments outside of job 2022-05-05 21:34:34 +01:00
jimathy
dbd3f33099 Update README.md 2022-05-05 10:50:10 +01:00
jimathy
89b0549090 Fix Bossmeny support for banking 2022-05-04 20:44:57 +01:00
jimathy
0afbee61e0 Fix Invoices not going to society accounts 2022-05-04 10:17:43 +01:00
jimathy
d1ee4dbf8c Merge pull request #6 from jimathy/jimathy-patch-2
Debug Missing Jobs
2022-04-25 10:06:03 +01:00
jimathy
8af82e6d13 Don't break if job isn't found 2022-04-25 10:04:56 +01:00
jimathy
2e4fcff333 Debug for missing jobs in config 2022-04-25 10:01:51 +01:00
jimathy
a1fd2d5974 Config.Gabz default false 2022-04-24 11:27:10 +01:00
jimathy
a256b5e2f9 Banking Ped spawn location on the floor 2022-04-24 11:15:24 +01:00
jimathy
7a24a8836d Debug default 2022-04-24 11:08:22 +01:00
jimathy
d32b191689 Bug Fixes 2022-04-24 11:06:12 +01:00
jimathy
41c8e3698e Beta GKSPhone invoice support 2022-04-21 19:53:48 +01:00
jimathy
695b968ff7 Update README.md 2022-04-21 19:51:22 +01:00
jimathy
8acacd2cd1 vector4 2022-04-20 20:48:11 +01:00
jimathy
abe360bc6b Ped Support and better Gabz Support in config 2022-04-20 13:52:32 +01:00
jimathy
3c3fe054e0 Merge pull request #5 from jimathy/jimathy-patch-2
Debug mode + Custom Ticket Cashin + Gabz Locations
2022-04-19 21:32:35 +01:00
jimathy
4da8c039e7 Disable debug mode 2022-04-19 21:32:12 +01:00
jimathy
a9f7ac5663 Default setting to vanilla location 2022-04-19 21:30:08 +01:00
jimathy
712096887b Debug mode + Custom Ticket Cashin + Gabz Locations 2022-04-19 21:26:43 +01:00
jimathy
892acf1283 Add toggles for bossmenu/management + nearbylist 2022-04-15 18:25:27 +01:00
jimathy
13d83a066a Fix job label on payment popup 2022-04-12 21:10:48 +01:00
jimathy
88765357b3 Fix job label on payment popup 2022-04-12 21:09:44 +01:00
jimathy
f9029f0951 Commission update 2022-04-11 18:59:47 +01:00
jimathy
65f51520fb Update Readme with new phone event and info 2022-04-11 18:58:55 +01:00
jimathy
7e92b852cf fix bank popups and popup job tickets 2022-04-06 22:30:26 +01:00
jimathy
a63b40c11f fix pay popups for shops with no logo 2022-04-06 22:18:38 +01:00
jimathy
644294546e qb-management export update 2022-04-03 20:52:10 +01:00
jimathy
4dbe600680 qb-management export update 2022-04-03 20:51:34 +01:00
jimathy
9d5086e5d5 qb-management export update 2022-04-03 20:41:07 +01:00
jimathy
b06cb05266 Merge pull request #3 from stacheboi/main
Fix for Player Receiving Cash From Self
2022-03-26 17:50:06 +00:00
jimathy
f16a0b0d1f Removed loops, it was being too strict 2022-03-17 10:57:14 +00:00
jimathy
48003e09a6 Fix for everyone being able to access boss account 2022-03-17 10:43:04 +00:00
stacheboi
95459f63a8 Fix for Player Receiving Cash From Self
When you give someone cash it shows they received money from themself. This show show the sending players name instead.
2022-03-16 21:17:10 -04:00
jimathy
0065af7c9d Notify on accepted payment 2022-03-15 21:32:49 +00:00
jimathy
74990226a9 fix for fix. I need a rest 2022-03-13 13:15:57 +00:00
jimathy
2e5bcc4d86 Fix for bank popup payments 2022-03-13 13:03:09 +00:00
jimathy
185c641f60 fix for tickets with new popup 2022-03-12 12:56:30 +00:00
jimathy
3e036d6996 v2.1 - Add confirmation popups for payments 2022-03-11 00:30:49 +00:00
jimathy
a4a67da493 Move bank enabling varibles to Config.lua 2022-03-10 23:42:35 +00:00
jimathy
2dc29de368 Move bank enabling varibles to Config.lua 2022-03-10 23:41:49 +00:00
jimathy
8379179631 Update config.lua 2022-02-25 12:52:10 +00:00
jimathy
e3e8d71bea Fix for data being nil 2022-02-25 10:10:08 +00:00
jimathy
07c0195d26 Support for upcoming features 2022-02-23 20:35:50 +00:00
jimathy
0df97ac406 oops, gangmenu isn't bossmenu 2022-02-21 09:05:56 +00:00
jimathy
ad4f5dd203 Improve disabling certain bank features 2022-02-20 16:22:41 +00:00
jimathy
76ff8dcfec Remov /cashregister command, didn't work correctly 2022-02-20 15:32:42 +00:00
jimathy
61fc56d82d Add ability to disable receipts 2022-02-20 15:30:15 +00:00
jimathy
b4d185105d Pulling job names from wrong place
This caused errors while trying to access banks or ATMs if you had jobs in the config but not in your shared.

This was left in by mistake
2022-02-20 15:09:50 +00:00
jimathy
4e16ff4e04 Added banking images to readme 2022-02-19 12:18:23 +00:00
jimathy
7d059c27d0 Updated Readme 2022-02-19 11:57:01 +00:00
jimathy
9601e4b2ac Banking update 2022-02-19 11:56:21 +00:00
jimathy
ef5775fd6d possible fix for not working on restart 2022-02-17 16:36:16 +00:00
jimathy
a5e09e4c49 Adjusted servercallback for new method 2022-02-17 12:44:17 +00:00
jimathy
3e9570607a Rewrote the playerlist ANOTHER way 2022-02-17 12:43:15 +00:00
jimathy
5de2f99693 an attempted name grab fix
let me know if this has any issues
2022-02-14 23:07:18 +00:00
jimathy
24ea006d60 Update layout and removal of reduntant statement
Nothing mayjor, just removal of pointless events like "if player offline don't charge" this should be possible to charge them as it retrieves a list of online players nearby
2022-02-11 18:29:47 +00:00
jimathy
8fcea104da Menu orders moved around slightly
Changed formatting to look a bit nicer
2022-02-11 17:49:37 +00:00
jimathy
00367122bf New receipt image
got bored of the old one
2022-02-11 14:59:38 +00:00
jimathy
683f017029 reverted name to usernames 2022-02-10 11:26:00 +00:00
jimathy
ce90bd4f26 Creation of server callbacks for names and tickets
This just adds the callbacks for the clientside info
2022-02-09 12:55:49 +00:00
jimathy
afdbb72ce7 Added callbacks to grab characters name
This adds callback triggers for grabbing the players Character name instead of their user name
Also adds a callback trigger for the amount of tickets in a persons pockets for the trading tickets menu + cosmetic changes
2022-02-09 12:54:06 +00:00
jimathy
cb54fb18fa testing
test commit
2022-02-09 12:45:08 +00:00
jimathy
44833e6c71 Update client.lua
debugPoly=fuck off
2022-02-08 20:16:31 +00:00
jimathy
9aee05be46 Update client.lua
commented out debugging notification
2022-02-08 19:36:23 +00:00
jimathy
79bfe1c7f9 Rewrite
Removal of callback as it has been recreated (and working) in client.lua
2022-02-08 19:21:53 +00:00
jimathy
2bdaf89b28 Update config.lua 2022-02-08 19:20:41 +00:00
jimathy
487459eda8 Update fxmanifest.lua 2022-02-08 19:20:16 +00:00
jimathy
be931570bb Re-write
Had to rewrite the code for grabbing the player list

All on client side now and no callbacks
2022-02-08 19:19:05 +00:00
jimathy
e958ae1582 Update README.md
Info about removing triggers from older scripts
2022-02-07 22:31:36 +00:00
jimathy
d1ea279f4a debugpoly left on
Forgot to turn this off when testing
2022-02-07 21:58:31 +00:00
jimathy
256394bfe3 distance number rounding
rounds the number to remove decimal points, this stops it from making the lines too long
2022-02-07 18:53:28 +00:00
jimathy
227fbd322c Update config.lua 2022-02-06 17:25:46 +00:00
jimathy
4ed398fd9f Update fxmanifest.lua 2022-02-06 17:25:29 +00:00
jimathy
2837a808f1 hotfix for leaving the charging player in the list
Left this out while testing on private test server
2022-02-06 15:48:41 +00:00
jimathy
b78c6dc3a9 Added menu on payment
The menu when cashing in receipts was added while testing stuff, I may expand it on this more
2022-02-06 15:47:07 +00:00
jimathy
412267a5c8 Added extra player checks
- changed to dist <=
- added distance to the player infos (only updates when you open the register)
- added extra check to be sure it doesn't add someone whos too far
2022-02-06 13:42:56 +00:00
jimathy
e0321c51c6 typo hotfix
typo.."Confing"
2022-02-05 20:15:02 +00:00
jimathy
0ea3f36d42 Update server.lua
fix for error "pay is a nil value"
2022-02-05 20:02:29 +00:00
jimathy
ded2fbb219 duty hotfix
fixed onDuty not being picked up on script restarts
2022-02-05 16:18:56 +00:00
jimathy
3722d4b2ba Update README.md 2022-02-05 16:13:38 +00:00
jimathy
63cf7f972d target hotfix
delayed the loading of the qb-target to help loading of the jobroles table
2022-02-05 16:10:11 +00:00
13 changed files with 1772 additions and 187 deletions

217
README.md
View File

@@ -1,41 +1,200 @@
# jim-payments
QBCore based payment system
- QBCore based payment system
- Enchanced QB-Input payment system from my other scripts now free on its own
Enchanced QB-Input payment system from my other scripts now free on its own
### If you need support I have a discord server available, it helps me keep track of issues and give better support.
## https://discord.gg/xKgQZ6wZvS
### If you think I did a good job here, consider donating as it keeps by lights on and my cat fat/floofy:
## 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!
- Currently supported are:
- qb-phone
- gks-phone
- qs-smartphone - Leave the setting as "qb"
---
# Installation
To make use of this payment system you need trigger the event
```jim-payments:client:Charge```
for example with qb-target
```
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
--------------
To make use of the ticket reward system for workers you need to add the ticket item to your shared items 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!"},
---
- I always recommend starting my scripts AFTER `[qb]` not inside it as it can mess with any dependancies on server load
- I have a separate folder called `[jim]` (that is also in the resources folder) that starts WAY after everything else.
- This ensure's it has everything it requires before trying to load
- Example of my load order:
```CSS
# QBCore & Extra stuff
ensure qb-core
ensure [qb]
ensure [standalone]
ensure [voice]
ensure [defaultmaps]
ensure [vehicles]
#Extra Jim Stuff
ensure [jim]
```
Add the ticket image to your inventory script
---
## Item installation
- To make use of the ticket reward system for workers you need to add the ticket item to your shared items lua
- Naviage to `[qb] > qb-core / shared / items.lua` and add this line
```lua
["payticket"] = {["name"] = "payticket", ["label"] = "Receipt", ["weight"] = 150, ["type"] = "item", ["image"] = "ticket.png", ["unique"] = false, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "Cash these in at the bank!"},
```
[qb] > qb-inventory > html > images
- Add the ticket image to your inventory script:
- Naviage to `[qb] > qb-inventory > html > images` and add this line
--------------
To get tickets from phone invoices you NEED to add it to the event when a payment is accepted:
![](https://github.com/jimathy/jim-payments/blob/main/images/ticket.png?raw=true)
Go to [qb] > qb-phone > client > main.lua
- Around line 645 there should be the PayInvoice NUICallBack
- Directly under this line:
---
## Phone Setup
- There are two modes in the script, one that uses the phone for invoices/bank charges
- The script supports many features like pay tickets, commission payments etc.
- If you want to use phone systems for these then you need to add the event for when a payment is accepted:
- REMINDER: IF using phone invoices, the money being added to the society accounts is handled `BY THE PHONE`, not by my script. If money isn't going to the account its the phone system or bossmenu script.
```TriggerServerEvent('qb-phone:server:BillingEmail', data, true)```
#### QB-Phone:
- Go to `[qb] > qb-phone > client > main.lua`
- Search for the event `RegisterNUICallback('PayInvoice', function(data, cb)` and look for the line:
```lua
TriggerServerEvent('qb-phone:server:BillingEmail', data, true)
```
- Add this line:
- Directly *above* this line add:
```lua
TriggerServerEvent('jim-payments:Tickets:Give', data)
```
- The phone should now be integrated with jim-payments
```TriggerServerEvent('jim-payments:Tickets:Give', amount, society)```
#### GKS-Phone:
- Go to `gks-phone > server > serverapi.lua`
- Search for the event: `gksphone:faturapayBill` and search for this line:
```lua
Ply.Functions.RemoveMoney('bank', data[1].amount, "paid-invoice")
```
- Directly under this line add this event:
```lua
TriggerEvent('jim-payments:Tickets:Give', { sender = Ply.PlayerData.charinfo.firstname, senderCitizenId = data[1].sendercitizenid, society = data[1].society, amount = data[1].amount })
```
- The phone should now be integrated with jim-payments
#### Renewed QB-Phone:
- Go to `qb-phone > server > invoices.lua`
- Search for the event: `qb-phone:server:PayMyInvoice` and search for this line:
```lua
TriggerEvent("qb-phone:server:InvoiceHandler", true, amount, src, resource)
```
- Directly under this line add this event:
```lua
TriggerEvent('jim-payments:Tickets:Give', { amount = amount, senderCitizenId = sendercitizenid, sender = SenderPly.PlayerData.charinfo.firstname, society = society }, SenderPly)
```
- When invoices are paid, they should now be integrated with jim-payments
# Setup/Config
## Custom Locations
- You can make of this payment system for a job script that wasn't created by me
- All you need to do is add the job, grab a `vector4` (vector3 + heading) and set if you need a to spawn prop or not
- For example:
```lua
CustomCashRegisters = { -- Located in the config.lua
["burgershot"] = { -- Player job role restriction
{ coords = vector4(-1185.5, -878.54, 13.91, 305.53), prop = true, }, -- vector4 to place the till and the way it faces
{ coords = vector4(-1184.34, -880.51, 13.93, 302.04), prop = true, }, -- "prop = true" spawns a prop at the coords
},
},
```
### This does not need to be done for MY job scripts, they already have built in support
---
## PayTickets
![](https://i.imgur.com/ICbQyeQ.jpeg)
- This script has a built in ticket reward system
- On successful sale, the employees will be handed a ticket if they are clocked in
- This can then be handed in to the bank to receive payment
- Works as a reward and incentive for turning up to do work
- The values are set per job in `Config.Jobs`
- `TicketSystem` Enable this if you want to use the ticket system false
- `TicketSystemAll` Enable this to give tickets to all workers clocked in
---
## Commission System
- Support for commission to be paid as a reward for each successful payment
- Very customisable with the config.lua
- `Commission` Choose wether people get commission from every sale
- `CommissionAll` Choose if **EVERY** worker gets Commission that is on duty
- `CommissionDouble` Choose if Commission is limited by `MinAmountForTicket`
- `CommissionLimit` Choose if the worker charging the customer gets double commission
---
## Multiple Job and Gang Role support
- The script supports adding job roles to the config so they can get rewards for successful payments
- This includes Gang roles for stores/bars owned by a gang allowing them to get ticket rewards and commission
- Examples of adding jobs / gangs to config.lua:
```lua
Jobs = {
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500, Commission = 0.10, },
['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true, },
},
```
- `MinAmountforTicket` is the amount required in a charge before they can get a ticket
- `PayPerTicket` is the amount paid per ticket at the bank for the job role
- I personally recommend this being lower than `MinAmountforTicket`, being too high makes it exploitable
- `Commission` is the amount of commission given to players on successful payments (0.10 = 10%)
- `gang = true` add this if the added role is a gang role
---
## /cashgive
![](https://i.imgur.com/AIdXzxX.jpeg)
- Alternative to /givecash
- A simple command built in to send cash to a `nearby player`
- Shows a list of names and id's of people nearby to select from rather
- Better experience than trying to figure out their ID and entering it manually
---
## /cashregister
![](https://i.imgur.com/37d2mE3.jpeg)
- This command is mean't as a portable cash register alternative
- For example:
- When a person is devliering food they can do `/cashregister` and the payment will still be sent to the society account
- Doesn't utilize the ticket reward system unfortunately
---
## /polcharge
- This script supports a customisable "police billing"
- This is the ability for selected jobroles to charge a nearby player
- Depending on how you've set it up, this can take money directly from the players bank to the job's society account
- This is by default enabled for `police` and `ambulance`
- This also supports giving the player a cut of the payment as `commission`
- Default Config:
```lua
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 = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
```
---
## Banking
![](https://i.imgur.com/RYADcI2.jpeg)
- This script has simple banking systems built in
- Works as a basic replacement for qb-banking and qb-atms
- Adjust the options in config.lua:
- `useATM` Choose wether to make atm's usable
- `useBanks` Choose wether to make bank desks/teller's usable
- `BankBlips` Enable this if you disabled qb-banking and need bank locations
- `ATMBlips` Enable this if you are a pyscho and need every ATM to be on the map too
- `Gabz` Enable to change to Gabz Bank locations, this corrects the ATM/Bank Cashier + Ticket Cash in
---
## Support for other scripts
### Renewed-Banking
- Support for renewed banking added
- Toggle `RenewedBanking` in the config.lua to enable this
### Renewed's qb-phone
- Simply leave the Config.PhoneType as `"qb"`
### AP-Goverment
- Support for AP-Goverment Tax on payments
- Toggle `ApGov` in the config.lua to enable this

View File

@@ -1,52 +0,0 @@
local QBCore = exports['qb-core']:GetCoreObject()
PlayerJob = {}
local onDuty = false
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
QBCore.Functions.GetPlayerData(function(PlayerData)
PlayerJob = PlayerData.job
end)
end)
RegisterNetEvent('QBCore:Client:OnJobUpdate')
AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo)
PlayerJob = JobInfo
onDuty = PlayerJob.onduty
end)
RegisterNetEvent('QBCore:Client:SetDuty')
AddEventHandler('QBCore:Client:SetDuty', function(duty)
onDuty = duty
end)
--Keeps track of duty on script restarts
AddEventHandler('onResourceStart', function(resource) if GetCurrentResourceName() == resource then QBCore.Functions.GetPlayerData(function(PlayerData) PlayerJob = PlayerData.job end) end end)
Citizen.CreateThread(function()
local jobroles = {}
for k, v in pairs(Config.Jobs) do jobroles[tostring(k)] = 0 end
exports['qb-target']:AddBoxZone("JimBank", vector3(251.75, 222.17, 106.2), 0.6, 2.0, { name="JimBank", heading = 340.0, debugPoly=false, minZ = 105.75, maxZ = 107.29, },
{ options = { { type = 'server', event = "jim-payments:Tickets:Sell", icon = "fas fa-receipt", label = "Cash in Receipts", job = jobroles }, },
distance = 2.0
})
end)
RegisterNetEvent('jim-payments:client:Charge', function()
if not onDuty then TriggerEvent("QBCore:Notify", "Not Clocked in!", "error") return end -- Require to be on duty when making a payment
QBCore.Functions.TriggerCallback('jim-payments:server:GetCurrentPlayers', function(playerList)
if playerList[1] == nil then TriggerEvent("QBCore:Notify", "No one near by to charge", "error") return end
local dialog = exports['qb-input']:ShowInput({ header = "Charge Customer", submitText = "Send",
inputs = {
{ text = "Citizen", name = "citizen", type = "select", options = playerList },
{ type = 'number', isRequired = true, name = 'price', text = 'Amount to Charge' },
{ type = 'radio', name = 'billtype', text = 'Payment Type', options = { { value = "cash", text = "Cash" }, { value = "card", text = "Card" } } }, }
})
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)
end
end)
end)

249
client/atms.lua Normal file
View File

@@ -0,0 +1,249 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)
-- 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 bossroles = {}
local gangroles = {}
CreateThread(function()
if Config.useATM then
if Config.ATMBlips then
for _, v in pairs(Config.WallATMLocations) do
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_atm"] })
end
for _, v in pairs(Config.ATMLocations) do
makeBlip({coords = v, sprite = 108, col = 3, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_atm"] })
end
end
end
if Config.useBanks then
if Config.BankBlips then
for _, v in pairs(Config.BankLocations) do
for _, b in pairs(v) do
makeBlip({coords = b, sprite = 108, col = 2, scale = 0.55, disp = 6, name = Loc[Config.Lan].blip["blip_bank"] })
break
end
end
end
end
if Config.useATM or Config.useBanks then
for k in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs
if QBCore.Shared.Jobs[tostring(k)] then
for l 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)] 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 in pairs(QBCore.Shared.Gangs) do
if QBCore.Shared.Gangs[tostring(k)] then
for l 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)] 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 = Loc[Config.Lan].target["atm"], id = "atm" },}, distance = 1.5, })
for k,v in pairs(Config.WallATMLocations) do
Targets["jimwallatm"..k] =
exports['qb-target']:AddCircleZone("jimwallatm"..k, vector3(v.x, v.y, 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 = Loc[Config.Lan].target["atm"], id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer_money"], id = "transfer" },
}, distance = 1.5 })
end
for k,v in pairs(Config.ATMLocations) do
Targets["jimatm"..k] =
exports['qb-target']:AddCircleZone("jimatm"..k, vector3(v.x, v.y, 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 = Loc[Config.Lan].target["atm"], id = "atm" },
--{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer_money"], id = "transfer" },
}, distance = 1.5 })
end
end
if Config.useBanks then
for k,v in pairs(Config.BankLocations) do
for l, b in pairs(v) do
Targets["jimbank"..k..l] =
exports['qb-target']:AddCircleZone("jimbank"..k..l, vector3(b.x, b.y, 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 = Loc[Config.Lan].target["bank"], id = "bank" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["transfer"], id = "transfer" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-money-check-dollar", label = Loc[Config.Lan].target["saving"], id = "savings" },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = Loc[Config.Lan].target["soc_saving"], id = "society", job = bossroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["soc_trans"], id = "societytransfer", job = bossroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-building", label = Loc[Config.Lan].target["gang_acct"], id = "gang", gang = gangroles },
{ event = "jim-payments:Client:ATM:use", icon = "fas fa-arrow-right-arrow-left", label = Loc[Config.Lan].target["gang_trans"], id = "gangtransfer", gang = gangroles }, },
distance = 2.5 })
if Config.Peds then
local i = math.random(1, #Config.PedPool)
if not Config.Gabz then CreateModelHide(b.xyz, 1.0, `v_corp_bk_chair3`, true) end
if not Peds["jimbank"..k..l] then Peds["jimbank"..k..l] = makePed(Config.PedPool[i], b, false, false) end
end
end
end
end
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)
if not Config.Manage then
local p = promise.new()
QBCore.Functions.TriggerCallback('qb-bossmenu:server:GetAccount', function(cb) p:resolve(cb) end, PlayerJob.name) info.society = Citizen.Await(p)
local p2 = promise.new()
QBCore.Functions.TriggerCallback('qb-gangmenu:server:GetAccount', function(cb) p2:resolve(cb) end, PlayerGang.name) info.gsociety = Citizen.Await(p2)
end
local atmbartime = 2500
local bartext = ""
local setoptions = {}
if data.id == "atm" then
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, }
setview = "<center><img src=https://static.wikia.nocookie.net/gtawiki/images/b/bd/Fleeca-GTAV-Logo.png width=200px></center><br>"..Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["citizenid"]..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_atm"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
for k, v in pairs(Config.ATMModels) do
if IsObjectNearPoint(v, GetEntityCoords(PlayerPedId()), 1.6) then
local obj = GetClosestObjectOfType(GetEntityCoords(PlayerPedId()), 1.6, v, false, false, false)
local atmCoords = GetEntityCoords(obj)
lookEnt(obj)
bartext = Loc[Config.Lan].menu["acc_atm"]
end
end
elseif data.id == "bank" then
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_acc"]..info.account.."<br>"..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["cash_balance"]..cv(info.cash)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_bank"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_bank"]
elseif data.id == "transfer" then
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_acc"]..info.account.."<br>"..info.cid..Loc[Config.Lan].menu["header_balance_bank"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_trans"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_trans"]
elseif data.id == "savings" then
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_info"]..info.aid.."<br>"..info.cid..Loc[Config.Lan].menu["saving_balance"]..cv(info.savbal)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_saving"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_saving"]
elseif data.id == "society" then
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerJob.label..Loc[Config.Lan].menu["header_balance"]..PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)
setheader = Loc[Config.Lan].menu["header_soc_bank"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_boss"]
elseif data.id == "societytransfer" then
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerJob.label..Loc[Config.Lan].menu["header_balance"]..PlayerJob.label.." - $"..cv(info.society)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_trans"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_boss_trans"]
elseif data.id == "gang" then
setheader = Loc[Config.Lan].menu["header_soc_bank"]
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerGang.label..Loc[Config.Lan].menu["header_balance"]..PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["bank_balance"]..cv(info.bank)..Loc[Config.Lan].menu["header_option"]
setoptions = { { value = "withdraw", text = Loc[Config.Lan].menu["withdraw"] }, { value = "deposit", text = Loc[Config.Lan].menu["deposit"] } }
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_gang"]
elseif data.id == "gangtransfer" then
setoptions = { { value = "transfer", text = Loc[Config.Lan].menu["transfer"] } }
setview = Loc[Config.Lan].menu["welcome"]..info.name..Loc[Config.Lan].menu["header_soc"]..PlayerGang.label..Loc[Config.Lan].menu["header_balance"]..PlayerGang.label.." - $"..cv(info.gsociety)..Loc[Config.Lan].menu["header_option"]
setheader = Loc[Config.Lan].menu["header_trans"]
setinputs = { { type = 'radio', name = 'billtype', text = setview, options = setoptions },
{ type = 'text', isRequired = true, name = 'account', text = Loc[Config.Lan].menu["header_account_no"] },
{ type = 'number', isRequired = true, name = 'amount', text = Loc[Config.Lan].menu["header_trans_amount"] }, }
bartext = Loc[Config.Lan].menu["acc_gang_trans"]
end
loadAnimDict('amb@prop_human_atm@male@enter')
TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@enter', "enter", 1.0,-1.0, 1500, 1, 1, true, true, true)
unloadAnimDict('amb@prop_human_atm@male@enter')
QBCore.Functions.Progressbar("accessing_atm", bartext, atmbartime, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = false, }, {}, {}, {}, function()
local dialog = exports['qb-input']:ShowInput({ header = setheader, txt = "test", submitText = Loc[Config.Lan].menu["transfer"], inputs = setinputs })
if dialog then
if not dialog.amount then return end
loadAnimDict('amb@prop_human_atm@male@exit')
TaskPlayAnim(PlayerPedId(), 'amb@prop_human_atm@male@exit', "exit", 1.0,-1.0, 3000, 1, 1, true, true, true)
unloadAnimDict('amb@prop_human_atm@male@enter')
Wait(1000)
TriggerServerEvent('jim-payments:server:ATM:use', dialog.amount, dialog.billtype, dialog.account, data.id, info.society, info.gsociety)
end
end, function() triggerNotify(nil, Loc[Config.Lan].error["cancel"], "error")
end, data.icon)
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 _, id in pairs(QBCore.Functions.GetPlayersFromCoords(GetEntityCoords(PlayerPedId()), Config.PaymentRadius)) do
local dist = #(GetEntityCoords(GetPlayerPed(id)) - GetEntityCoords(PlayerPedId()))
for i = 1, #onlineList do
if onlineList[i].value == GetPlayerServerId(id) then
if id ~= PlayerId() or Config.Debug 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 nearbyList[1] then triggerNotify(nil, Loc[Config.Lan].error["no_one"], "error") return end
local dialog = exports['qb-input']:ShowInput({ header = Loc[Config.Lan].menu["give_cash"], submitText = Loc[Config.Lan].menu["give"],
inputs = {
{ text = " ", name = "citizen", type = "select", options = nearbyList },
{ type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_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(r) if r ~= GetCurrentResourceName() then return end
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
for k in pairs(Peds) do unloadModel(GetEntityModel(Peds[k])) DeletePed(Peds[k]) end
end)

190
client/client.lua Normal file
View File

@@ -0,0 +1,190 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)
PlayerJob = {}
PlayerGang = {}
local onDuty = false
local BankPed = nil
local Targets = {}
local Till = {}
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 = {} local gangroles = {}
--Build Job/Gang Checks for cashin location
for k, v in pairs(Config.Jobs) do if v.gang then gangroles[tostring(k)] = 0 else jobroles[tostring(k)] = 0 end end
--Create Target at location
Targets["JimBank"] =
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 = Loc[Config.Lan].target["cashin_boss"], job = jobroles, },
{ event = "jim-payments:Tickets:Menu", icon = "fas fa-receipt", label = Loc[Config.Lan].target["cashin_gang"], gang = gangroles, } },
distance = 2.0 })
--Crete Ped at the location
if Config.Peds then
if not Config.Gabz then CreateModelHide(vector3(Config.CashInLocation.x, Config.CashInLocation.y, Config.CashInLocation.z), 1.0, `v_corp_bk_chair3`, true) end
BankPed = makePed(Config.PedPool[math.random(1, #Config.PedPool)], Config.CashInLocation, false, false)
end
--Spawn Custom Cash Register Targets
for k, v in pairs(Config.CustomCashRegisters) do
for i = 1, #v do
local job = k
local gang = nil
if v[i].gang then job = nil gang = k end
Targets["CustomRegister: "..k..i] =
exports['qb-target']:AddBoxZone("CustomRegister: "..k..i, v[i].coords.xyz, 0.47, 0.34, { name="CustomRegister: "..k..i, heading = v[i].coords[4], debugPoly=Config.Debug, minZ=v[i].coords.z-0.1, maxZ=v[i].coords.z+0.4 },
{ options = { { event = "jim-payments:client:Charge", icon = "fas fa-credit-card", label = Loc[Config.Lan].target["charge"], job = job, gang = gang, img = "" }, },
distance = 2.0 })
if v[i].prop then
Till[#Till+1] = makeProp({prop = `prop_till_03`, coords = v[i].coords}, 1, false)
end
end
end
end)
RegisterNetEvent('jim-payments:client:Charge', function(data, outside)
--Check if player is using /cashregister command
if not outside and not onDuty and data.gang == nil then triggerNotify(nil, Loc[Config.Lan].error["not_onduty"], "error") return end
local newinputs = {} -- Begin qb-input creation here.
if Config.List then -- If nearby player list is wanted:
--Retrieve a list of nearby players from server
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
local onlineList = Citizen.Await(p)
local nearbyList = {}
--Convert list of players nearby into one qb-input understands + add distance info
for _, 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() or Config.Debug then
nearbyList[#nearbyList+1] = { value = onlineList[i].value, 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, Loc[Config.Lan].error["no_one"], "error") return end
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
else -- If Config.List is false, create input text box for ID's
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = Loc[Config.Lan].menu["cus_id"] }
end
--Check if image was given when opening the regsiter
local img = data.img or ""
--Continue adding payment options to qb-input
newinputs[#newinputs+1] = { type = 'radio', name = 'billtype', text = Loc[Config.Lan].menu["type"], options = { { value = "cash", text = Loc[Config.Lan].menu["cash"] }, { value = "bank", text = Loc[Config.Lan].menu["card"] } } }
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_charge"] }
--Grab Player Job name or Gang Name if needed
local label = PlayerJob.label
local gang = false
if data.gang then label = PlayerGang.label gang = true end
local dialog = exports['qb-input']:ShowInput({ header = img..label..Loc[Config.Lan].menu["cash_reg"], submitText = Loc[Config.Lan].menu["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, gang)
end
end)
RegisterNetEvent('jim-payments:client:PolCharge', function()
--Check if player is allowed to use /cashregister command
local allowed = false
for k in pairs(Config.FineJobs) do if k == PlayerJob.name then allowed = true end end
if not allowed then triggerNotify(nil, Loc[Config.Lan].error["no_job"], "error") return end
local newinputs = {} -- Begin qb-input creation here.
if Config.FineJobList then -- If nearby player list is wanted:
--Retrieve a list of nearby players from server
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:MakePlayerList', function(cb) p:resolve(cb) end)
local onlineList = Citizen.Await(p)
local nearbyList = {}
--Convert list of players nearby into one qb-input understands + add distance info
for _, 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() or Config.Debug then
nearbyList[#nearbyList+1] = { value = onlineList[i].value, 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, Loc[Config.Lan].error["no_one"], "error") return end
newinputs[#newinputs+1] = { text = " ", name = "citizen", type = "select", options = nearbyList }
else -- If Config.List is false, create input text box for ID's
newinputs[#newinputs+1] = { type = 'text', isRequired = true, name = 'citizen', text = Loc[Config.Lan].menu["person_id"] }
end
--Continue adding payment options to qb-input
newinputs[#newinputs+1] = { type = 'number', isRequired = true, name = 'price', text = Loc[Config.Lan].menu["amount_charge"] }
--Grab Player Job name or Gang Name if needed
local label = PlayerJob.label
local gang = false
local dialog = exports['qb-input']:ShowInput({ header = label..Loc[Config.Lan].menu["charge"], submitText = Loc[Config.Lan].menu["send"], inputs = newinputs})
if dialog then
if not dialog.citizen or not dialog.price then return end
TriggerServerEvent('jim-payments:server:PolCharge', dialog.citizen, dialog.price)
end
end)
RegisterNetEvent('jim-payments:Tickets:Menu', function(data)
--Get ticket info
local p = promise.new() QBCore.Functions.TriggerCallback('jim-payments:Ticket:Count', function(cb) p:resolve(cb) end)
local amount = Citizen.Await(p)
if not amount then triggerNotify(nil, Loc[Config.Lan].error["no_ticket"], "error") amount = 0 return else amount = amount.amount end
local sellable = false
local name = "" local label = ""
--Check/adjust for job/gang names
for k, v in pairs(Config.Jobs) do
if data.gang then if v.gang and k == PlayerGang.name then name = k label = PlayerGang.label sellable = true end
else if not v.gang and k == PlayerJob.name then name = k label = PlayerJob.label sellable = true end
end
if sellable then -- if info is found then:
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = "🧾 "..label..Loc[Config.Lan].menu["receipt"], txt = Loc[Config.Lan].menu["trade_confirm"] },
{ isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["ticket_amount"]..amount..Loc[Config.Lan].menu["total_pay"]..(Config.Jobs[name].PayPerTicket * amount) },
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { event = "jim-payments:Tickets:Sell:yes" } },
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { event = "jim-payments:Tickets:Sell:no" } },
})
end
end
end)
RegisterNetEvent("jim-payments:client:PayPopup", function(amount, biller, billtype, img, billerjob, gang, outside)
local img = img or ""
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = img.."🧾 "..billerjob..Loc[Config.Lan].menu["payment"], txt = Loc[Config.Lan].menu["accept_payment"] },
{ isMenuHeader = true, header = "", txt = billtype:gsub("^%l", string.upper)..Loc[Config.Lan].menu["payment_amount"]..amount },
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = true, amount = amount, biller = biller, billtype = billtype, gang = gang, outside = outside } } },
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { isServer = true, event = "jim-payments:server:PayPopup", args = { accept = false, amount = amount, biller = biller, billtype = billtype, outside = outside } } }, })
end)
RegisterNetEvent("jim-payments:client:PolPopup", function(amount, biller, billerjob)
exports['qb-menu']:openMenu({
{ isMenuHeader = true, header = "🧾 "..billerjob..Loc[Config.Lan].menu["payment"], txt = Loc[Config.Lan].menu["accept_charge"] },
{ isMenuHeader = true, header = "", txt = Loc[Config.Lan].menu["bank_charge"]..amount },
{ icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"], txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = true, amount = amount, biller = biller } } },
{ icon = "fas fa-circle-xmark", header = Loc[Config.Lan].menu["no"], txt = "", params = { isServer = true, event = "jim-payments:server:PolPopup", args = { accept = false, amount = amount, biller = biller } } }, })
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(r) if r ~= GetCurrentResourceName() then return end
for k in pairs(Targets) do exports['qb-target']:RemoveZone(k) end
for i = 1, #Till do DeleteEntity(Till[i]) end
unloadModel(GetEntityModel(BankPed)) DeletePed(BankPed)
end)

View File

@@ -1,20 +1,255 @@
print("Jim-Payments v1.0 - Payments Script by Jimathy")
print("^2Jim^7-^2Payments ^7v^42^7.^48^7.^44 ^7- ^2Payments Script by ^1Jimathy^7")
-- 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 = {
Lan = "en",
Debug = false,
Notify = "qb",
Config.PaymentRadius = 30 -- This is how far the player list will check
---------------------------------
-- Default Job Payment Systems --
---------------------------------
Config.Jobs = {
['popsdiner'] = { MinAmountforTicket = 50, PayPerTicket = 50 },
['henhouse'] = { MinAmountforTicket = 50, PayPerTicket = 50 },
['pizzathis'] = { MinAmountforTicket = 50, PayPerTicket = 50 },
['burgershot'] = { MinAmountforTicket = 50, PayPerTicket = 50 },
['catcafe'] = { MinAmountforTicket = 50, PayPerTicket = 50 },
['tequilala'] = { MinAmountforTicket = 50, PayPerTicket = 50 },
['vanilla'] = { MinAmountforTicket = 50, PayPerTicket = 50 },
['mechanic'] = { MinAmountforTicket = 1000, PayPerTicket = 500 },
}
RenewedBanking = false, -- Enable if using Renewed-Banking false if using QB-Management
ApGov = false, -- Toggle support for AP-Goverment Tax
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)
Peds = true, -- "true" to enable peds spawning in banks
PedPool = {
`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`,
},
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 confirmation now
-- This is helpful for phones that don't support invoices well
PhoneType = "qb", -- Change this setting to make invoices work with your phone script [still testing this currently]
-- "qb" for qb-phone
-- "gks"" for GKSPhone
CashInLocation = vector4(252.23, 223.11, 106.29, 159.2), -- Default Third Window along in Pacific Bank
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
-- MinAmountforTicket should be your cheapest item
-- PayPerTicket should never be higher than MinAmountforTicket
-- Commission is a percentage eg "0.10" becomes 10%
Jobs = {
['beanmachine'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, },
['bakery'] = { 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, },
['lostmc'] = { MinAmountforTicket = 50, PayPerTicket = 50, Commission = 0.10, gang = true, }, -- Example of a gang being supported
},
------------------------------
-- Custom Job Cash Register --
------------------------------
-- This adds the ability to add multiple locations for each job
-- Basically adding ready made locations, all you need to a vector4 and to confrim if you need a new prop in that location
CustomCashRegisters = {
},
-- 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 = true, -- "true" to use nearby player list feature in the cash registers, "false" for manual id entry
---------------------
-- Banking Systems --
---------------------
useATM = false, -- Enable this to use the scripts ATM's and controls
useBanks = false, -- Enable this to use my banking stuff
BankBlips = false, -- Enable this if you disabled qb-banking and need bank locations
ATMBlips = false, -- Enable this if you are a pyscho and need every ATM to be on the map too
Gabz = false, -- "true" to enable Gabz Bank locations
-- this corrects the ATM/Bank Cashier + Ticket Cash in location
ATMModels = { `prop_atm_01`, `prop_atm_02`, `prop_atm_03`, `prop_fleeca_atm` },
ATMLocations = {
--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
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),
},
BankLocations = {
["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
},
},
}
-- If Gabz banks enabled, load these locations instead
if Config.Gabz then
Config.CashInLocation = vector4(269.28, 217.24, 106.28, 69.0)
Config.BankLocations = {
["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
},
}
Config.ATMLocations = {
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),
}
end
Loc = {}

View File

@@ -1,23 +1,12 @@
name "Jim-Payments"
author "Jimathy"
version "v1.0"
version "v2.8.4"
description "Payment Script By Jimathy"
fx_version "cerulean"
game "gta5"
lua54 'yes'
dependencies {
'qb-input',
}
client_scripts {
'client.lua'
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server.lua'
}
shared_scripts {
'config.lua',
}
dependencies { 'qb-input', 'qb-target', }
client_scripts { 'client/*.lua', 'locales/*.lua' }
server_scripts { '@oxmysql/lib/MySQL.lua', 'server/*.lua' }
shared_scripts { 'config.lua', 'shared/*.lua', 'locales/*.lua' }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 24 KiB

133
locales/de.lua Normal file
View File

@@ -0,0 +1,133 @@
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"] = "<br><br>- Firmenkonto -<br>",
["header_balance"] = "<br><br>- Kontostand -<br>🏢",
["header_soc_bank"] = "🏢 Firmen Banking 🏢",
["amount_pay"] = "💵 Zu zahlender Betrag'",
["give_cash"] = "Jemandem Bargeld geben",
["give"] = "Geben",
["welcome"] = "Willkommen zurück, ",
["citizenid"] = "<br><br>- Ausweisnummer -<br>",
["header_acc"] = "<br><br>- Konto -<br>",
["header_info"] = "<br><br>- Konto Info -<br>Ersparnis-ID: ",
["header_balance_bank"] = "<br><br>- Kontostand -<br>🏦Bank - $",
["header_option"] = "<br><br>- Optionen -",
["cash_balance"] = "<br>💵Bargeld - $",
["bank_balance"] = "<br>🏦Bank - $",
["saving_balance"] = "<br><br>- Kontostand -<br>💰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"] = "<br>Gesamte Zahlung: $",
["yes"] = "Ja",
["no"] = "Nein",
["cash"] = "Bargeld",
["card"] = "Karte",
["payment_amount"] = " Zahlung: $",
["bank_charge"] = "Bankgebühr: $",
},
}

133
locales/en.lua Normal file
View File

@@ -0,0 +1,133 @@
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"] = "Withdrawl",
["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"] = "<br><br>- Society Account -<br>",
["header_balance"] = "<br><br>- Balances -<br>🏢",
["header_soc_bank"] = "🏢 Society Banking 🏢",
["amount_pay"] = "💵 Amount to Pay'",
["give_cash"] = "Give someone cash",
["give"] = "Give",
["welcome"] = "Welcome back, ",
["citizenid"] = "<br><br>- Citizen ID -<br>",
["header_acc"] = "<br><br>- Account -<br>",
["header_info"] = "<br><br>- Account Info -<br>Savings ID: ",
["header_balance_bank"] = "<br><br>- Balances -<br>🏦Bank - $",
["header_option"] = "<br><br>- Options -",
["cash_balance"] = "<br>💵Cash - $",
["bank_balance"] = "<br>🏦Bank - $",
["saving_balance"] = "<br><br>- Balances -<br>💰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: $",
["yes"] = "Yes",
["no"] = "No",
["cash"] = "Cash",
["card"] = "Card",
["payment_amount"] = " Payment: $",
["bank_charge"] = "Bank Charge: $",
},
}

View File

@@ -1,76 +0,0 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('jim-payments:Tickets:Give')
AddEventHandler('jim-payments:Tickets:Give', function(amount, job)
for k, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player ~= nil then
if Player.PlayerData.job.name == job and Player.PlayerData.job.onduty then
if amount >= Config.Jobs[job].MinAmountforTicket 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)
elseif amount < Config.Jobs[job].MinAmountforTicket then
TriggerClientEvent("QBCore:Notify", Player.PlayerData.source, "Amount too low, didn't receive a receipt", "error")
end
end
end
end
end)
RegisterServerEvent('jim-payments:Tickets:Sell')
AddEventHandler('jim-payments:Tickets:Sell', function(data)
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)
Player.Functions.AddMoney('bank', (tickets * Confing.Jobs[Player.PlayerData.job.name].PayPerTicket), 'ticket-payment')
TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['payticket'], "remove", tickets)
TriggerClientEvent('QBCore:Notify', source, "Tickets: "..tickets.." Total: $"..pay, 'success')
end
end)
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype)
local biller = QBCore.Functions.GetPlayer(source)
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
local amount = tonumber(price)
local billtype = string.lower(tostring(billtype))
if billed ~= nil then
if billtype == "cash" then balance = billed.Functions.GetMoney(billtype)
if source == tonumber(citizen) then TriggerClientEvent('QBCore:Notify', source, 'You Cannot Bill Yourself', 'error') return end
if balance >= amount then
billed.Functions.RemoveMoney('cash', amount) TriggerEvent("qb-bossmenu:server:addAccountMoney", tostring(biller.PlayerData.job.name), amount)
TriggerEvent('jim-payments:Tickets:Give', amount, tostring(biller.PlayerData.job.name))
elseif balance < amount then
TriggerClientEvent("QBCore:Notify", source, "Customer doesn't have enough cash to pay", "error")
TriggerClientEvent("QBCore:Notify", tonumber(citizen), "You don't have enough cash to pay", "error")
end
elseif billtype == "card" then
if biller.PlayerData.citizenid == billed.PlayerData.citizenid then TriggerClientEvent('QBCore:Notify', source, 'You Cannot Bill Yourself', 'error') return end
if amount and amount > 0 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)
TriggerClientEvent('QBCore:Notify', source, 'Invoice Successfully Sent', 'success')
TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
else TriggerClientEvent('QBCore:Notify', source, 'Must Be A Valid Amount Above 0', 'error') end
end
else TriggerClientEvent('QBCore:Notify', source, 'Player Not Online', 'error') end
end)
QBCore.Functions.CreateCallback('jim-payments:server:GetCurrentPlayers', function(source, cb)
local onlineList = {}
local SPlayer = QBCore.Functions.GetPlayer(source)
for k, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player ~= nil and v ~= source then
local dist = #(vector3(Player.PlayerData.position.x, Player.PlayerData.position.y, Player.PlayerData.position.z) - vector3(SPlayer.PlayerData.position.x, SPlayer.PlayerData.position.y, SPlayer.PlayerData.position.z))
if dist < Config.PaymentRadius then onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname } end
end
end
cb(onlineList)
end)

269
server/atmserver.lua Normal file
View File

@@ -0,0 +1,269 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Server:UpdateObject', function() if source ~= '' then return false end QBCore = exports['qb-core']:GetCoreObject() end)
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
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 triggerNotify(nil, Loc[Config.Lan].error["bank_low"], "error", src)
elseif bankB >= tonumber(amount) then
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["from_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 triggerNotify(nil, Loc[Config.Lan].error["no_cash"], "error", src)
elseif cashB >= amount then
Player.Functions.RemoveMoney('cash', amount) Wait(1500)
Player.Functions.AddMoney('bank', amount)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].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_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 -= amount
Player.Functions.AddMoney('bank', amount)
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["draw_save"], "success", src)
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
triggerNotify(nil, Loc[Config.Lan].error["saving_low"], "error")
end
elseif billtype == "deposit" then
if amount < bankB then
savbal += amount
Player.Functions.RemoveMoney('bank', amount)
triggerNotify(nil, "$"..cv(amount)..Loc[Config.Lan].success["depos_save"], "success", src)
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 triggerNotify(nil, Loc[Config.Lan].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, Loc[Config.Lan].error["soc_low"], "error", src)
elseif tonumber(society) >= amount then
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Player.PlayerData.job.label..Loc[Config.Lan].success["account"], "success", src)
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 triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
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)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Player.PlayerData.job.label..Loc[Config.Lan].success["account"], "success", src)
end
end
-- Transfer from boss account to players --
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 = 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] 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 then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.job.label)..Loc[Config.Lan].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, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].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, Loc[Config.Lan].error["soc_low"], "error", src)
elseif tonumber(gsociety) >= amount then
triggerNotify(nil, Loc[Config.Lan].success["draw"]..cv(amount)..Loc[Config.Lan].success["fromthe"]..Player.PlayerData.gang.label..Loc[Config.Lan].success["account"], "success", src)
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 triggerNotify(nil, Loc[Config.Lan].error["nomoney_bank"], "error", src)
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)
triggerNotify(nil, Loc[Config.Lan].success["deposited"]..cv(amount)..Loc[Config.Lan].success["into"]..Player.PlayerData.gang.label..Loc[Config.Lan].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 = 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] 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 not Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..amount..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Reciever.PlayerData.source, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].success["from"]..tostring(Player.PlayerData.gang.label)..Loc[Config.Lan].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, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].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 = 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] then
local Reciever = QBCore.Functions.GetPlayerByCitizenId(result[1].citizenid)
Player.Functions.RemoveMoney('bank', amount)
if Reciever then
Reciever.Functions.AddMoney('bank', amount)
triggerNotify(nil, Loc[Config.Lan].success["sent"]..cv(amount)..Loc[Config.Lan].success["to"]..Reciever.PlayerData.charinfo.firstname.." "..Reciever.PlayerData.charinfo.lastname, "success", src)
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..cv(amount)..Loc[Config.Lan].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, Loc[Config.Lan].error["error_start"]..baccount..Loc[Config.Lan].error["error_end"], "error", src)
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 society = 0
local gsociety = 0
-- If qb-management, grab info directly from database
if Config.Manage then
local result = MySQL.Sync.fetchAll('SELECT * FROM management_funds')
for _, v in pairs(result) do
if Player.PlayerData.job.name == v.job_name then society = v.amount end
end
if Player.PlayerData.gang.name ~= "none" then
for _, v in pairs(result) do
if Player.PlayerData.gang.name == v.job_name then gsociety = v.amount end
end
end
else
end
-- Grab Savings account info
local result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
if result[1] then
accountID = result[1].record_id
savingBalance = result[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 result = MySQL.Sync.fetchAll('SELECT * FROM bank_accounts WHERE citizenid = ? AND account_type = ?', { Player.PlayerData.citizenid, 'Savings' })
aid = result[1].record_id
savingBalance = result[1].amount
end
cb({name = name,
cash = cash,
bank = bank,
account = account,
cid = cid,
savbal = savingBalance,
aid = accountID,
society = society,
gsociety = gsociety})
end)
QBCore.Commands.Add("cashgive", Loc[Config.Lan].command["pay_user"], {}, 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)
triggerNotify(nil, Loc[Config.Lan].success["you_gave"]..Reciever.PlayerData.charinfo.firstname.." $"..cv(amount), "success", source)
Reciever.Functions.AddMoney('cash', amount)
triggerNotify(nil, Loc[Config.Lan].success["you_got"]..cv(amount)..Loc[Config.Lan].success["from"]..Player.PlayerData.charinfo.firstname, "success", tonumber(citizen))
elseif balance < amount then
triggerNotify(nil, Loc[Config.Lan].error["not_enough"], "error", source)
end
else triggerNotify(nil, Loc[Config.Lan].error["zero"], 'error', source) end
end)

235
server/server.lua Normal file
View File

@@ -0,0 +1,235 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Server:UpdateObject', function() if source ~= '' then return false end QBCore = exports['qb-core']:GetCoreObject() end)
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 in pairs(Config.Jobs) do
if not QBCore.Shared.Jobs[k] and not QBCore.Shared.Gangs[k] then
print("Jim-Payments: Config.Jobs searched for job/gang '"..k.."' and couldn't find it in the Shared")
end
end
end)
QBCore.Commands.Add("cashregister", Loc[Config.Lan].command["cash_reg"], {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, {}, true) end)
QBCore.Commands.Add("polcharge", Loc[Config.Lan].command["charge"], {}, false, function(source) TriggerClientEvent("jim-payments:client:PolCharge", source) end)
RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller, gang)
local billed = QBCore.Functions.GetPlayer(source) -- This should always be from the person who accepted the payment
local takecomm = math.floor(tonumber(data.amount) * Config.Jobs[data.society].Commission)
if biller then -- If this is found, it ISN'T a phone payment, so add money to society here
if gang then
if Config.RenewedBanking then exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.gang.name), data.amount - takecomm)
if Config.Debug then print("^5Debug^7: ^3Renewed-Banking^7(^3Gang^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports['Renewed-Banking']:getAccountMoney(biller.PlayerData.gang.name).."^7)") end
else
exports["qb-management"]:AddGangMoney(tostring(biller.PlayerData.gang.name), data.amount - takecomm)
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Gang^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.gang.name).."^7' ($^6"..exports["qb-management"]:GetGangAccount(biller.PlayerData.gang.name).."^7)") end
end
elseif not gang then
if Config.RenewedBanking then exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.job.name), data.amount - takecomm)
if Config.Debug then print("^5Debug^7: ^3Renewed-Banking^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..tostring(exports['Renewed-Banking']:getAccountMoney(biller.PlayerData.job.name)).."^7)") end
else
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - takecomm)
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
end
end
elseif not biller then --Find the biller from their citizenid
for _, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player.PlayerData.citizenid == data.senderCitizenId then biller = Player end
end
triggerNotify(nil, data.sender..Loc[Config.Lan].success["invoice_start"]..data.amount..Loc[Config.Lan].success["invoice_end"], "success", biller.PlayerData.source)
end
-- If ticket system enabled, do this
if (biller.PlayerData.job.onduty or gang) and Config.TicketSystem then
if data.amount >= Config.Jobs[data.society].MinAmountforTicket then
if Config.TicketSystemAll then
for _, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player ~= nil or Player ~= billed then
if gang then
if Player.PlayerData.gang.name == data.society then
if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
end
else
if Player.PlayerData.job.name == data.society and Player.PlayerData.job.onduty then
if Player.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', Player.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', Player.PlayerData.source)
end
end
end
end
else
if biller.Functions.AddItem('payticket', 1) then TriggerClientEvent('inventory:client:ItemBox', biller.PlayerData.source, QBCore.Shared.Items['payticket'], "add", 1) end
triggerNotify(nil, Loc[Config.Lan].success["rec_rec"], 'success', biller.PlayerData.source)
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)))
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * (comm *2))..Loc[Config.Lan].success["commission"], "success", biller.PlayerData.source)
else biller.Functions.AddMoney("bank", math.floor(tonumber(data.amount) *comm))
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", biller.PlayerData.source)
end
if Config.CommissionAll then
for _, v in pairs(QBCore.Functions.GetPlayers()) do
local Player = QBCore.Functions.GetPlayer(v)
if Player 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))
triggerNotify(nil, Loc[Config.Lan].success["recieved"]..math.floor(tonumber(data.amount) * comm)..Loc[Config.Lan].success["commission"], "success", Player.PlayerData.source)
end
end
end
end
end
end)
RegisterServerEvent('jim-payments:Tickets:Sell', function()
local Player = QBCore.Functions.GetPlayer(source)
if not Player.Functions.GetItemByName("payticket") then triggerNotify(nil, Loc[Config.Lan].error["no_ticket_to"], 'error', source) 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)
triggerNotify(nil, Loc[Config.Lan].success["trade_ticket_start"]..tickets..Loc[Config.Lan].success["trade_ticket_end"]..cv(pay), 'success', source)
end
end)
QBCore.Functions.CreateCallback('jim-payments:Ticket:Count', function(source, cb)
cb(QBCore.Functions.GetPlayer(source).Functions.GetItemByName('payticket'))
end)
RegisterServerEvent("jim-payments:server:Charge", function(citizen, price, billtype, img, outside, gang)
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
triggerNotify(nil, Loc[Config.Lan].error["customer_nocash"], "error", src)
triggerNotify(nil, Loc[Config.Lan].error["you_nocash"], "error", tonumber(citizen))
return
end
local label = biller.PlayerData.job.label
if gang == true then label = biller.PlayerData.gang.label end
if Config.PhoneBank == false or gang == true or billtype == "cash" then
TriggerClientEvent("jim-payments:client:PayPopup", billed.PlayerData.source, amount, src, billtype, img, label, gang, outside)
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}, function(id)
if id then
TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.PlayerData.source, id, biller.PlayerData.charinfo.firstname, biller.PlayerData.job.name, biller.PlayerData.citizenid, amount, GetInvokingResource())
end
end)
TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
elseif Config.PhoneType == "gks" then
MySQL.Async.execute('INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)', {
['@citizenid'] = billed.PlayerData.citizenid,
['@amount'] = amount,
['@society'] = biller.PlayerData.job.name,
['@sender'] = biller.PlayerData.charinfo.firstname,
['@sendercitizenid'] = biller.PlayerData.citizenid,
['@label'] = biller.PlayerData.job.label,
})
TriggerClientEvent('gksphone:notifi', src, {title = 'Billing', message = Loc[Config.Lan].success["inv_succ"], img= '/html/static/img/icons/logo.png' })
TriggerClientEvent('gksphone:notifi', billed.PlayerData.source, {title = 'Billing', message = Loc[Config.Lan].success["inv_recieved"], img= '/html/static/img/icons/logo.png' })
end
triggerNotify(nil, Loc[Config.Lan].success["inv_succ"], 'success', src)
triggerNotify(nil, Loc[Config.Lan].success["inv_recieved"], nil, billed.PlayerData.source)
end
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) 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.gang == true then newdata.society = biller.PlayerData.gang.name end
if data.accept == true then
billed.Functions.RemoveMoney(tostring(data.billtype), data.amount)
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", data.amount) end
TriggerEvent('jim-payments:Tickets:Give', newdata, biller, data.gang)
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["payment"], "success", data.biller)
elseif data.accept == false then
triggerNotify(nil, Loc[Config.Lan].success["declined"], nil, src)
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].error["decline_pay"]..data.amount..Loc[Config.Lan].success["payment"], "error", data.biller)
end
end)
RegisterServerEvent("jim-payments:server:PolCharge", function(citizen, price)
local src = source
local biller = QBCore.Functions.GetPlayer(src)
local billed = QBCore.Functions.GetPlayer(tonumber(citizen))
local price = math.floor(tonumber(price))
local commission = math.floor(price * Config.FineJobs[biller.PlayerData.job.name].Commission)
if price > 0 then
if not Config.FineJobConfirmation then
if billed.Functions.RemoveMoney("bank", price) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..price.."^7") end end
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", price) end
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
if Config.RenewedBanking then exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.job.name), (price - commission))
if Config.Debug then print("^5Debug^7: ^3Renewed-Banking^7(^3Job^7): ^2Adding ^7$^6"..(price - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports['Renewed-Banking']:getAccountMoney((biller.PlayerData.job.name).."^7)")) end
else
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), (price - commission))
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..(price - takecomm).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
end
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["charged"]..(price - commission), "success", src)
triggerNotify(nil, Loc[Config.Lan].success["you_charged"]..(price - commission), nil, billed.PlayerData.source)
else
TriggerClientEvent("jim-payments:client:PolPopup", billed.PlayerData.source, price, src, biller.PlayerData.job.label)
end
else triggerNotify(nil, Loc[Config.Lan].error["charge_zero"], 'error', source) return end
end)
RegisterServerEvent("jim-payments:server:PolPopup", function(data)
local src = source
local billed = QBCore.Functions.GetPlayer(src)
local biller = QBCore.Functions.GetPlayer(tonumber(data.biller))
data.amount = math.floor(data.amount)
local commission = math.floor(tonumber(data.amount) * Config.FineJobs[biller.PlayerData.job.name].Commission)
if data.accept == true then
if billed.Functions.RemoveMoney("bank", data.amount) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Player^7(^6"..billed.PlayerData.source.."^7) ^2charged ^7$^6"..data.amount.."^7") end end
if Config.ApGov then exports['ap-government']:chargeCityTax(billed.PlayerData.source, "Item", data.amount) end
triggerNotify(nil, billed.PlayerData.charinfo.firstname..Loc[Config.Lan].success["accepted_pay"]..data.amount..Loc[Config.Lan].success["charge_end"], "success", data.biller)
if biller.Functions.AddMoney("bank", commission) then if Config.Debug then print("^5Debug^7: ^3PolCharge^7 - ^2Commission^2 of ^7$^6"..commission.." ^2sent to Player^7(^6"..biller.PlayerData.source.."^7)") end end
if Config.RenewedBanking then exports['Renewed-Banking']:addAccountMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
if Config.Debug then print("^5Debug^7: ^3Renewed-Banking^7(^3Job^7): ^2Adding ^7$^6"..(data.amount - commission).." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports['Renewed-Banking']:getAccountMoney((biller.PlayerData.job.name).."^7)")) end
else
exports["qb-management"]:AddMoney(tostring(biller.PlayerData.job.name), data.amount - commission)
if Config.Debug then print("^5Debug^7: ^3QB-Management^7(^3Job^7): ^2Adding ^7$^6"..data.amount - takecomm.." ^2to account ^7'^6"..tostring(biller.PlayerData.job.name).."^7' ($^6"..exports["qb-management"]:GetAccount(biller.PlayerData.job.name).."^7)") end
end
else
triggerNotify(nil, Loc[Config.Lan].error["declined_payment"], nil, src)
triggerNotify(nil, billed.PlayerData.charinfo.firstname.." declined the $"..data.amount..Loc[Config.Lan].success["charge_end"], "error", data.biller)
end
end)
QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, cb)
local onlineList = {}
for _, 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)

121
shared/shared.lua Normal file
View File

@@ -0,0 +1,121 @@
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)
local time = 1000
function loadModel(model) if not HasModelLoaded(model) then
if Config.Debug then print("^5Debug^7: ^2Loading Model^7: '^6"..model.."^7'") end
while not HasModelLoaded(model) do
if time > 0 then time -= 1 RequestModel(model)
else time = 1000 print("^5Debug^7: ^3LoadModel^7: ^2Timed out loading model ^7'^6"..model.."^7'") break
end
Wait(10)
end
end end
function unloadModel(model) if Config.Debug then print("^5Debug^7: ^2Removing Model^7: '^6"..model.."^7'") end SetModelAsNoLongerNeeded(model) end
function loadAnimDict(dict) if not HasAnimDictLoaded(dict) then if Config.Debug then print("^5Debug^7: ^2Loading Anim Dictionary^7: '^6"..dict.."^7'") end while not HasAnimDictLoaded(dict) do RequestAnimDict(dict) Wait(5) end end end
function unloadAnimDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Anim Dictionary^7: '^6"..dict.."^7'") end RemoveAnimDict(dict) end
function loadPtfxDict(dict) if not HasNamedPtfxAssetLoaded(dict) then if Config.Debug then print("^5Debug^7: ^2Loading Ptfx Dictionary^7: '^6"..dict.."^7'") end while not HasNamedPtfxAssetLoaded(dict) do RequestNamedPtfxAsset(dict) Wait(5) end end end
function unloadPtfxDict(dict) if Config.Debug then print("^5Debug^7: ^2Removing Ptfx Dictionary^7: '^6"..dict.."^7'") end RemoveNamedPtfxAsset(dict) end
function lookEnt(entity)
if type(entity) == "vector3" then
if not IsPedHeadingTowardsPosition(PlayerPedId(), entity, 10.0) then
TaskTurnPedToFaceCoord(PlayerPedId(), entity, 1500)
if Config.Debug then print("^5Debug^7: ^2Turning Player to^7: '^6"..json.encode(entity).."^7'") end
Wait(1500)
end
else
if DoesEntityExist(entity) then
if not IsPedHeadingTowardsPosition(PlayerPedId(), GetEntityCoords(entity), 30.0) then
TaskTurnPedToFaceCoord(PlayerPedId(), GetEntityCoords(entity), 1500)
if Config.Debug then print("^5Debug^7: ^2Turning Player to^7: '^6"..entity.."^7'") end
Wait(1500)
end
end
end
end
function destroyProp(entity)
if Config.Debug then print("^5Debug^7: ^2Destroying Prop^7: '^6"..entity.."^7'") end
SetEntityAsMissionEntity(entity) Wait(5)
DetachEntity(entity, true, true) Wait(5)
DeleteObject(entity)
end
function makeProp(data, freeze, synced)
loadModel(data.prop)
local prop = CreateObject(data.prop, data.coords.x, data.coords.y, data.coords.z, synced or false, synced or false, 0)
SetEntityHeading(prop, data.coords.w+180.0)
FreezeEntityPosition(prop, freeze or 0)
if Config.Debug then print("^5Debug^7: ^6Prop ^2Created ^7: '^6"..prop.."^7'") end
return prop
end
function makePed(model, coords, freeze, collision, scenario, anim)
loadModel(model)
local ped = CreatePed(0, model, coords.x, coords.y, coords.z-1.03, coords.w, false, false)
SetEntityInvincible(ped, true)
SetBlockingOfNonTemporaryEvents(ped, true)
FreezeEntityPosition(ped, freeze or true)
if collision then SetEntityNoCollisionEntity(ped, PlayerPedId(), false) end
if scenario then TaskStartScenarioInPlace(ped, scenario, 0, true) end
if anim then
loadAnimDict(anim[1])
TaskPlayAnim(ped, anim[1], anim[2], 1.0, 1.0, -1, 1, 0.2, 0, 0, 0)
end
if Config.Debug then print("^5Debug^7: ^6Ped ^2Created for location^7: '^6"..model.."^7'") end
return ped
end
function makeBlip(data)
local blip = AddBlipForCoord(data.coords)
SetBlipAsShortRange(blip, true)
SetBlipSprite(blip, data.sprite or 1)
SetBlipColour(blip, data.col or 0)
SetBlipScale(blip, data.scale or 0.7)
SetBlipDisplay(blip, (data.disp or 6))
BeginTextCommandSetBlipName('STRING')
AddTextComponentString(tostring(data.name))
EndTextCommandSetBlipName(blip)
if Config.Debug then print("^5Debug^7: ^6Blip ^2created for location^7: '^6"..data.name.."^7'") end
return blip
end
function triggerNotify(title, message, type, src)
if Config.Notify == "okok" then
if not src then exports['okokNotify']:Alert(title, message, 6000, type or 'info')
else TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type or 'info') end
elseif Config.Notify == "qb" then
if not src then TriggerEvent("QBCore:Notify", message, "primary")
else TriggerClientEvent("QBCore:Notify", src, message, "primary") end
elseif Config.Notify == "t" then
if not src then exports['t-notify']:Custom({title = title, style = type, message = message, sound = true})
else TriggerClientEvent('t-notify:client:Custom', src, { style = type, duration = 6000, title = title, message = message, sound = true, custom = true}) end
elseif Config.Notify == "infinity" then
if not src then TriggerEvent('infinity-notify:sendNotify', message, type)
else TriggerClientEvent('infinity-notify:sendNotify', src, message, type) end
elseif Config.Notify == "rr" then
if not src then exports.rr_uilib:Notify({msg = message, type = type, style = "dark", duration = 6000, position = "top-right", })
else TriggerClientEvent("rr_uilib:Notify", src, {msg = message, type = type, style = "dark", duration = 6000, position = "top-right", }) end
end
end
function pairsByKeys(t)
local a = {}
for n in pairs(t) do a[#a+1] = n end
table.sort(a)
local i = 0
local iter = function() i += 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end
return iter
end
function countTable(table) local i = 0 for keys in pairs(table) do i += 1 end return i end
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