- Before you start,
BACKUP
yourresources
folder cause when something is wrong you have a backup. - This is the best cash/blackmoney/crypto item script for your qbcore server.
- The
cash
,black_money
,crypto
is not dependent on the item amount, but the item amount is dependent on the currency amount.
- This is not just a plug and play script, you need some coding experience to install this script.
- Don't ask questions that are already in the readme files, you already have an answer...
- qb-core
- qb-inventory 2.0.0
- Add in your server.cfg
ensure mh-cashasitem
, make sure this is aboveensure [qb]
- Make sure you read the readme files for install, and only when you are done you can restart the server.
ensure qb-core
ensure mh-cashasitem -- add here
ensure [qb]
ensure [standalone]
ensure [voice]
ensure [defaultmaps]
ensure [mh]
/cash
to see the amount/bank
to see the amount/blackmoney
to see the amount/crypto
to see the amount
- first you need to edit the qb-core/config.lua to this below add black_money to this tables
QBConfig.Money.MoneyTypes = { cash = 500, bank = 5000, crypto = 0, black_money = 0 } -- type = startamount - Add or remove money types for your server (for ex. blackmoney = 0), remember once added it will not be removed from the database!
QBConfig.Money.DontAllowMinus = { 'cash', 'crypto', 'black_money' } -- Money that is not allowed going in minus
- use this server side only when you add or delete an item from and to a inventory.
- Also use this for item movment in the inventory.
- First you need to add or remove an item in your inventory before you can use the exports.
-- Add Item Example
Player.Functions.AddItem(ItemData.name, amount, toSlot, ItemData.info)
exports['mh-cashasitem']:UpdateCash(source, ItemData, amount, "add")
-- Remove Item Example
Player.Functions.RemoveItem(ItemData.name, amount, toSlot)
exports['mh-cashasitem']:UpdateCash(source, ItemData, amount, "remove")
-
The black_money uses the item amount as a number,
-
and the marketbills uses the item amount as a table.
-
so you need to edit that part of the code.
-
from this
local worth = {value=10} -- table
Player.Functions.AddItem('marketbills', worth) -- to add marketbills
Player.Functions.RemoveItem('marketbills', worth)-- to remove marketbills
- to this
local amount = 10 -- number
Player.Functions.AddMoney('black_money', amount) -- to add blackmoney
Player.Functions.RemoveMoney('black_money', amount) -- to remove blackmoney