Giter Club home page Giter Club logo

qb-banking's Introduction

QB-Banking

Features

  • Handles all player interaction with bank/job/gang/shared accounts
  • ATM and bank card integration
  • Shared accounts between players
  • Auto creation of job/gang accounts on bank first open
  • Boss-only access to job/gang accounts

Exports

exports['qb-banking']:ExportName() -- replace export name with desired from below and needed arguments

CreatePlayerAccount

Creates a new shared account for a player

    CreatePlayerAccount(
        playerId, -- id of the player account is being created for
        accountName, -- name of the account, must be a string
        accountBalance, -- balance of the account on creation, must be a number
        json.encode({'LCC00307', 'LCC00308'}) -- table of users on account by citizenid
    )

CreateJobAccount

Creates a new job type account, this is automatically done so shouldn't need this

    CreateJobAccount(
        accountName, -- name of the account, must be a string
        accountBalance, -- balance of the account on creation, must be a number
    )

CreateGangAccount

Creates a new gang type account, this is automatically done so shouldn't need this

    CreateGangAccount(
        accountName, -- name of the account, must be a string
        accountBalance, -- balance of the account on creation, must be a number
    )

AddMoney

Adds money to an account by name, checks for regular account first If playerId is provided and a regular account isn't found then it will check for shared account

    AddMoney(
        accountName, -- name of the account, must be a string
        accountBalance, -- balance of the account on creation, must be a number
        reason -- optional, must be a string
    )

RemoveMoney

Removes money from an account by name, checks for regular account first If playerId is provided and a regular account isn't found then it will check for shared account

    RemoveMoney(
        accountName, -- name of the account, must be a string
        accountBalance, -- balance of the account on creation, must be a number
        reason -- optional, must be a string
    )

GetAccount

Returns all the information for the specified account by name

    GetAccount(
        accountName, -- name of the account
    )

GetAccountBalance

Returns just the balance of the specified account by name

    GetAccountBalance(
        accountName, -- name of the account
    )

CreateBankStatement

This will create a statement for a specified account

    CreateBankStatement(
        playerId, -- id of the player to create the statement for
        account, -- name of the shared account, must be a string
        amount, -- amount of the transaction, must be a number
        reason, -- reason for the transaction , must be a string
        statementType, -- type of statement, must be a string 'withdraw' or 'deposit'
        accountType -- type of account, must be a string 'player', 'shared', 'job', 'gang'
    )

License

QBCore Framework
Copyright (C) 2021 Joshua Eger

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>

qb-banking's People

Contributors

aalbonn avatar adamsimondev avatar alexandree5 avatar ansljeremy avatar backsh00ter avatar berkiebb avatar dertweaky avatar duboiss avatar enzodcdev avatar evanillaa avatar flowdgodx avatar ghzgarage avatar holidayy95 avatar jay-fivem avatar mirrox1337 avatar nevaraven87 avatar newtonzz avatar notaestheticallyducko avatar nylanderrdk avatar pride1922 avatar s33g avatar suelthedev avatar swellington-soares avatar theilleniumstudios avatar tom-osborne avatar tomboru avatar tonybynmp4 avatar trclassic92 avatar z3rio avatar zfbx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qb-banking's Issues

The line "provides qb-management" in the fxmanifest

The line "provides qb-management" in the qb-banking fxmanifest causes qb-management to not start at all. Which in turn makes boss menus not open without restarting qb-management manually. I commented the line out of the fxmanifest and my management works like before. Just wanted to throw this out there.

[BUG] Use of "E" in account number input causes NUI closure

Describe the bug
When using the html input for account number (transfer), if it contains the character e, which is the same which is the same for opening/closing NUI, there is a conflict and the nui is closed

To Reproduce
Steps to reproduce the behavior:

  1. Go to the bank
  2. Open the menu and go to transfer tab
  3. Use account number input and type "e" inside
  4. See behavior

Expected behavior
Be able to use e character in the input

add givecash

