Studio PLAYERS
  • Studio PLAYERS
  • 📦QB/QBX SCRIPTS
    • 💸SA-MONEY
      • 💡Introduction
      • ⚙️Installation
        • ⚙️Installation
        • ⚙️Migration
        • ⚙️Add new currency
      • 🗃️Displays $ in inventory
      • 📚HUD Implementations
        • 📗17mov_Hud
        • 📗wais-hudv5
    • 💰SA-MONEYWASH
      • 💡Introduction
      • ⚙️Installation
    • 🕐SA-PLAYTIME
      • 💡Introduction
      • ⚙️Installation
      • ✈️Exports
    • ☠️SA-CHARACTERKILL
      • 💡Introduction
      • ⚙️Installation
    • 🧊SA-BOXE
      • 💡Introduction
      • 💡Usage
      • ⚙️Installation
    • 🚦SA-TRAFFICLIGHTSPRIORITY
      • 💡Introduction
      • ⚙️Installation
  • 📦ESX SCRIPTS
    • 🕐SA-PLAYTIME
      • 💡Introduction
      • ⚙️Installation
      • ✈️Exports
    • ☠️SA-CHARACTERKILL
      • 💡Introduction
      • ⚙️Installation
    • 🚦SA-TRAFFICLIGHTSPRIORITY
      • 💡Introduction
      • ⚙️Installation
  • 🛠️FAQ
    • 🛠️General Issues
    • 🛠️SA-Money-V2
Powered by GitBook
On this page
  1. QB/QBX SCRIPTS

SA-MONEY

Best script for Money as item

Last updated 1 year ago

This script is fully automated and workable for all scripts. All scripts are protected by the escrow system from CFX

What is open and what can you configure?

Here is locale

There you can setup your notify system

Features

  • Client Resmon - 0.00-0,01ms

  • Server Resmon - 1xCurrency - [0.00-0.02ms / 1 Player | +-80 Players 2.6ms]

  • Configurable - locale/language, config

We are using Asset Escrow system

📦
💸
Preview
Page cover image
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-Money/previews/config.lua
--|| INSTALATIION MANUAL || --

-- https://studio-players.gitbook.io/



--------------------------------------------------------------------------------------------------------------------------------



