Wert LB Phone Bank Application
You can access the setup information you need about this product
INSTALLATION
1 - Upload the script folder to the location of your resources
2 - Check config and editable file settings. Don’t forget to configure the core settings (like the framework) through the config file to match your setup.
3 - Make sure that the ox_lib
resource is installed and running. (https://github.com/overextended/ox_lib)
4 - Please add the .sql
file inside the folder to your database.
5 - You are ready. Restart ur server and use it. For more options, don’t forget to check the configuration files.
6 - Installation successful, have a good funs
INFORMATION
The script comes with default settings. There are many settings in the configuration file, and you can customize all of them to your personal preferences. Below are the configuration files, feel free to check them out.
OPEN FILES
config.lua
Config = {
Framework = 'qb', -- 'qb' or 'qbx' or 'esx'
Locale = 'en',
Identifier = "new-bank-system-custom",
DefaultApp = false,
Name = "Bank",
Description = "Life Style With Finance",
Developer = "LS Finance Systems",
Icon = "https://www.isbahrain.com.bh/StaticFiles/Bahreyn/public/dist/img/favicon/isbank-og-image.jpg",
customizeProfilePhoto = true,
TransferFee = 0,
Notifications = {
title = "Bank",
invalid_receiver = "Invalid receiver! Please try again with correct informations.",
invalid_amount = "Invalid amount! Please try again with correct amount.",
receiver_notfound = "Receiver not founded! Please try again with a available receiver!",
urselferror = "You can't transfer money ur self!!!",
balanceerror = "Your account balance is insufficient! Please try again later!",
transferred = "%s$ has been transferred to your account by %s %s 🤑.",
accerror = "Such an account does not exist!",
cantregister = "You can't register yourself!",
cantrequestself = "You can't request from yourself!",
sentrequest = "%s sent you a request: $%s",
reqsucess = 'Request succesfully sent!',
declined = "Your request was declined.",
failed = "Payment failed!",
requestpaid = "$%s has been paid to you (request).",
paymentcompleted = "Payment completed.",
}
}
locales/en.json
{
"home" : {
"welcome": "Welcome",
"balance": "Your Balance",
"accountcard": "Account Card",
"copied": "Copied!",
"maze": "Maze",
"transfer": "Transfer",
"request": "Request",
"payinvoice": "Pay Invoice",
"stocks": "Stocks",
"quicksend": "Quick Send",
"seall": "See All",
"add": "Add",
"recent": "Recent Transaction"
},
"historydetail" : {
"title": "History Detail",
"norecords": "No records were found!",
"back": "Back"
},
"invoice" : {
"title": "Invoices",
"nobill": "You have no bills to pay!",
"pay": "Pay",
"home": "Home"
},
"profilephoto" : {
"confirm": "Confirm",
"cancel": "Cancel",
"new": "New Photo",
"placeholder": "Image URL",
"title": "Update Profile Photo"
},
"quicksendadd" : {
"title": "Add New Quick Address",
"name": "Name",
"receiverplaceholder": "Receiver Name",
"accno": "Account Number",
"accnoplaceholder": "Account Number",
"tags": "Tags (Optional)",
"enterplaceholder": "Type tag and press Enter",
"adding": "Adding...",
"confirm": "Confirm",
"home": "Home"
},
"quicksendlist" : {
"title": "Saved Receivers",
"nosaved": "No saved receivers!",
"home": "Home"
},
"request" : {
"title": "Request Money",
"createManuel": "Create A Manual Request",
"receiver": "Receiver",
"accorid": "Account Number or Server Id",
"amount": "Amount",
"amountPlaceholder": "0",
"note": "Note (Optional)",
"notePlaceholder": "Reason",
"sending": "Sending...",
"send": " Send Request",
"quicklist": "Quick List",
"seeall": "See all",
"noreceivers": "No saved receivers",
"incoming": "Incoming Requests",
"refreshing": "Refreshing...",
"refresh": "Refresh",
"noincoming": "No incoming requests",
"nonote": "No Note",
"accept": "Accept",
"decline": "Decline",
"modaltitle": "Request",
"cancel": "Cancel"
},
"banktransfer" : {
"bank": "Maze Bank",
"icon": "$",
"amountPlaceholder": "100",
"endfix": ".00",
"sender": "Sender",
"receiver": "Receiver",
"accnoplaceholder": "Account Number or Server Id",
"details": "Details",
"description": "Transaction description (Optional)",
"descPlaceholder": "Description ...",
"transferFee": "Transfer Fee",
"transfer": "Transfer",
"cancel": "Cancel"
},
"bankuser" : {
"activity": "Activity",
"earned": "Earned",
"spent": "Spent",
"icon": "$",
"history": "History",
"weekly": "Weekly",
"monthly": "Monthly",
"yearly": "Yearly"
},
"invoicepaid" : {
"title": "Payment Successful",
"label": "Label",
"amount": "Amount",
"transcid": "Transaction ID",
"pdfcreating": "Invoice Creating ...",
"viewpdf": "View/Save Invoice",
"done": "Done",
"docsubject": "Invoice Payment Receipt",
"dockeywords": "invoice, payment, receipt",
"doccreator": "Bank NUI",
"contentTextOne": "INVOICE PAYMENT RECEIPT",
"doctransid": "Transaction ID: {{transactionId}}",
"doclabel": "Label",
"docamount": "Amount",
"docdate": "Date",
"docsign": "This invoice payment receipt was generated electronically."
},
"transfersuccess" : {
"title": "Payment Successful",
"receiver": "Receiver",
"amount": "Amount",
"transcid": "Transaction ID",
"description": "Description",
"pdfcreating": "Invoice Creating ...",
"view": "View/Save Invoice",
"done": "Done",
"none": "None",
"docsubject": "Payment Receipt",
"dockeywords": "receipt, bank",
"doccreator": "Bank NUI",
"doctitle": "PAYMENT RECEIPT",
"doctransid": "Transaction ID: {{transactionId}}",
"docreceiver": "Receiver",
"docamount": "Amount",
"docdescription": "Description",
"docdate": "Date",
"docsign": "This receipt was generated electronically."
},
"explorestocks" : {
"explore": "Explore Stocks",
"placeholder": "AAPL, Microsoft...",
"buy": "Buy",
"cancel": "Cancel",
"count": "Count",
"countdesc": "The amount to be purchased",
"estimated": "Estimated Amount"
},
"sellstock" : {
"sell": "Sell",
"max": "Stock Number - Max",
"placeholder": "Amount (1 - {{maxQty}})",
"currentprice": "Current Price:",
"average": "Average Purchase:",
"valuetobesold": "Value To Be Sold:",
"profitloss": "Profit/Loss:",
"cancel": "Cancel"
},
"stockspage" : {
"title": "Stock Exchange",
"noasset": "No Asset!",
"totalvalue": "Total Value",
"cost": "Cost",
"profitloss": "Profit / Loss",
"myassets": "My Assets",
"getstocks": "Get Stocks",
"buystocktext": "You don't have a stock yet. You can buy on the Discover page.",
"count": "Count:",
"price": "Price:",
"wannasell": "U wanna sell ur stocks ?",
"sell": "Sell"
}
}
editable_client.lua
local core
if Config.Framework == 'qb' or Config.Framework == 'qbx' then core = exports['qb-core']:GetCoreObject() else core = exports["es_extended"]:getSharedObject() end
local function SendAppMessage(action, data)
exports["lb-phone"]:SendCustomAppMessage(Config.Identifier, { action = action, data = data })
end
-- # Dynamic update if money change for phone!
if Config.Framework == 'qb' or Config.Framework == 'qbx' then
RegisterNetEvent('QBCore:Client:OnMoneyChange', function(moneyType, amount, action)
if moneyType ~= 'bank' then return end
if GetResourceState("lb-phone") ~= "started" then return end
if not exports["lb-phone"]:IsOpen() then return end
local newAmount = core.Functions.GetPlayerData().money.bank
SendAppMessage('updateBalance', newAmount or 0)
end)
else
RegisterNetEvent("esx:setAccountMoney", function(account)
if not account then return end
if account.name ~= 'bank' then return end
if GetResourceState("lb-phone") ~= "started" then return end
if not exports["lb-phone"]:IsOpen() then return end
local newAmount = account.money
SendAppMessage('updateBalance', newAmount or 0)
end)
end
editable_server.lua
local core
if Config.Framework == 'qb' or Config.Framework == 'qbx' then core = exports['qb-core']:GetCoreObject() else core = exports["es_extended"]:getSharedObject() end
webhookList = {
transferMoney = '',
requestMoney = '',
requestPayment = '',
buyStock = '',
sellStock = '',
-- Pdf webhook
pdf = ''
}
-- # Functions
function GetFrameworkPlayer(src)
src = src and tonumber(src) or nil
if not src then return nil end
if Config.Framework == 'qb' or Config.Framework == 'qbx' then
return core.Functions.GetPlayer(src)
else
return core.GetPlayerFromId(src)
end
end
function GetFrameworkPlayerByCitizen(param)
if not param then return nil end
if Config.Framework == 'qb' or Config.Framework == 'qbx' then
return core.Functions.GetPlayerByCitizenId(param)
else
return core.GetPlayerFromIdentifier(param)
end
end
function DiscordLog(hook, title, message)
if not webhookList[hook] then return end
if webhookList[hook] == '' then return end
local embedData = {
{
['title'] = title,
['color'] = '65280',
['footer'] = { ['text'] = os.date('%c') },
['description'] = message,
['author'] = { ['name'] = 'Bank app bot' },
}
}
PerformHttpRequest(webhookList[hook], function() end, 'POST', json.encode({ username = 'Bank app Bot', embeds = embedData}), { ['Content-Type'] = 'application/json' })
end
-- # Callbacks for invoice
lib.callback.register('lb-bankapp:server:get-invoices', function(source)
local src = source
local ply = GetFrameworkPlayer(src)
if not ply then return end
local isCid = (Config.Framework == 'qb' or Config.Framework == 'qbx') and ply.PlayerData.citizenid or ply.getIdentifier()
local invoiceData = {}
local invoices = MySQL.Sync.fetchAll('SELECT * FROM phone_invoices WHERE citizenid = ?', { isCid })
for i = 1, #invoices do
local row = invoices[i]
invoiceData[#invoiceData+1] = { id = tonumber(row.id), label = row.society, text = row.sender, amount = tonumber(row.amount) }
end
return invoiceData
end)
lib.callback.register('lb-bankapp:server:pay-invoice', function(source, id)
local src = source
local ply = GetFrameworkPlayer(src)
if not ply then return end
local retval = { success = false }
id = id and tonumber(id) or nil
if not id then return retval end
local isCid = (Config.Framework == 'qb' or Config.Framework == 'qbx') and ply.PlayerData.citizenid or ply.getIdentifier()
local calculatePrice = MySQL.scalar.await('SELECT `amount` FROM `phone_invoices` WHERE `id` = ? LIMIT 1', { id })
calculatePrice = calculatePrice and tonumber(calculatePrice) or nil
if not calculatePrice then return retval end
local payStatus = nil
if Config.Framework == 'qb' or Config.Framework == 'qbx' then
payStatus = ply.Functions.RemoveMoney('bank', calculatePrice)
else
payStatus = ply.removeAccountMoney("bank", calculatePrice)
end
if not payStatus then return retval end
retval.success = true
retval.transactionId = generateTransactionId()
MySQL.Async.execute('DELETE FROM phone_invoices WHERE id = ?', { id })
return retval
end)
Last updated