vms* store - Docs
Purchase Asset
  • Welcome
  • Official Store
  • Discord
  • Helpful
    • Basic Server Knowledge
      • How to import SQL to database?
      • How to update server artifacts?
    • General Issues
    • Prepared Resources
  • ASSETS
    • vms_notifyV2
      • Installation
      • FAQ
      • Guides
        • Text Formatting
        • Swap in framework
      • Developer API
        • Client Exports
        • Server Events
      • Configuration Files
        • config.lua
        • config.js
    • vms_bossmenu
      • Installation
      • Compatibility
      • FAQ
      • Guides
        • Creating job2 on ESX
        • Paychecks Integration
      • Developer API
        • Client Exports
        • Client Events
        • Server Exports
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
    • vms_cityhall
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Guides
        • License Revocation
        • Personal Taxes Integration
        • Business Taxes Integration
        • Paychecks Integration
        • Add SSN Generation
        • Generate SSN for Players
        • Add VIN Generation
        • Generate VIN for Vehicles
      • Developer API
        • Client Exports
        • Server Exports
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.shared.lua
        • config.clerks.lua
        • config.taxes.lua
        • config.js
    • vms_documentsV2
      • Installation
      • FAQ
      • Common Errors
      • Guides
        • Add SSN Generation
        • Generate SSN for Players
        • Creating New Document
        • Driving School Integration
      • Developer API
        • Client Exports
        • Server Exports
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • metadata.js
    • vms_garagesV2
      • Installation
      • Compatibility
        • Housings
          • qs-housing
          • esx_property
          • bcs_housing
        • Phones
          • yflip-phone
          • qs-smartphone-pro
        • Other
          • VehicleDeformation
          • kq_wheeldamage
      • FAQ
      • Common Errors
      • Guides
        • Interior Stuck Prevention
        • Registering House Garage
      • Developer API
        • Client Exports
        • Server Exports
        • Server Events
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.garages.lua
        • config.management.lua
        • config.parkingcreator.lua
        • config.js
    • vms_houserobberies
      • Installation
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.items.lua
        • config.interiors.lua
        • config.houseslist.lua
        • config.configurator.lua
    • vms_vehicleshopV2
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Guides
        • Adjusting Required Licenses
        • Adjusting orderprice
        • Photos Tool
      • Developer API
        • Client Exports
        • Client Events
        • Server Exports
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
        • config.showroom.lua
        • config.js
    • vms_stores
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.camera.lua
        • config.robbery.lua
        • config.storemanage.lua
        • config.js
    • vms_reports
      • Installation
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.js
    • vms_tuning
      • Installation
      • FAQ
      • Common Errors
      • Guides
        • Garage Integration
          • jg-advancedgarages
        • Understanding Prices
        • Using whitelist & blacklist
        • Fix tuning parts names from NULL
        • Paychecks from the built-in balance
      • Developer API
        • Client Exports
        • Server Exports
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.vehicles.lua
        • config.tuningmenu.lua
        • config.installationparts.lua
        • config.custommods.lua
        • config.missions.lua
    • vms_gym
      • Installation
      • FAQ
      • Common Errors
      • Developer API
        • Client Exports
        • Server Exports
        • Server Events
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
    • vms_hud
      • Installation
      • FAQ
      • Common Errors
      • Developer API
        • Client Exports
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.js
    • vms_spawnselector
      • Installation
      • Compatibility
        • vms_multichars
        • esx_multicharacter
        • esx_identity
        • qb-multicharacter
      • FAQ
      • Developer API
        • Client Exports
        • Server Events
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
    • vms_guidebook
      • Installation
      • Guides
        • Text Formating
      • Developer API
        • Client Exports
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
        • pages.js
    • vms_coinshop
      • Installation
      • Configuration Files
        • config.lua
    • vms_vehicleshop
      • Installation
      • Configuration Files
        • config.lua
    • vms_gangmissions
      • Installation
      • Guides
        • Connection to NPCTALK
      • Configuration Files
        • config.lua
    • vms_charcreator
      • Installation
      • Compatibility
        • vms_multichars
        • esx_multicharacter
        • esx_identity
        • qb-multicharacter
        • ZSX_Multicharacter
        • renzu_multicharacter
      • FAQ
      • Developer API
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
    • vms_clothestore
      • Installation
      • Compatibilty
      • Common Errors
      • Developer API
        • Client Exports
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
        • config.prices.lua
        • config.js
    • vms_multichars
      • Installation
      • Compatibilty
      • Common Errors
      • Developer API
        • Commands
      • Configuration Files
        • config.lua
        • config_client.lua
        • config_server.lua
        • config_commands.lua
    • vms_identity
      • Installation
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
    • vms_barber
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
    • vms_tattooshop
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Guides
        • New ADD-ON Tattoos
      • Developer API
        • Client Exports
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
        • config.tattoos.lua
    • vms_driveschoolV2
      • Installation
      • Compatibility
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
    • vms_boatschoolV2
      • Installation
      • Compatibility
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.routes.lua
    • vms_flightschoolV2
      • Installation
      • Compatibility
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.routes.lua
    • vms_documents
      • Installation
      • Guides
        • Adding to radialmenu
        • Usage of documents
        • Adding new documents
      • Configuration Files
        • config.lua
    • vms_anims
      • Installation
      • Guides
        • Adding animations
        • Adding more binds
      • Developer API
        • Client Exports
      • Configuration Files
        • config.lua
        • animations.lua
        • keybinds.lua
    • vms_weaponshop
      • Installation
      • Configuration Files
        • config.lua
    • vms_notify
      • Installation
      • Guides
        • Implementation
        • Replace core notifications
