RX Scripts Logo
Banking

Configurables

All config & open sourced files included within this script.

Config Files

--[[
BY RX Scripts © rxscripts.xyz
--]]

Config = {}

Config.Locale = 'en'
Config.MoneyTypes = { -- Account names from your framework
    money = 'money',
    bank = 'bank',
}

Config.Accounts = {
    --[[
        Checking accounts can be deposited into, withdrawn from, and transferred to other accounts
        1 checking account is created by default for each character, extra ones can be created by the player, if max is not reached
    --]]
    checking = {
        maxAccounts = 2, -- Max checking accounts per character (including the default one, excluding society checking accounts)
        openCost = 100,  -- Cost to create a new checking account
    },

    --[[
        Saving accounts can be transferred from & to other accounts.
        Saving accounts are not created by default, the player must create them, if max is not reached
        Saving accounts can give interest if enabled
    --]]
    saving = {
        maxAccounts = 2,    -- Max saving accounts per character
        openCost = 100,     -- Cost to create a new saving account
        interest = {
            enabled = true, -- Enable interest on saving accounts
            rate = 0.005,   -- Interest rate (0.5%)
            interval = 1,   -- Interval in hours
        }
    },
}

Config.Cards = {
    --[[
        Setting item.enabled to true, will make the card an actual item in the inventory
        This item will then be required to be in the inventory to open the ATM for the account this card belongs to
    --]]
    item = {
        enabled = true,
        name = 'rx_card', -- Name of the item in the inventory
    },
    --[[
        Allow that everyone can open anyone's account in an ATM, as long as they have the card in their inventory.
        To enable the robbing feature, you MUST set item.enabled option to true.
        Only checking accounts can be robbed, excluding personal accounts (accounts that are used for the default bank of the player)
    --]]
    robbing = true,
}

Config.Loans = {
    enabled = true,
    packages = {
        ["Personal Express Loan"] = {
            amount = 35000,  -- Total loan amount
            interest = 4.5, -- Interest rate percentage
            days = 25,      -- Duration in days
            description = "Quick access to small funds for personal expenses with minimal paperwork and fast approval."
        },
        ["Flexible Credit Line"] = {
            amount = 85000,
            interest = 8.75,
            days = 40,
            description = "Versatile financing solution for medium-sized projects with convenient repayment schedule."
        },
        ["Capital Investment Loan"] = {
            amount = 425000,
            interest = 12.25,
            days = 55,
            description = "Substantial funding for business growth and investment opportunities with competitive days."
        },
        ["Executive Financing Plan"] = {
            amount = 1250000,
            interest = 16.5,
            days = 75,
            description =
            "Premium financing package designed for major enterprises and significant capital requirements."
        }
    }
}

Config.Society = {
    enabled = true, -- Enable society accounts
    accounts = {
        ['police'] = {
            requiredGrades = {
                [2] = {
                    deposit = true,
                    withdraw = false,
                    transfer = false,
                },
                [3] = {
                    deposit = true,
                    withdraw = true,
                    transfer = true,
                },
            }
        }
    }
}

Config.Banks = {
    blip = {
        enabled = true,
        label = 'Bank',
        sprite = 108,
        color = 3,
        display = 2,
        scale = 0.7,
        shortrange = true,
    },
    markerDist = 5.0,
    openDist = 2.5,
    locations = {
        vector4(149.91, -1040.74, 29.374, 160),
        vector4(-1212.63, -330.78, 37.59, 210),
        vector4(-2962.47, 482.93, 15.5, 270),
        vector4(-113.01, 6470.24, 31.43, 315),
        vector4(314.16, -279.09, 53.97, 160),
        vector4(-350.99, -49.99, 48.84, 160),
        vector4(1175.02, 2706.87, 37.89, 0),
        vector4(246.63, 223.62, 106.0, 160),
    }
}

