Paychecks!

This commit is contained in:
WLVF
2022-09-01 04:07:40 -04:00
parent 140bbcb06b
commit 803727e4e0
2 changed files with 32 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ config = {
"https://i.imgur.com/ZWKfYD9.png" -- Credits: 2XRondo#6374 "https://i.imgur.com/ZWKfYD9.png" -- Credits: 2XRondo#6374
}, },
departments = { departments = { -- these are the required discord role ids to be able to access these departments (enable developer mode in discord's advanced settings and right click the role)
["CIV"] = {"0"}, ["CIV"] = {"0"},
["SAHP"] = {"0"}, ["SAHP"] = {"0"},
["LSPD"] = {"0"}, ["LSPD"] = {"0"},
@@ -23,6 +23,16 @@ config = {
["LSFD"] = {"872921520719142932"} ["LSFD"] = {"872921520719142932"}
}, },
departmentPaychecks = false, -- if you would like salaries to be paid out to the departments, set this to true
paycheckInterval = 24, -- this is how often (in minutes) paychecks are to be paid out if departmentPaychecks is set to true
departmentSalaries = { -- the amount given to the character per interval of time set via paycheckInterval
["CIV"] = 300,
["SAHP"] = 700,
["LSPD"] = 600,
["BCSO"] = 500,
["LSFD"] = 650
},
-- set up the spawn buttons for each department. -- set up the spawn buttons for each department.
spawns = { spawns = {
["CIV"] = { ["CIV"] = {

View File

@@ -64,3 +64,19 @@ AddEventHandler("ND_CharacterSelection:checkPerms", function()
end end
TriggerClientEvent("ND_CharacterSelection:permsChecked", player, allowedRoles) TriggerClientEvent("ND_CharacterSelection:permsChecked", player, allowedRoles)
end) end)
if config.departmentPaychecks then
CreateThread(function()
while true do
Wait(config.paycheckInterval * 60000)
for player, playerInfo in pairs(NDCore.Functions.GetPlayers()) do
local salary = config.departmentSalaries[playerInfo.job]
NDCore.Functions.AddMoney(salary, player, "bank")
TriggerClientEvent("chat:addMessage", player, {
color = {0, 255, 0},
args = {"Salary", "Received $" .. salary .. "."}
})
end
end
end)
end