My5FiveM resource discovery
๐Ÿ’ต Pulse Cash Item (ESX OpenSource Multi Inventory Support!
Scripts

๐Ÿ’ต Pulse Cash Item (ESX OpenSource Multi Inventory Support!

Store ยท Pulse Dev Co
30 CAD(โ‰ˆ21.08 USD)billing unknown
Report incorrect information

Prices and availability may change. Confirm the terms in the original store.

About this resource

pulse-cashitem README.txt ======================================== 1. INFORMATION ======================================== pulse-cashitem is an ESX cash-as-item resource for FiveM. It allows your server to use physical cash as an inventory item instead of relying on normal ESX cash account functions. This version supports multiple inventory backends through config. Supported inventory modes: - esx - ox - qs - mf - chezza - custom Main features: - physical cash item support - multi-inventory bridge - exports for add/remove/get/set/has cash - player-to-player cash transfer - nearby cash give command - cash balance command - optional usable cash conversion - simple config setup ======================================== 2. RESOURCE STRUCTURE ======================================== pulse-cashitem/ โ”œโ”€โ”€ fxmanifest.lua โ”œโ”€โ”€ config.lua โ”œโ”€โ”€ client/ โ”‚ โ””โ”€โ”€ main.lua โ”œโ”€โ”€ server/ โ”‚ โ””โ”€โ”€ main.lua โ””โ”€โ”€ README.txt If your ESX setup uses SQL-based items, also keep your SQL insert ready. ======================================== 3. REQUIREMENTS ======================================== Required: - es_extended Optional depending on your setup: - ox_inventory - qs-inventory - mf-inventory - chezza inventory - default ESX inventory This resource does not magically convert every script on your server. Any script that still uses xPlayer.addMoney(), xPlayer.removeMoney(), or xPlayer.getMoney() should be changed to use pulse-cashitem exports if you want full physical cash support. ======================================== 4. INSTALLATION ======================================== Step 1: Place the resource in your server resources folder. Example: resources/[local]/pulse-cashitem Step 2: Add the cash item to your item system. You can use the SQL in section 10 if your framework stores items in the database. Step 3: Configure your inventory backend in config.lua. Step 4: Ensure the resource in server.cfg after es_extended and after your inventory resource. Example: ensure es_extended ensure ox_inventory ensure pulse-cashitem Or for default ESX inventory: ensure es_extended ensure pulse-cashitem ======================================== 5. CONFIGURATION ======================================== Example config.lua: Config = {} -- Inventory backend: -- 'esx' = standard xPlayer inventory functions -- 'ox' = ox_inventory -- 'qs' = qs-inventory -- 'mf' = mf-inventory -- 'chezza' = chezza-inventory -- 'custom' = use your own functions in the bridge Config.Inventory = 'esx' -- Item name used for physical cash Config.CashItem = 'cash' -- Command to give cash to nearby players Config.EnableGiveCashCommand = true Config.GiveCashCommand = 'givecash' -- Max distance between players for /givecash and /givecashnear Config.GiveCashDistance = 3.0 -- Enable notifications Config.UseNotifications = true -- Check carry weight/space before adding item Config.UseCanCarryItem = true -- Block nil, zero, or negative values Config.PreventInvalidAmounts = true -- Optional usable cash item conversion Config.EnableUseCashItem = false Config.UseCashAddsToAccount = 'money' -- 'money' or 'bank' Config.UseCashAmountPerItem = 1 -- Debug prints Config.Debug = false ======================================== 6. INVENTORY BACKENDS ======================================== A. Default ESX inventory Use: Config.Inventory = 'esx' B. ox_inventory Use: Config.Inventory = 'ox' C. qs-inventory Use: Config.Inventory = 'qs' D. mf-inventory Use: Config.Inventory = 'mf' E. chezza inventory Use: Config.Inventory = 'chezza' F. Custom inventory Use: Config.Inventory = 'custom' If you use custom, edit the custom sections in server/main.lua: - GetItemCount - CanCarry - AddItem - RemoveItem ======================================== 7. PLAYER COMMANDS ======================================== /givecash [id] [amount] Gives physical cash to a player by server ID. /givecashnear [amount] Gives physical cash to the nearest player within Config.GiveCashDistance. /cashcount Shows how much physical cash the player currently has. Examples: /givecash 12 500 /givecashnear 250 /cashcount ======================================== 8. EXPORTS ======================================== This resource provides the following exports: exports['pulse-cashitem']:AddCash(source, amount, reason) exports['pulse-cashitem']:RemoveCash(source, amount, reason) exports['pulse-cashitem']:SetCash(source, amount, reason) exports['pulse-cashitem']:GetCash(source) exports['pulse-cashitem']:HasCash(source, amount) ---------------------------------------- AddCash ---------------------------------------- Example: local ok, err = exports['pulse-cashitem']:AddCash(source, 500, 'job payout') Adds physical cash item to the player. ---------------------------------------- RemoveCash ---------------------------------------- Example: local ok, err = exports['pulse-cashitem']:RemoveCash(source, 250, 'shop purchase') Removes physical cash item from the player. ---------------------------------------- SetCash ---------------------------------------- Example: local ok, err = exports['pulse-cashitem']:SetCash(source, 1000, 'admin set') Sets the player cash item amount to an exact value. ---------------------------------------- GetCash ---------------------------------------- Example: local cash = exports['pulse-cashitem']:GetCash(source) Returns current physical cash amount. ---------------------------------------- HasCash ---------------------------------------- Example: local hasCash = exports['pulse-cashitem']:HasCash(source, 100) Returns true if the player has enough physical cash. ======================================== 9. SCRIPT CONVERSION EXAMPLES ======================================== Old ESX style: xPlayer.addMoney(500) xPlayer.removeMoney(250) local cash = xPlayer.getMoney() New pulse-cashitem style: exports['pulse-cashitem']:AddCash(source, 500, 'reward') exports['pulse-cashitem']:RemoveCash(source, 250, 'purchase') local cash = exports['pulse-cashitem']:GetCash(source) ---------------------------------------- Example purchase ---------------------------------------- RegisterNetEvent('myshop:buyWater', function() local src = source local xPlayer = ESX.GetPlayerFromId(src) local price = 50 if not exports['pulse-cashitem']:HasCash(src, price) then TriggerClientEvent('esx:showNotification', src, 'Not enough cash.') return end local removed = exports['pulse-cashitem']:RemoveCash(src, price, 'buy water') if not removed then TriggerClientEvent('esx:showNotification', src, 'Payment failed.') return end xPlayer.addInventoryItem('water', 1) TriggerClientEvent('esx:showNotification', src, 'You bought water.') end) ======================================== 10. CASH ITEM SQL ======================================== Use this SQL if your framework stores items in the items table. Standard SQL: INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('cash', 'Cash', 0, 0, 1); If your items table uses different columns, adjust it to your schema. Example for some older ESX schemas: INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES ('cash', 'Cash', -1, 0, 1); Only use the version that matches your database structure. ======================================== 11. CASH ITEM FOR NON-SQL ITEM SYSTEMS ======================================== If your inventory does not use SQL items, add the item wherever your inventory stores item definitions. Typical item name: cash Typical label: Cash Example idea: - name: cash - label: Cash - weight: 0 - removable: true - stack: true ======================================== 12. OPTIONAL USABLE CASH MODE ======================================== If you enable: Config.EnableUseCashItem = true Players can use the cash item and convert it back into an ESX account. Config.UseCashAddsToAccount = 'money' or Config.UseCashAddsToAccount = 'bank' Config.UseCashAmountPerItem = 1 Example: If set to 1, using 1 cash item gives 1 account money or bank money. Most servers using full physical cash should keep this disabled. ======================================== 13. TROUBLESHOOTING ======================================== Problem: Cash item is not added. Check: - Is Config.Inventory set correctly? - Does your inventory actually have a cash item? - Is the item inserted in SQL if your server uses SQL items? - Is UseCanCarryItem blocking the add because of inventory weight/space? Problem: Script says add_failed or remove_failed. Check: - Your inventory export names may differ. - Your inventory may not use the same functions as this bridge. - Edit the bridge functions in server/main.lua for your exact inventory API. Problem: Old scripts still give account cash instead of item cash. Check: - Those scripts are still using xPlayer.addMoney, xPlayer.removeMoney, or xPlayer.getMoney. - Replace those with pulse-cashitem exports. Problem: givecash works, but givecashnear does not. Check: - Target player is actually nearby. - Distance is within Config.GiveCashDistance. - Both players are loaded correctly. - The player has enough physical cash. Problem: Cash item exists in inventory but cannot be used. Check: - Config.EnableUseCashItem - ESX.RegisterUsableItem support in your setup - whether your inventory requires item registration elsewhere ======================================== 14. CUSTOM INVENTORY SUPPORT ======================================== If your inventory is not listed, set: Config.Inventory = 'custom' Then edit these sections in server/main.lua: 1. GetItemCount Return the player's item count. 2. CanCarry Return whether the player can carry more of the item. 3. AddItem Add the item and return success. 4. RemoveItem Remove the item and return success. Basic example: if Config.Inventory == 'custom' then return exports['my-inventory']:GetItemCount(src, itemName) or 0 end if Config.Inventory == 'custom' then return exports['my-inventory']:CanCarryItem(src, itemName, amount) end if Config.Inventory == 'custom' then return exports['my-inventory']:AddItem(src, itemName, amount) end if Config.Inventory == 'custom' then return exports['my-inventory']:RemoveItem(src, itemName, amount) end ======================================== 15. RECOMMENDED SERVER ORDER ======================================== Example with default ESX inventory: ensure es_extended ensure pulse-cashitem Example with ox_inventory: ensure es_extended ensure ox_inventory ensure pulse-cashitem Example with qs-inventory: ensure es_extended ensure qs-inventory ensure pulse-cashitem ======================================== 16. NOTES ======================================== This resource is meant to turn cash into a physical item. That means full support depends on your other scripts using the exports from this resource. You should update money-related scripts such as: - shops - jobs - robbery scripts - reward systems - admin money commands - player trading scripts - billing alternatives - illegal sales scripts Any script still using normal ESX cash account functions will not fully use item cash. ======================================== 17. SUPPORT NOTES ======================================== If your server uses a modified inventory with different exports, adjust the bridge in server/main.lua. The most important functions are: - Inventory:GetItemCount - Inventory:CanCarry - Inventory:AddItem - Inventory:RemoveItem Once those match your inventory, the rest of the script will work normally. ======================================== 18. END ======================================== pulse-cashitem ESX cash as item resource