Config.ATMs = {
    openDist = 1.0,
    presetAmounts = { 1000, 5000, 10000, 20000, 50000, 100000 },
    models = {
        'prop_fleeca_atm',
        'prop_atm_01',
        'prop_atm_02',
        'prop_atm_03'
    }
}

Config.UI = {
    color = {
        primary = { -- Different shades of primary color
            [50] = "#FEDDE9",
            [100] = "#FCBAD3",
            [200] = "#FA76A6",
            [300] = "#F7317A",
            [400] = "#D80955",
            [500] = "#95063B",
            [600] = "#76052E",
            [700] = "#580423",
            [800] = "#3B0217",
            [900] = "#1D010C",
            [950] = "#0F0106"
        },
    }
}

--[[
    ONLY CHANGE THIS PART IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
    RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
---@type table Only change these if you have changed the name of a resource
Resources = {
    FM = { name = 'fmLib', export = 'new' },
    OXTarget = { name = 'ox_target', export = 'all' },
    QBTarget = { name = 'qb-target', export = 'all' },
}
IgnoreScriptFoundLogs = false
ShowDebugPrints = true

Opensource Files

All script-related open source code is contained within these files. Third-party components, including frameworks, inventory systems, and other external code, are separately maintained & open sourced in our fmLib repository.
--[[
BY RX Scripts © rxscripts.xyz
--]]

local function getATMTargetOpts()
    local opts = {}

    if OXTarget then
        opts = {
            {
                name = "Open ATM",
                label = "Open ATM",
                icon = "fas fa-money-bill",
                distance = Config.ATMs.openDist,
                canInteract = function()
                    local ped = PlayerPedId()
                    if not IsPedOnFoot(ped) then return false end

                    return true
                end,
                onSelect = function(data)
                    OpenATM()
                end,
            },
        }
    elseif QBTarget then
        opts = {
            options = {
                {
                    icon = "fas fa-money-bill",
                    label = "Open ATM",
                    canInteract = function()
                        local ped = PlayerPedId()
                        if not IsPedOnFoot(ped) then return false end

                        return true
                    end,
                    action = function(entity)
                        OpenATM()
                    end
                },
            },
            distance = Config.ATMs.openDist,
        }
    end

    return opts
end

---@param type 'open_bank'
function ShowMarker(type, coords)
    if type == 'open_bank' then
        DrawMarker(2, coords, 0, 0, 0, 0, 180.0, 0, 0.3, 0.3, 0.3, 128, 2, 49, 100, false, false, 2, true, false, false,
            false)
    end
end

function InitGlobalATMTarget(prop)
    if OXTarget then
        OXTarget:addModel(prop, getATMTargetOpts())
    elseif QBTarget then
        QBTarget:AddTargetModel(prop, getATMTargetOpts())
    end
end

local i = 0
function InitBankTargetZone(v3)
    if OXTarget then
        OXTarget:addSphereZone({
            coords = v3,
            radius = 0.8,
            debug = false,
            drawSprite = true,
            options = {
                {
                    icon = "fas fa-money-bill",
                    label = "Open Bank",
                    distance = Config.Banks.openDist,
                    canInteract = function()
                        local ped = PlayerPedId()
                        if not IsPedOnFoot(ped) then return false end

                        return true
                    end,
                    onSelect = function(entity)
                        OpenBank()
                    end
                }
            }
        })
    elseif QBTarget then
        local name = 'open_bank_' .. i
        i = i + 1

        QBTarget:AddCircleZone(name, v3, 1.0, {
            name = name,
            debugPoly = false,
        }, {
            options = {
                {
                    icon = "fas fa-money-bill",
                    label = "Open Bank",
                    canInteract = function()
                        local ped = PlayerPedId()
                        if not IsPedOnFoot(ped) then return false end

                        return true
                    end,
                    action = function(entity)
                        OpenBank()
                    end
                },
            },
            distance = Config.Banks.openDist
        })
    end
end