QBESXStandalone
Agency-Banking Конфигурация
Полноценная банковская система для FiveM, работающая на QBCore, Qbox, ESX или полностью standalone.
v1.6.0Платно6 Страницы

01Конфигурация
Быстрая установка · config.lua · Agency-Banking
--[[
╔══════════════════════════════════════════════════════════════════════╗
║ AGENCY BANKING - CONFIGURATION ║
║ (c) Agency Scripts ║
╚══════════════════════════════════════════════════════════════════════╝
CONTENTS
1. Agency Companion The free app for your players, accent colour
2. Core Language, framework, admins, commands
3. Look Bank name, logo, menu design, accent colour
4. Integrations Agency-Notify, Agency-Progressbar, target,
business accounts, Renewed-Banking drop-in
5. Transfers Offline transfers, push on incoming money
6. Fixed Deposits Terms and interest
7. Locations Banks and ATMs
8. Standalone Running without QBCore / Qbox / ESX
Every table and column is created on start, nothing has to be imported.
Framework detection lives in shared/bridge.lua. It stays readable on
escrow protected servers, so a custom framework can be wired in there.
Discord: https://discord.gg/RTax3aBMUs · Shop: https://shop.agencyg.de
]]
Config = {}
--==============================================================================
-- 1 · AGENCY COMPANION
--==============================================================================
-- Agency Companion app (free):
-- iPhone, iPad and Mac: https://apps.apple.com/app/id6778632140
-- Android: https://play.google.com/store/apps/details?id=de.agencyg.companion
-- Web app (browser): https://companion.agencyg.de/app
-- Agency-Companion script (free resource, one /app code for every Agency script): https://shop.agencyg.de/en/product/agency-companion
-- One resource for every Agency script: your players link them with the free
-- Agency Companion app (iPhone, Android, web) and check their balance, send
-- transfers, manage cards and fixed deposits from the phone. Your admins pick
-- one accent colour for all Agency scripts in game (/app, admin page).
-- Drop it into your resources, done. Money actions are always checked on the
-- server, exactly like in the bank menu.
Config.Companion = {
Enabled = true, -- connect with Agency-Companion (app + accent colour)
EnableRemote = true, -- dial out to the Agency relay (no port forwarding needed)
RelayUrl = 'https://api.agencyg.de', -- Agency relay endpoint
TokenTTL = 300, -- seconds a pairing QR / code stays valid
}
-- ── Accent colour ────────────────────────────────────────────────────────────
-- false = the colour from Agency-Companion, gold without it
-- { r,g,b } = a fixed colour for this script only, e.g. { 0, 190, 255 }
-- Players can still pick their own colour in the bank (Settings).
Config.AccentColor = false
--==============================================================================
-- 2 · CORE
--==============================================================================
-- ── Language ─────────────────────────────────────────────────────────────────
-- en bg cs da de el es fi fr hr hu it ja ko nb nl pl pt ro ru sk sv tr uk zh
-- (the old code 'esm' still works and means Spanish)
-- A text missing in your language is shown in English instead.
Config.Locale = 'en'
-- ── Framework ────────────────────────────────────────────────────────────────
-- 'auto' -> detect QBCore, Qbox or ESX by itself. Standalone is only
-- chosen when none of qb-core, qbx_core and es_extended is
-- installed at all, so a slow booting core is never mistaken
-- for a server without one.
-- 'qbcore' -> force QBCore (qb-core) or Qbox (qbx_core)
-- 'esx' -> force ESX (es_extended)
-- 'standalone' -> no framework, see section 8
Config.Framework = 'auto'
-- ── Admins ───────────────────────────────────────────────────────────────────
-- Framework groups that count as admin (QBCore / Qbox permissions, ESX groups).
-- ACE works everywhere: `add_ace group.admin agency.banking allow`
Config.AdminGroups = { 'admin', 'god', 'superadmin' }
-- ── Commands ─────────────────────────────────────────────────────────────────
Config.Commands = {
openBank = 'openbank', -- opens the bank anywhere, '' turns the command off
openBankAdminOnly = true, -- false = every player may open the bank from anywhere
}
-- ── Database ─────────────────────────────────────────────────────────────────
-- The resource uses oxmysql (declared in fxmanifest.lua).
Config.DatabaseType = 'oxmysql'
-- ── Debug ────────────────────────────────────────────────────────────────────
Config.Debug = false -- true = print the framework detection in every client console too
--==============================================================================
-- 3 · LOOK
--==============================================================================
-- The bank always fits the screen resolution by itself (1080p, 1440p, 4K,
-- ultrawide), there is no size setting any more.
-- ── Bank ─────────────────────────────────────────────────────────────────────
Config.BankName = 'Agency Bank' -- name shown across the UI and on cards
Config.BankLogo = 'logo.png' -- image on the cards, in this resource's root folder (next to config.lua)
-- ── Menu design ──────────────────────────────────────────────────────────────
-- 'v1.3' -> the Agency design: dark panel, accent colour, sliding sidebar (default)
-- 'v1' -> the classic design of the first releases: blue liquid glass
Config.Design = 'v1.3'
--==============================================================================
-- 4 · INTEGRATIONS
--==============================================================================
-- ── Notifications ────────────────────────────────────────────────────────────
-- Agency-Notify (free): https://agency-script.tebex.io/package/6937769
-- true = Agency-Notify when it runs (also standalone), otherwise the
-- framework notification, otherwise the GTA feed
-- false = always the framework notification
Config.UseAgencyNotify = true
-- ── Progress bar ─────────────────────────────────────────────────────────────
-- Agency-Progressbar (free): https://agency-script.tebex.io/package/7000468
-- Used when it runs (also standalone). Without it a short wait is used instead.
Config.Progressbar = {
Enabled = true, -- false = no progress bar at all
ATMCard = 1500, -- ms "Inserting card" before the ATM PIN, 0 = off
}
-- ── Interaction ──────────────────────────────────────────────────────────────
-- UseTarget = true -> interact via a target resource (qb-target / ox_target)
-- UseTarget = false -> interact via 3D markers + [E]
-- The active target system is auto-detected; if TargetResource isn't running,
-- the script picks whichever is available, or falls back to markers + [E].
Config.UseTarget = false
Config.TargetResource = 'qb-target' -- 'qb-target' or 'ox_target'
-- ── Business accounts and Renewed-Banking ───────────────────────────────────
-- Job, gang and shared accounts. Players with the boss grade (bankAuth or
-- isboss in your jobs / gangs) see them in the bank under "Business" and can
-- pay in from or take out to their own bank account.
--
-- Drop-in for Renewed-Banking (Qbox default): remove the Renewed-Banking
-- folder, keep `ensure Agency-Banking`. Every exports['Renewed-Banking'] call
-- (qbx_core paychecks, qbx_policejob, qbx_ambulancejob, qbx_vehicleshop and
-- any other script) is answered by Agency Banking from the same table
-- bank_accounts_new, so all society money stays as it is.
-- Keeping Renewed-Banking instead? Delete the line provide 'Renewed-Banking'
-- in fxmanifest.lua.
Config.BusinessAccounts = {
Enabled = true,
RenewedBanking = true, -- answer exports['Renewed-Banking'] (needs Renewed-Banking removed)
Storage = 'auto', -- 'auto' | 'banking' (bank_accounts_new) | 'qb-management'
-- auto = qb-management when it runs, otherwise bank_accounts_new
TransactionLimit = 100, -- entries kept per business account
GiveCashCommand = 'givecash', -- /givecash [id] [amount] like Renewed-Banking, '' = off
AgencyGangs = true, -- Agency-Gangs: the gang bank shows up under Business (rank permissions apply)
}
--==============================================================================
-- 5 · TRANSFERS
--==============================================================================
Config.Transfers = {
-- true = transfers from the Companion app also reach players who are not
-- online: the money is booked straight into their account in the
-- database (QBCore / Qbox players.money, ESX accounts, the bank's
-- standalone tables, or the getOfflineBank / addOfflineBank hooks)
-- and shows up in their activity.
-- false = the recipient has to be online, the app then says so clearly.
Offline = true,
-- true = the recipient's linked Companion app gets a push notification
-- when money arrives (transfer in game or from the app).
PushOnReceive = true,
}
--==============================================================================
-- 6 · FIXED DEPOSITS
--==============================================================================
-- The interest rate always comes from this list on the server, never from
-- the menu, so a term that is not listed here cannot be opened.
Config.EnableFixedDeposits = true
Config.FixedDepositOptions = {
{ days = 7, interestRate = 2.0 }, -- 7 days * 2.0% return
{ days = 14, interestRate = 3.5 }, -- 14 days * 3.5% return
{ days = 30, interestRate = 6.0 }, -- 30 days * 6.0% return
}
--==============================================================================
-- 7 · LOCATIONS
--==============================================================================
-- ── Banks ────────────────────────────────────────────────────────────────────
Config.BankLocations = {
vector3(149.91, -1040.64, 29.37), -- Legion Square
vector3(314.19, -278.62, 54.17), -- Alta
vector3(-1212.98, -330.84, 37.78), -- Rockford Hills
vector3(-2962.58, 482.63, 15.70), -- Chumash
vector3(-112.20, 6469.29, 31.62), -- Paleto Bay
vector3(1175.06, 2706.64, 38.09), -- Sandy Shores
vector3(241.727, 220.706, 106.286), -- Pacific Standard
vector3(1143.514, -471.189, 66.828), -- Mirror Park
vector3(-350.938, -49.805, 49.042), -- Burton
}
-- ── ATMs ─────────────────────────────────────────────────────────────────────
-- ATM prop models detected client-side for interaction.
Config.ATMProps = {
`prop_atm_01`,
`prop_atm_02`,
`prop_atm_03`,
`prop_fleeca_atm`,
}
--==============================================================================
-- 8 · STANDALONE
--==============================================================================
--[[ Only used when no framework runs.
WHAT WORKS WITHOUT A FRAMEWORK
* Every screen of the bank: wallet, cards, transfers, fixed deposits,
trading, activity, ATM PIN and the Companion app.
* Players are told apart by their Rockstar licence (license:...), so a
player keeps the same account across sessions and reconnects.
* Bank balance and cash are kept by the bank itself (see Accounts).
* Other resources can use the bank as their money system through the
server exports GetBankBalance / AddBankMoney / RemoveBankMoney /
GetCashBalance / AddCashMoney / RemoveCashMoney.
* Admins come from ACE (agency.banking or group.admin) or from the
Admins list below.
TABLES CREATED FOR STANDALONE (automatically on start, nothing to import)
* agency_bank_accounts bank balance and cash per licence
* agency_phone_settings the stock and crypto portfolio. The same table
Agency Phone and Agency Pad use, so it is only
created when it is missing and then shared.
WHAT DOES NOT WORK WITHOUT A FRAMEWORK
* Character names: the bank shows the FiveM player name.
* Phone numbers only exist with Agency Phone installed (its standalone
table). Without it, the Companion transfer by phone number is off.
* Live stock and crypto prices come from Agency Phone or Agency Pad.
Without them the market trades at fixed prices.
* Cash only exists inside the bank: a cash item in an inventory is not
touched by deposits and withdrawals.
]]
Config.Standalone = {
-- Where bank balance and cash are stored:
-- 'auto' -> Agency Phone standalone wallet when its table exists
-- (so phone and bank show the same balance),
-- otherwise the bank's own table
-- 'banking' -> own table agency_bank_accounts (bank + cash per licence)
-- 'agency-phone' -> bank balance shared with Agency Phone standalone
-- (agency_phone_standalone.bank), cash in agency_bank_accounts
-- 'hooks' -> your own money system through the functions below
Accounts = 'auto',
StartBank = 5000, -- balance of a new account
StartCash = 500, -- cash of a new account
-- Licences that count as admin without ACE, e.g. 'license:1a2b3c...'
Admins = {},
-- Only used with Accounts = 'hooks'. Every function receives the player's
-- server id and must answer straight away (no Wait). The three bank hooks
-- are required, the cash hooks are optional (without them there is no cash).
-- getBank = function(src) return 0 end,
-- addBank = function(src, amount) return true end,
-- removeBank = function(src, amount) return true end, -- false when the balance is too low
-- getCash = function(src) return 0 end,
-- addCash = function(src, amount) return true end,
-- removeCash = function(src, amount) return true end,
-- getOfflineBank = function(identifier) return 0 end, -- Companion app while the player is offline
-- addOfflineBank = function(identifier, amount) return true end, -- transfer to a player who is offline
}
--[[ ============================================================================
INTERNAL: compatibility and translation helper (nothing to configure below)
============================================================================ ]]
-- Older configs: Config.Companion.Enable (before 1.4) still works.
if Config.Companion.Enable ~= nil and Config.Companion.Enabled == nil then
Config.Companion.Enabled = Config.Companion.Enable
end
if Config.Companion.Enabled == false then Config.Companion.Enable = false end
-- Language codes from older versions.
local LOCALE_ALIAS = { esm = 'es', ['zh-Hans'] = 'zh', ['zh-CN'] = 'zh', no = 'nb', cz = 'cs', se = 'sv', gr = 'el' }
Config.Locale = LOCALE_ALIAS[Config.Locale] or Config.Locale
-- _U('key', ...) returns the localized, string.format-ed text. A key missing in
-- the chosen language falls back to English instead of showing the key.
function _U(str, ...)
local locale = Locales[Config.Locale] or Locales['en'] or {}
local text = locale[str]
if text == nil and Locales['en'] then text = Locales['en'][str] end
if text == nil then
return ('Translation [%s][%s] does not exist'):format(tostring(Config.Locale), tostring(str))
end
if select('#', ...) == 0 then return text end
local ok, formatted = pcall(string.format, text, ...)
return ok and formatted or text
end
02SQL файл
Необязательно: ресурс сам создаёт эти таблицы при запуске. Импортируйте файл, только если настраиваете базу данных вручную:
-- =============================================================================
-- Agency Banking: database schema
-- -----------------------------------------------------------------------------
-- You do NOT have to import this file. The resource creates every table and
-- every missing column by itself on start (MariaDB and MySQL 8).
-- It is here for servers that prefer to set up the database by hand.
-- =============================================================================
CREATE TABLE IF NOT EXISTS `agency_transactions` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`identifier` VARCHAR(60) NOT NULL,
`type` VARCHAR(50) NOT NULL, -- deposit, withdraw, transfer, fixed_deposit, card_added, ...
`amount` DECIMAL(15,2) NOT NULL,
`target_identifier` VARCHAR(60) DEFAULT NULL,
`reason` VARCHAR(255) DEFAULT NULL,
`date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `agency_cards` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`identifier` VARCHAR(60) NOT NULL,
`card_number` VARCHAR(16) NOT NULL,
`card_pin` VARCHAR(4) NOT NULL,
`card_type` VARCHAR(50) DEFAULT 'Visa',
`card_color` VARCHAR(50) DEFAULT 'ultra-blue',
`is_active` TINYINT(1) DEFAULT 1,
`card_name` VARCHAR(50) DEFAULT 'Main Account',
`card_holder` VARCHAR(50) DEFAULT 'Card Holder',
PRIMARY KEY (`id`),
KEY `identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `agency_fixed_deposits` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`identifier` VARCHAR(60) NOT NULL,
`amount` DECIMAL(15,2) NOT NULL,
`interest_rate` FLOAT NOT NULL,
`duration_days` INT(11) NOT NULL,
`start_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`end_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`is_claimed` TINYINT(1) DEFAULT 0,
`source` VARCHAR(16) NOT NULL DEFAULT 'bank', -- 'bank' = paid out by the bank, 'phone' = a copy of an Agency Phone wallet deposit
`external_ref` VARCHAR(64) DEFAULT NULL, -- the phone's own id for a 'phone' deposit
PRIMARY KEY (`id`),
KEY `identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `agency_atm_pins` (
`identifier` VARCHAR(60) NOT NULL,
`pin` VARCHAR(4) NOT NULL,
PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Standalone only (no QBCore / Qbox / ESX): balance and cash per Rockstar licence.
CREATE TABLE IF NOT EXISTS `agency_bank_accounts` (
`identifier` VARCHAR(60) NOT NULL,
`bank` DECIMAL(15,2) NOT NULL DEFAULT 0,
`cash` DECIMAL(15,2) NOT NULL DEFAULT 0,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Standalone and ESX only: the stock and crypto portfolio. The same table Agency
-- Phone and Agency Pad use; on QBCore / Qbox the portfolio lives in the
-- character's metadata instead.
CREATE TABLE IF NOT EXISTS `agency_phone_settings` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`identifier` VARCHAR(60) NOT NULL,
`setting_key` VARCHAR(60) NOT NULL,
`setting_value` TEXT DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `identifier_key` (`identifier`, `setting_key`),
KEY `identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Agency Companion app (created by server/companion.lua as well).
CREATE TABLE IF NOT EXISTS `agency_banking_cmp_meta` (
`k` VARCHAR(64) NOT NULL PRIMARY KEY,
`v` TEXT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `agency_banking_cmp_devices` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`identifier` VARCHAR(60) NOT NULL,
`player_name` VARCHAR(80) DEFAULT NULL,
`token_hash` CHAR(64) NOT NULL,
`device_name` VARCHAR(64) DEFAULT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_seen` TIMESTAMP NULL DEFAULT NULL,
`revoked` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `token_hash` (`token_hash`),
KEY `identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;