QBCore.Commands.Add('givecash', 'Give cash to player.', {{name = 'id', help = 'Player ID'}, {name = 'amount', help = 'Amount'}}, true, function(source, args)
    local src = source
	local id = tonumber(args[1])
	local amount = math.ceil(tonumber(args[2]))
    
	if id and amount then
		local xPlayer = QBCore.Functions.GetPlayer(src)
		local xReciv = QBCore.Functions.GetPlayer(id)
		
		if xReciv and xPlayer then
			if not xPlayer.PlayerData.metadata["isdead"] then
				local distance = xPlayer.PlayerData.metadata["inlaststand"] and 3.0 or 10.0
				if #(GetEntityCoords(GetPlayerPed(src)) - GetEntityCoords(GetPlayerPed(id))) < distance then
					if xPlayer.Functions.RemoveMoney('cash', amount) then
						if xReciv.Functions.AddMoney('cash', amount) then
							TriggerClientEvent('QBCore:Notify', src, "Success fully gave to ID " .. tostring(id) .. ' ' .. tostring(amount) .. '$.', "success")
							TriggerClientEvent('QBCore:Notify', id, "Success recived gave " .. tostring(amount) .. '$ from ID ' .. tostring(src), "success")
							TriggerClientEvent("payanimation", src)
						else
							TriggerClientEvent('QBCore:Notify', src, "Could not give item to the given id.", "error")
						end
					else
						TriggerClientEvent('QBCore:Notify', src, "You don\'t have this amount.", "error")
					end
				else
					TriggerClientEvent('QBCore:Notify', src, "You are too far away lmfao.", "error")
				end
			else
				TriggerClientEvent('QBCore:Notify', src, "You are dead LOL.", "error")
			end
		else
			TriggerClientEvent('QBCore:Notify', src, "Wrong ID.", "error")
		end
	else
		TriggerClientEvent('QBCore:Notify', src, "Usage /givecash [ID] [AMOUNT]", "error")
	end
end)

Qb banking glitch

Hey so is the Qb banking broken? because someone just foound a flaw that if they transfer someone billions of dollars they go negative but the other person get billions in his bank. How can i fix this? ik this isnt a suppport channel but i just wanted to let this be known so it can be fixed

bank transfer

i cant transfer a money in the bank its showing like this
151191738-74a749af-9318-4227-ab5f-85c130e87aa2

Savings Mature?

Where is the section that makes the savings account mature?

[BUG]atms not working

Describe the bug
A clear and concise description of what the bug is. A stranger to qbcore should be able to read your bug report and understand how to reproduce it themselves and understand how the feature should work normally.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '.atms..'
  2. Click on 'nothing to interact with'
  3. Use this item none' (item's name from shared.lua if applicable)
  4. See error no error

Expected behavior
i have downloaded your new qb-banking i cant get any of the atms to work at all nothing shows up when i use qb-target and no e prompt shows up i have went into the bank and created a new card but i never get a card as an item if thats hpw its supposed to work or not

Screenshots
If applicable, add screenshots to help explain your problem.

Questions (please complete the following information):

  • When you last updated: the most current
  • Are you using custom resource? which ones? qb-target
  • Have you renamed qb- to something custom? no

Additional context
Add any other context about the problem here.

[BUG] ATMs not working on ox_inventory

Describe the bug
Try to use the atms but is not working on ox_inventory. I think the meta information are not in the card.

To Reproduce
Steps to reproduce the behavior:
Buy an bank card with ox_inventory running.

Screenshots
image

ATM dose not work

Describe the bug
When I interact to open the atm (after getting a bank) card nothing happens, I see this in TX Admin console tho,

[   script:qb-banking] SCRIPT ERROR: @qb-banking/server.lua:192: attempt to index a nil value (field 'info')
[   script:qb-banking] > TriggerCallback (@qb-core/server/functions.lua:365)
[   script:qb-banking] > handler (@qb-core/server/events.lua:104)
[      script:qb-core] SCRIPT ERROR: error object is not a string

To Reproduce
Steps to reproduce the behavior:

  1. Go to bank and get a bank card
  2. Interact with atm (Open ATM)
  3. Atm shows loading bar gets to 100% and nothing happens
  4. I get the error

Expected behavior
The ATM gui is meant to open

Screenshots
Here, I have a video

FiveM.by.Cfx.re.-.Cavern.RP.2024-01-29.13-12-45.mp4

Questions (please complete the following information):

  • When you last updated: It has always been happening.
  • Are you using custom resource? which ones? I am using ox-inventory and ox-target
  • Have you renamed qb- to something custom? No

Additional context
Nope

Banking Does Not Work[BUG]