Powered by GitBook
On this page
  • ESX Modifiied Paycheck's:
  • QB-Core Modifiied Paycheck's:

Was this helpful?

  1. ASSETS
  2. vms_tuning
  3. Guides

Paychecks from the built-in balance

ESX Modifiied Paycheck's:

  1. Go to es_extended/server/paycheck.lua

local tuningJobs = { -- Here you have to add the job along with the tuning id in order for it to load the workshop balance correctly
    ['mechanic'] = 'BennyS',
    -- ['JOB_NAME'] = 'TUNING_ID',
}

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 salary = xPlayer.job.grade_salary

                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
                    elseif Config.EnableSocietyPayouts then -- possibly a society
                        if tuningJobs[xPlayer.job.name] then
                            local tuningId = tuningJobs[xPlayer.job.name]
                            local tuningMoney = exports['vms_tuning']:getCompanyMoney(tuningId)
                            if tuningMoney >= salary then
                                xPlayer.addAccountMoney("bank", salary, "Paycheck")
                                exports["vms_tuning"]:removeCompanyMoney(tuningId, salary)
                                TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
                                TriggerClientEvent("vms_tuning:updateBusiness", -1, tuningId, nil, {sub = "balance", value = exports['vms_tuning']:getCompanyMoney(tuningId)})
                            else
                                TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), "", TranslateCap("company_nomoney"), "CHAR_BANK_MAZE", 1)
                            end
                        else
                            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)
                                        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)
                                end
                            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)
                    end
                end
            end
        end
    end)
end

QB-Core Modifiied Paycheck's:

  1. Go to qb-core/server/functions.lua

  2. Find function PaycheckInterval()

local tuningJobs = { -- Here you have to add the job along with the tuning id in order for it to load the workshop balance correctly
    ['mechanic'] = 'BennyS',
    -- ['JOB_NAME'] = 'TUNING_ID',
}

function PaycheckInterval()
    if next(QBCore.Players) then
        for _, Player in pairs(QBCore.Players) do
            if Player then
                local payment = QBShared.Jobs[Player.PlayerData.job.name]['grades'][tostring(Player.PlayerData.job.grade.level)].payment
                if not payment then payment = Player.PlayerData.job.payment end
                if Player.PlayerData.job and payment > 0 and (QBShared.Jobs[Player.PlayerData.job.name].offDutyPay or Player.PlayerData.job.onduty) then
                    if QBCore.Config.Money.PayCheckSociety then
                        if tuningJobs[Player.PlayerData.job.name] then
                            local tuningId = tuningJobs[Player.PlayerData.job.name]
                            local tuningMoney = exports['vms_tuning']:getCompanyMoney(tuningId)
                            if tuningMoney >= payment then
                                Player.Functions.AddMoney('bank', payment, 'paycheck')
                                exports["vms_tuning"]:removeCompanyMoney(tuningId, payment)
                                TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
                                TriggerClientEvent("vms_tuning:updateBusiness", -1, tuningId, nil, {sub = "balance", value = exports['vms_tuning']:getCompanyMoney(tuningId)})
                            else
                                TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
                            end
                        else
                            local account = exports['qb-banking']:GetAccountBalance(Player.PlayerData.job.name)
                            if account ~= 0 then          -- Checks if player is employed by a society
                                if account < payment then -- Checks if company has enough money to pay society
                                    TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
                                else
                                    Player.Functions.AddMoney('bank', payment, 'paycheck')
                                    exports['qb-banking']:RemoveMoney(Player.PlayerData.job.name, payment, 'Employee Paycheck')
                                    TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
                                end
                            else
                                Player.Functions.AddMoney('bank', payment, 'paycheck')
                                TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
                            end
                        end
                    else
                        Player.Functions.AddMoney('bank', payment, 'paycheck')
                        TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
                    end
                end
            end
        end
    end
    SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end

Last updated 1 year ago

Was this helpful?