Money Functions

Some money functions I made to use for a server I work for.

-- Add Cash
HapticLib.AddCash(Source, Amount, Reason)

-- Add Bank
HapticLib.AddBank(Source, Amount, Reason)

-- Add Dirty Money (You will need to modify this to work with your server)
HapticLib.AddDirtyMoney(source, amount)

--Remove Cash (Checks if they have enough first)
HapticLib.RemoveCash(source, amount, reason)

-- Remove Bank (Checks if they have enough first)
HapticLib.RemoveBank(source, amount, reason)

--Remove Dirty Money (You will need to modify this to work with your server)
HapticLib.RemoveDirtyMoney(source, amount)

function functions.RemoveDirtyMoney(source, amount)
    --Add your own Dirty Money Logic
    local Player = QBCore.Functions.GetPlayer(source)
    if Player.Functions.RemoveItem('lifecoin', amount) then
        TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['lifecoin'], 'remove', amount)
		if Config.Debug then
			print("^2 [Haptic-Lib] - ^3 DirtMoney Removed - $ " .. amount .. " - " .. reason)
		end
        return true
    else
        return false
    end
end


-- Get Cash Balance
HapticLib.GetCashBalance(source)

-- Get Bank Balance
HapticLib.GetBankBalance(source)

-- Get Dirty Money (You have to modify it to make it work for you)
HapticLib.GetDirtyBalance(source)

-- Banking Transactions (Used for scripts that do bank transactions with statements)
-- Currently supports OkOkBanking
HapticLib.AddBankingTransaction(receiver_name, receiver_identifier, sender_name, sender_identifier, value, reason)


-- Get Society Balance (Supports okok/qb-banking you can add support yourself for whatever bank you use)
HapticLib.GetSocietyMoney(src, society)

--Add Society Money (Supports okok/qb-banking/old qb-management)
HapticLib.AddSocietyMoney(src, society, value, reason)

--Remove Society Money (Supports okok/qb-banking/old qb-management)
HapticLib.RemoveSocietyMoney(src, society, value, reason)

Last updated