When I try to goto the bank and press "E" nothing happens. When I check the live console and error shows up (posted below). How do I fix this?

[ script:qb-core] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:741: SCRIPT ERROR: @qb-banking/server/main.lua:215: qb-banking was unable to execute a query!
[ script:qb-core] Table 'zap894799-1.bank_cards' doesn't exist
[ script:qb-core] SELECT * FROM bank_cards WHERE citizenid = ? ORDER BY record_id DESC LIMIT 1 ["UXL45698"]

Transfers

When i'm trying to transfer money in the bank, not in the phone, I get the following error:
"There was an error with the information you have entered, please ensure the account number, sort code and amount is correctly filled out."

I'm using the right bank account number.

Also we do not have any phone notification when we recieve a transfer, only when we spend money.

[SUGGESTION]

Hi, is it possible to link the item usage of the Visa and Mastercard in front of an ATM to /atm, so players do not have to use a /atm command ?

no /atm

/atm isnt popping up as a command

Non existent Location

I checked all the bank location (coords] and this one is nothing: 1653.41, 4850.6, 41.99 IDK if it should be like that but there is nothing in that building. From the outside it doesn't even look like a bank.
Capture

[SUGGESTION]

Is your feature request related to a problem? Please describe.
i seeing this feature, but not showing on in-game bank

deneme

image

[BUG] - Order new card error - Card type forever showing as Visa.