Config = {



    --------------

    --  TOOLS   --

    --------------



    Debug = false,          -- It start up debug mode which will print into console if the player passes through conditions (It must be all small true/false)

    Notifications = true,   -- This disable/enable notifications like 'You've paid xx$' etc.

    Experimental = 2,       -- This enables experimental feature that should improve performance. It's not tested properly! (Use it only if SA-Money-v2 has heavy impact on your server)

    -- Levels of experimental boost - 0 - Off, 1 - Medium boost, 2 - High boost (Recommended), 3 - Ultra boost

    -- Levels 1 & 3 might glitch on very slow servers



    --------------------------

    --  INVENTORY SETTINGS  --

    --------------------------



    Framework = 'qb-core',      -- Don't touch this. Change it only if you have renamed qb

    Inventory = 'qb-inventory',        -- Set it to name of your inventory resource you use, for example qb-inventory (PS,LJ,QB), ox_inventory, codem-inventory

    -- For custom inventory use 'custom' and change functions in functions.lua

    -----



    oldInv = false,              -- If you use new inventory system, which doesn't use functions, but exports instead set it to false.

    -- For example: core_inventory, old qb-inventory, lj-inventory etc.

    -----



    RefreshTime = 100,      -- This change how fast your inventory will be refreshed after buy. (100 = 100ms +-).

    -- Change this only if you have slow server or slow inventory system. LJ, QB Inventories work with 100ms, qs-inventory needs more around +200

    ItemProp = true, --This enables/disables making a prop on floor



    ---------------------------

    --  OVERWEIGHT SYSTEM    --

    ---------------------------

    -- This function will take care of your inventory weight, so if player has full inventory, this prevent to dissapear money. 

    -- Disable this if your inventory doesn't have exports("GetTotalWeight", GetTotalWeight)

    -- Disable if you are using (core_inventory, ox_inventory, codem_inventory and qs-inventory)

    Overweight = true,              -- true = enabled (this prevent to dissapear money)

    MaxInventoryWeight = 120000,    -- You find that in your qb-inventory > config.lua



    ------

    AutoRefresh = 1000, -- 1000ms = 1s (It's not exactly 1s). Sets how quickly money are refreshed | Lower number = worse optimization

    VersionCheck = true, -- Here is an option to disable the print of versions in the console.

}



--------------------------------------------------------------------------------------------------------------------------------



------------------

--  CURRENCIES  --

------------------



--This function add more currencies to work as item.

--To make more currencies follow our documentation >> https://studio-players.gitbook.io/



Money = { 

    Currencies = {

        [1] = {

            currency = 'cash',

            item = 'cash',

            prop = 'prop_cash_pile_02',

        },

        --[[ [2] = {

            currency = 'blackmoney',

            item = 'black',

            prop = 'prop_cash_pile_02',

            --chance = 1.0, -- 0.7 = 70% chance to success / 30% to call a cops (DOESN'T WORK FOR NOW)

        },

        [3] = {

            currency = 'printedbills',

            item = 'printedbills',

            prop = 'prop_cash_pile_02',

            --chance = 1.0, -- 0.7 = 70% chance to success / 30% to call a cops (DOESN'T WORK FOR NOW)

        }, ]]

    }

}



--------------------------------------------------------------------------------------------------------------------------------

--This is just a fuse if you for example update QB-Core and forgot to add a cash item. It create that item after script starts.

--If you forgot to add an item and item doesn't exists, the inventory automatically removes it from inventory after joining. 

--This fuse will ensure that this never happens.



--Please still add item into QB-core/shared/items.lua!! If the script fails or something happens and this script doesn't start

--and the player joins he loses his money if you don't have that item also in qb-core/shared/items.lua

Item = {

    enabled = true, --This option disable this fuse. Use it only if you are getting errors in console. (Older QB-Core)

    name = 'cash',

    label = 'cash',

    weight = 0,

    type = 'item',

    image = 'cash.png',

    unique = false,

    useable = true,

    shouldClose = true,

    combinable = nil,

    description = 'Just a cash bruh.'

}

--QB-Core/shared/items.lua has a priority

--------------------------------------------------------------------------------------------------------------------------------

https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-Money/previews/en.lua
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-Money/previews/functions.lua
local Translations = {

    notifications = {

        enoughmoney = "You don't have enough money.",

        FullInventory = "Your inventory is full, your money has been deposited into the bank - %{money}$",

        recieved = "You recieved %{money}$",

        paid = "You've paid %{money}$",

        error = "An error occurred while adding money. Contact the administrator"

    },

    migration = {

        info = 'Cash to bank account migration tool. (God)',

        done = 'Migration completed',

        error = 'Migration has failed',

        progress = '%{progress} / %{accounts} users are being migrated',

    }

}



Lang = Locale:new({

    phrases = Translations,

    warnOnMissing = true

})

function AddCustom(src, item, amount, reason)

    exports['qb-inventory']:AddItem(src, item, amount)

end



function RemCustom(src, item, amount, reason)

    exports['qb-inventory']:RemoveItem(src, item, amount, slot)

end



function SA_Payment(data)

    local src = data.src

    local amount = data.amount

    local name = data.name

    if Config.Notifications then

        if name == 'PaymentNotify' then

            TriggerClientEvent('QBCore:Notify', src, Lang:t('notifications.paid', {money = amount}), 'success')



        elseif name == 'NotEnoughMoney' then

            TriggerClientEvent('QBCore:Notify', source, Lang:t('notifications.enoughmoney'), 'error')



        elseif name == 'RecievedNotify' then

            TriggerClientEvent('QBCore:Notify', src, Lang:t('notifications.recieved', {money = amount}), 'success')



        elseif name == 'FullInventory' then

            TriggerClientEvent('QBCore:Notify', src, Lang:t('notifications.FullInventory', {money = amount}), 'success')



        elseif name == 'Error' then

            TriggerClientEvent('QBCore:Notify', src, Lang:t('notifications.error'), 'error')



        end

    end

end



function SA_Migration(data)

    local name = data.name

    local src = data.src



    if name == 'Done' then

        TriggerClientEvent('QBCore:Notify', src, Lang:t('migration.done'), 'success')

    elseif name == 'Error' then

        TriggerClientEvent('QBCore:Notify', src, Lang:t('migration.error'), 'error')

    elseif name == 'Progress' then

        TriggerClientEvent('QBCore:Notify', src, Lang:t('migration.progress', {progress = data.progress, accounts = data.max}), 'primary')

    end

end