🛠️Installation
Here you can find the dependencies you need, instructions on how to start the script.
If you still have issues installing the script or encounter any errors, don't hesitate to create a ticket in our discord.
Dependencies
Make sure you have installed all the dependencies. Without these scripts the script will not work properly.
es_extended
Ensuring scripts
To make sure the script works properly we need to make sure all scripts start in the right order in your server.cfg. Below you can find an example of how it can look like.
-- Start oxmysql
start oxmysql
-- Start your framework
start es_extended
-- Start the libary
start ox_lib
-- And now we can start the script
ensure [dvc] or script_name
Database
No need to import any .sql file, we handle this for you whenever you start the script for the first time. You will see results in the server console. ;)
Optional - Paycheck
If you want to log paychecks so they appear in the banking app under "History", you need to do the following:
Config.LogPaycheck = true
you have to change your paycheck.lua file inside the es_extended.
You can find the file here: /es_extended/server/modules/paycheck.lua
Here you have to add this line:
TriggerEvent("dvc_banking:logPaycheck", xPlayer.identifier, salary, xPlayer.job.label)
that it looks like this
function StartPayCheck()
CreateThread(function()
while true do
Wait(Config.PaycheckInterval)
for player, xPlayer in pairs(ESX.Players) do
local jobLabel = xPlayer.job.label
local job = xPlayer.job.grade_name
local onDuty = xPlayer.job.onDuty
local salary = (job == "unemployed" or onDuty) and xPlayer.job.grade_salary or ESX.Math.Round(xPlayer.job.grade_salary * Config.OffDutyPaycheckMultiplier)
if xPlayer.paycheckEnabled then
if salary > 0 then
if job == "unemployed" then -- unemployed
xPlayer.addAccountMoney("bank", salary, "Welfare Check")
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_help", salary), "CHAR_BANK_MAZE", 9)
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - Unemployment Benefits", "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
TriggerEvent("dvc_banking:logPaycheck", xPlayer.identifier, salary, xPlayer.job.label)
elseif Config.EnableSocietyPayouts then -- possibly a society
TriggerEvent("esx_society:getSociety", xPlayer.job.name, function(society)
if society ~= nil then -- verified society
TriggerEvent("esx_addonaccount:getSharedAccount", society.account, function(account)
if account.money >= salary then -- does the society money to pay its employees?
xPlayer.addAccountMoney("bank", salary, "Paycheck")
account.removeMoney(salary)
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - " .. jobLabel, "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
TriggerEvent("dvc_banking:logPaycheck", xPlayer.identifier, salary, xPlayer.job.label)
else
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), "", TranslateCap("company_nomoney"), "CHAR_BANK_MAZE", 1)
end
end)
else -- not a society
xPlayer.addAccountMoney("bank", salary, "Paycheck")
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - " .. jobLabel, "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
TriggerEvent("dvc_banking:logPaycheck", xPlayer.identifier, salary, xPlayer.job.label)
end
end)
else -- generic job
xPlayer.addAccountMoney("bank", salary, "Paycheck")
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - Generic", "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
TriggerEvent("dvc_banking:logPaycheck", xPlayer.identifier, salary, xPlayer.job.label)
end
end
end
end
end
end)
end
Optional - Better Performance
If you want better performance, you can use PolyZone. This helps certain processes run more efficiently. To use PolyZone, you need to do the following: Make sure you have PolyZone properly installed and started on your server.
Config.PolyZone = true
client_scripts {
'client/*.lua',
--'@PolyZone/client.lua', --uncommend this for use
--'@PolyZone/BoxZone.lua', --uncommend this for use
'locales/*.lua'
}
Last updated