Configuration
Available configuration options to customize the script.
Config = {}
Config.Debug = false
-- Framework Configuration
Config.Framework = 'auto' -- auto | qbox | qb | esx | standalone
--[[
Supported frameworks:
* esx: es_extended, https://github.com/esx-framework/esx-legacy
* qbox: qbx_core, https://github.com/qbox-project/qbx_core
* qb: qb-core, https://github.com/qbcore-framework/qb-core
* standalone: no framework, note that framework specific apps will not work unless you implement the functions in `standalone.lua`. - vMenu basic support included.
--]]
-- Interaction Configuration
Config.InteractOption = 'drawtext' -- ox_target, qb-target, interact, sleepless_interact, drawtext
-- Inventory Configuration
Config.Inventory = 'auto' -- ox_inventory, qb-inventory, custom
-- Bank Locations
Config.BankLocations = {
[1] = { -- Pacific Standard
model = 'u_m_m_bankman',
coords = vector4(241.44, 227.19, 106.29, 170.43),
bankName = 'pacific'
},
[2] = { -- Fleeca Bank
model = 'ig_barry',
coords = vector4(310.21, -282.93, 54.16, 335.72),
bankName = 'fleeca'
},
[3] = { -- Fleeca Bank
model = 'ig_barry',
coords = vector4(145.88, -1044.56, 29.37, 337.36),
bankName = 'fleeca'
},
[4] = { -- Fleeca Bank
model = 'ig_barry',
coords = vector4(-354.88, -53.79, 49.04, 336.97),
bankName = 'fleeca'
},
[5] = { -- Fleeca Bank
model = 'ig_barry',
coords = vector4(-1212.58, -336.27, 37.78, 21.89),
bankName = 'fleeca'
},
[6] = { -- Fleeca Bank
model = 'ig_barry',
coords = vector4(-2957.84, 480.34, 15.70, 87.51),
bankName = 'fleeca'
},
[7] = { -- Fleeca Bank
model = 'ig_barry',
coords = vector4(1177.49, 2711.78, 38.09, 176.80),
bankName = 'fleeca'
},
[8] = { -- Blaine County Savings(Paleto)
model = 'u_m_m_bankman',
coords = vector4(-112.22, 6471.01, 31.63, 134.18),
bankName = 'blaine'
}
}
-- ATM Models
Config.Atms = {
`prop_atm_01`,
`prop_atm_02`,
`prop_atm_03`,
`prop_fleeca_atm`
}
-- Loans Configuration
Config.Loans = {
interestPercent = 5 -- default annual/simple rate used for loan applications
}
-- Bank Inspector Job Configuration
Config.BankInspector = {
enabled = true, -- Enable/disable bank inspector system
jobName = 'police', -- Job name that can access inspector (e.g., 'bank')
minGrade = 0, -- Minimum grade required to access inspector (0 = any grade)
-- When approving a loan, funds will be deducted from this job's business account
useSocietyAccount = true -- Requires a business account for the job (auto-created on startup)
}-- Card Configuration
-- BK Banking System
Config = Config or {}
-- Card Creation Limits
Config.LimitCardCreation = {
enabled = true,
maxCardsPerAccount = 10, -- Maximum cards per account
}
-- Card Item Requirements
Config.CardItems = {
"debitcard_personal", -- Item name for bank card
"debitcard_shared", -- Item name for credit card
"debitcard_personal" -- Item name for debit card
}
-- Card Types Configuration
Config.CardTypes = {
debit = {
name = "Debit Card",
givesItem = true,
itemName = "debitcard_personal"
},
credit = {
name = "Credit Card",
givesItem = true,
itemName = "credit_card"
},
business = {
name = "Business Card",
givesItem = true,
itemName = "bank_card"
}
}
-- Card Generation Settings
Config.CardGeneration = {
cardNumberLength = 16, -- Length of generated card numbers
expirationYears = 5 -- Years until card expiration
}
-- Card Security Settings
Config.CardSecurity = {
allowPinChange = true, -- Allow PIN changes
maxPinAttempts = 3, -- Maximum PIN attempts before lockout
lockoutDuration = 300, -- Lockout duration in seconds
requirePinForTransactions = false -- Require PIN for transactions
}-- Account Configuration
-- BK Banking System
Config = Config or {}
-- Account Creation Limits
Config.LimitAccountCreation = {
enabled = true,
maxSharedAccounts = 3 -- Maximum shared accounts per player
}-- Discord Webhook Logging System for bk_banking
-- Discord Webhook Configuration
local DiscordConfig = {
enabled = true, -- Enable/disable Discord webhook logging
webhookUrl =
"", -- Discord webhook URL
avatarUrl = '', -- Avatar URL for Discord messages
username = 'BK Banking Logs', -- Username for Discord messages
color = 0x128b7d, -- Embed color (hex)
timeout = 10, -- Timeout in seconds before sending queued logs
batchSize = 10, -- Number of logs to batch before sending
excludedLogTypes = { -- Log types to exclude from Discord
'account_member_modified',
'account_name_updated',
'card_limits_updated',
'card_name_updated',
}
}
-- List of all logTypes for filtering
-- 'withdraw', 'deposit', 'transfer', 'card_created', 'card_item_given',
-- 'card_frozen_due_to_too_many_attempts', 'pin_change_failed', 'pin_changed_successfully',
-- 'card_name_updated', 'card_limits_updated', 'card_unfrozen', 'card_frozen', 'card_terminated',
-- 'account_created', 'account_freeze_failed', 'account_unfreeze_failed', 'account_terminate_failed',
-- 'account_freeze', 'account_unfreeze', 'account_terminate', 'account_member_added',
-- 'account_member_removed', 'account_name_updated', 'account_member_modified',
-- 'loan_applied', 'loan_approved', 'loan_rejected', 'loan_payment_made'
local logQueue = {}
RegisterNetEvent('bk_banking:server:logs:create', function(iban, playerId, logType, logMessage)
local postData = {}
-- Check if Discord logging is enabled
if not DiscordConfig.enabled then
return
end
local webhook = DiscordConfig.webhookUrl
if not webhook or webhook == "SET_YOUR_WEBHOOK_URL_IN_SERVER.CFG" then
print('^3[bk_banking]^7 Tried to post a log but webhook is not configured')
return
end
-- Check if the logType is in the excluded list
for i = 1, #DiscordConfig.excludedLogTypes do
if DiscordConfig.excludedLogTypes[i] == logType then
return
end
end
-- Create an embed
local embed = {
['type'] = 'rich',
['color'] = DiscordConfig.color,
['footer'] = {
['text'] = os.date('%c'),
},
['author'] = {
['name'] = DiscordConfig.username,
['icon_url'] = DiscordConfig.avatarUrl,
},
['fields'] = {
{
['name'] = 'Player Identifier / IBAN / Log Type',
['value'] = "```" .. playerId .. " / " .. iban .. " / " .. logType .. "```",
},
{
['name'] = 'Log Message:',
['value'] = "```" .. logMessage .. "```",
},
}
}
if not logQueue[iban] then logQueue[iban] = {} end
logQueue[iban][#logQueue[iban] + 1] = { webhook = webhook, data = embed }
-- Process the logQueue when it reaches a certain size or based on other criteria
if #logQueue[iban] >= DiscordConfig.batchSize then
postData = {
username = DiscordConfig.username,
avatar_url = DiscordConfig.avatarUrl,
embeds = {},
}
for i = 1, #logQueue[iban] do
postData.embeds[#postData.embeds + 1] = logQueue[iban][i].data
end
PerformHttpRequest(webhook, function() end, 'POST', json.encode(postData),
{ ['Content-Type'] = 'application/json' })
logQueue[iban] = {}
end
end)
CreateThread(function()
local timer = 0
while true do
Wait(5000)
timer = timer + 5
if timer >= DiscordConfig.timeout then -- If timeout seconds have passed, post the logs.
timer = 0
for iban, queue in pairs(logQueue) do
if #queue > 0 then
local postData = {
username = DiscordConfig.username,
avatar_url = DiscordConfig.avatarUrl,
embeds = {}
}
for i = 1, #queue do
-- Directly add the embed from each log entry in the queue
postData.embeds[#postData.embeds + 1] = queue[i].data
end
-- Send the logs to Discord
PerformHttpRequest(queue[1].webhook, function() end, 'POST', json.encode(postData),
{ ['Content-Type'] = 'application/json' })
-- Clear the queue for this iban after sending
logQueue[iban] = {}
end
end
end
end
end)
Last updated
Was this helpful?