Describe the bug
When using the banking script, the "order new card" always shows that the user has a VISA even if they do not, the card number updates but not the card TYPE.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'The Bank'
  2. Click on 'Order New Card'
  3. Use this item 'N/A' (item's name from shared.lua if applicable)
  4. See error

Expected behavior
Show the correct cart.

Screenshots
Screenshot 2023-01-12 015602
Screenshot 2023-01-12 015629

Questions (please complete the following information):

  • When you last updated: Today
  • Are you using custom resource? which ones? No.
  • Have you renamed qb- to something custom? No

Additional context
Add any other context about the problem here.

Oxmysql deprecation warning

Deprecation warning in Console if you update to Oxmysql >= 1.9

[script:oxmysql] [WARNING] qb-banking triggered a deprecated function! Exports from prior to v1.9.0 will be removed in a future update.
[script:oxmysql] Refer to the readme for information on updating.

[BUG]

Describe the bug
A clear and concise description of what the bug is. A stranger to qbcore should be able to read your bug report and understand how to reproduce it themselves and understand how the feature should work normally.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Bank and prees E and bank menu wont open and error in server console show'
  2. Click on '....'
  3. Use this item '....' (item's name from shared.lua if applicable)
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
https://i.imgur.com/8YLIwTg.png

Questions (please complete the following information):

  • When you last updated: [Today donwloaded from txadmin]
  • Are you using custom resource? which ones? [no all orginal pack qb from txadmin]
  • Have you renamed qb- to something custom? [no]

Additional context
Add any other context about the problem here.

How to change the currency?

Hi, after seeing a currency setting in the qb-hud something.lua. I wanted to know if the phone and banking/atm scripts had similar settings but found none.

Can someone share the proper way to change the currency?

Merry Xmas!

Problem with cash and bank money

Hi, it practically happens to me that if in game I withdraw money from the bank or send them it tells me the right amounts. But the moment I exit the server and come back, the character creation money returns. How should I do?

[BUG] Continuing issue wit multcharacter bank balance

I have had this issue for some time , even updated to most recent release and still have problem.
The issue happens sometimes. If you have mutilple characters , (qb-multicharcter) The bank balances will overwrite each other and all of charcters will have the same bank amounts. Ive have numerous reports of it happeing with the latest being today. Person have 3 characters , one had 1.2 million , not all 3 of theyre charcters have 119k.

If the fix to not use multicharacter? Is there a work around to prevent this?

[BUG] Change card PIN not syncing to player inventory

Describe the bug
When changing card PIN, the new PIN won't be recognized on ATMs. The PIN stays at when you first created the card. Looking at the database and quick look at the code, it seems that the record updates the data on bank_cards but is not being cascaded to the inventory field in players. Thus, the PIN stays at when you first created the card. Additionally, the ATM login page does not show errors and notifications.

To Reproduce
Steps to reproduce the behavior:

  1. Create a debit card
  2. Change the PIN
  3. Open ATM using new PIN
  4. You won't be able to login unless you use the PIN you used when you created the card (You won't see wrong PIN error message due to bug in ATM login page)

[BUG]

Describe the bug
If qb-target is set to false, the ATMs no longer work. If the target is set to true, they work again.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'server.cfg'
  2. Change target from true to false
  3. control the ATM´s in Game.

With kind regards

[SUGGESTION] optimize the server part

Why does the qb-banking part of the server.lua use a while loop? If there are a lot of events running, it will cause a lot of resource utilization in the svgui.

image

If an Event is called repeatedly it causes the while loop to run all the time and increments with the event. I'm worried that it will use too much server resources.
image

[BUG] SQL Issue

I get it while executing

CREATE TABLE IF NOT EXISTS `bank_accounts` (
  `record_id` bigint(255) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(250) DEFAULT NULL,
  `business` varchar(50) DEFAULT NULL,
  `businessid` int(11) DEFAULT NULL,
  `gangid` varchar(50) DEFAULT NULL,
  `amount` bigint(255) NOT NULL DEFAULT 0,
  `account_type` enum('Current','Savings','business','Gang') NOT NULL DEFAULT 'Current',
  PRIMARY KEY (`record_id`),
  UNIQUE KEY `citizenid` (`citizenid`),
  KEY `business` (`business`),
  KEY `businessid` (`businessid`),
  KEY `gangid` (`gangid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `bank_statements` (
  `record_id` bigint(255) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(50) DEFAULT NULL,
  `account` varchar(50) DEFAULT NULL,
  `business` varchar(50) DEFAULT NULL,
  `businessid` int(11) DEFAULT NULL,
  `gangid` varchar(50) DEFAULT NULL,
  `deposited` int(11) DEFAULT NULL,
  `withdraw` int(11) DEFAULT NULL,
  `balance` int(11) DEFAULT NULL,
  `date` varchar(50) DEFAULT NULL,
  `type` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`record_id`),
  KEY `business` (`business`),
  KEY `businessid` (`businessid`),
  KEY `gangid` (`gangid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `bank_cards` (
  `record_id` bigint(255) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(50),
  `cardNumber` varchar(50) DEFAULT NULL,
  `cardPin` varchar(50) DEFAULT NULL,
  `cardActive` tinyint(4) DEFAULT 1,
  `cardLocked` tinyint(4) DEFAULT 0,
  `cardType` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`citizenid`),
  KEY `record_id` (`record_id`),
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

image

Transferring via main bank not working

When transferring through the main banking UI it says the account number is not recognized. However when doing it through the phone it is working okay.

[BUG]

Describe the bug
gettting SQL entry Error when depositing money and withdrawing money

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Go To Bank and deposit or withdraw money ...'

Expected behavior
Information to enter correctly and save

Screenshots
Untitled

Questions (please complete the following information):

  • When you last updated: [tried updating to newer banking but got a whole host of different errors]
  • Are you using custom resource? which ones? [yes using 450 resources to many to name sorry]
  • Have you renamed qb- to something custom? [no]

Additional context
i seems to register the money change but showing the database error

complete bank script command

There are sometimes we can not add suggestions
I hope you open the door to everyone for add pull request

QBCore.Commands.Add('givecash', 'Give cash to player.', {{name = 'id', help = 'Player ID'}, {name = 'amount', help = 'Amount'}}, true, function(source, args)
    local src = source
	local id = tonumber(args[1])
	local amount = math.ceil(tonumber(args[2]))
    
	if id and amount then
		local xPlayer = QBCore.Functions.GetPlayer(src)
		local xReciv = QBCore.Functions.GetPlayer(id)
		
		if xReciv and xPlayer then
			if not xPlayer.PlayerData.metadata["isdead"] then
				local distance = xPlayer.PlayerData.metadata["inlaststand"] and 3.0 or 10.0
				if #(GetEntityCoords(GetPlayerPed(src)) - GetEntityCoords(GetPlayerPed(id))) < distance then
					if xPlayer.Functions.RemoveMoney('cash', amount) then
						if xReciv.Functions.AddMoney('cash', amount) then
							TriggerClientEvent('QBCore:Notify', src, "Success fully gave to ID " .. tostring(id) .. ' ' .. tostring(amount) .. '$.', "success")
							TriggerClientEvent('QBCore:Notify', id, "Success recived gave " .. tostring(amount) .. '$ from ID ' .. tostring(src), "success")
							TriggerClientEvent("payanimation", src)
						else
							TriggerClientEvent('QBCore:Notify', src, "Could not give item to the given id.", "error")
						end
					else
						TriggerClientEvent('QBCore:Notify', src, "You don\'t have this amount.", "error")
					end
				else
					TriggerClientEvent('QBCore:Notify', src, "You are too far away lmfao.", "error")
				end
			else
				TriggerClientEvent('QBCore:Notify', src, "You are dead LOL.", "error")
			end
		else
			TriggerClientEvent('QBCore:Notify', src, "Wrong ID.", "error")
		end
	else
		TriggerClientEvent('QBCore:Notify', src, "Usage /givecash [ID] [AMOUNT]", "error")
	end
end)
RegisterNetEvent("payanimation")
AddEventHandler("payanimation", function()
TriggerEvent('animations:client:EmoteCommandStart', {"id"})
end)

[Suggestion] Improve ATM access

Why not adding a blip near all ATM's so we can get near one and press E to access it instead having to use /atm.
I do own a list of coordinates for ATMs all around the map.

[BUG]

Describe the bug
Why is this in config if it doesn't do anything?

Config.ATMModels = {
"prop_atm_01",
"prop_atm_02",
"prop_atm_03",
"prop_fleeca_atm"
}

[BUG] Banking is not showing an throws error in tx-console

[ script:qb-core] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:739: SCRIPT ERROR: @qb-banking/server/main.lua:188: attempt to index a nil value (local 'int')
[ script:qb-core] > format_int (@qb-banking/server/main.lua:188)
[ script:qb-core] > ref (@qb-banking/server/main.lua:246)
[ script:qb-core] > rawQuery (@oxmysql/dist/build.js:25047)
[ script:qb-core] > processTicksAndRejections (node:internal/process/task_queues:96)
[ script:qb-core]
[ script:qb-core] > TriggerCallback (@qb-core/server/functions.lua:337)
[ script:qb-core] > handler (@qb-core/server/events.lua:146)
[ script:qb-core] > rawQuery (@oxmysql/dist/build.js:25047)
[ script:qb-core] > processTicksAndRejections (node:internal/process/task_queues:96)

This error showed up in my Console. I Press E to open the Bank nothing is happen and the the error comes.

Sort Code

what is a sort code, it is required when transferring money to an account, it must be transmitted to the ui in the qb-banking procedure:getBankingInformation, but not transmitted

[BUG] Creating shared accounts doesn't have lower/upper case sensitive.

Describe the bug
If you create a shared account called 'Shared' and someone afterwards create an account called 'shared' it will be visible in the banking list until you restart your game. The money is taken from your account and you can see them in the account, but it wont be visible after relog / server restart because it doesn't create it in the database.

To Reproduce

  1. Create an account named 'Shared' and it will be visible and inserted into the database correctly.
  2. Create an account named 'shared' and it will be visible and not inserted into the database because the name has to be unique.

Expected behavior
The expected behavior would be that you get an error message that the name is already taken.

Questions (please complete the following information):

  • When you last updated: today
  • Are you using custom resource?: I'm using ox_lib, ox_inventory, ox_target, ox_fuel
  • Have you renamed qb- to something custom?: no

[SUGGESTION] Savings Account

Is your feature request related to a problem? Please describe.
Where did the savings accounts go?

Describe the feature you'd like
Savings Accounts

Describe alternatives you've considered
different banking script

[BUG] Refused to apply style

Describe the bug
Not really a major problem and not causing any crashes etc but this is happening to me for some reason.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'enter the game and this pops up in the F8 menu, that is all'
  2. Click on 'F8'
  3. Use this item 'None' (item's name from shared.lua if applicable)
  4. See error attached below:

Screenshot_2

Expected behavior
Simply just not refusal/error showing as it does.

Screenshots
Added above.

Questions (please complete the following information):

  • When you last updated: [e.g. last week] -> all up to date with recent versions.
  • Are you using custom resource? which ones? [e.g. zdiscord, qb-target] -> yes, but also without this is happening.
  • Have you renamed qb- to something custom? [e.g. yes/no] -> no!

Additional context
As I said, this is not major, just thought I would report it. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.