Server-Side

Server Exports

Below are all the useful exports that you can use in other resources, be sure to read their descriptions.


updatePaychecks

With this export you can add or remove money in the paychecks for a specific player, they will be collectible in the cityhall menu.

---@param {src: number}: player id
---@param {amount: number}: The monetary amount to be adjusted in the player's paycheck
---@param {action: string}: Specifies the action to take either 'add' to increase or 'remove' to decrease the paycheck amount.
exports['vms_cityhall']:updatePaychecks(src, amount, action)

getHealthInsurance

Get information about the player's health insurance.

---@param {src: number}: player id

---@return {isInsured: boolean}
---@return {timestamp: number}: time until which it is insured 
local isInsured, timestamp = exports['vms_cityhall']:getHealthInsurance(src)

addHealthInsurance

Add health insurance time.

---@param {src: number}: player id
---@param {daysCount: number}
exports['vms_cityhall']:addHealthInsurance(src, daysCount)

giveBill

Using the above export, you can assign a fine or invoice to a player, without the required issuance by another player or acceptance by the receiving player, an example application, for example, for speed cameras.

---@param {src: number}: player id
---@param {type: string}: 'ticket' / 'traffic-ticket' / 'invoice'
---@param {data: table}
---@param {giveItem: boolean}: do you want the player to receive an inventory mandate item?

---@return {fineId: number}: id of the document assigned in the database
exports['vms_cityhall']:giveBill(src, type, data, giveItem, function(fineId)

end)
Explanation

Clarification of the values required for the data parameter for invoice:

  • data: table

    • society?: string

    • job?: string

    • jobLabel?: string

    • issuerName?: string

    • dateToPay?: number

    • percentageForSociety?: number

    • invoiceData: table

    • taxFromInvoice?: number

Clarification of the values required for the data parameter for ticket:

  • data: table

    • society?: string

    • job?: string

    • jobLabel?: string

    • issuerName?: string

    • dateToPay?: number

    • amount: number

    • percentageForSociety?: number

    • locationOfViolation?: string

    • violation?: string

    • comments?: string

Clarification of the values required for the data parameter for traffic-ticket:

  • data: table

    • society?: string

    • job?: string

    • jobLabel?: string

    • issuerName?: string

    • dateToPay?: number

    • amount: number

    • percentageForSociety?: number

    • locationOfViolation?: string

    • violation?: string

    • comments?: string

    • vehicle?: table

      • plate?: string

      • make?: string

      • model?: string

      • vin?: string

    • license?: string

    • licenseRevocation?: boolean

    • licenseSuspensionTime?: number

    • penaltyPointsCount?: number

Example of Invoice

local src = 1
local giveItem = true

--[[
    The amount to be paid will be based on the data entered in invoiceData,
    if you enter as below, the final player to pay will be 45,000$,
    if we add tax, it will be 47,250$.
]]

exports['vms_cityhall']:giveBill(src, 'invoice', {
    society = 'society_ambulance',
    job = 'ambulance',
    jobLabel = 'EMS',
    issuerName = 'Medical assistance',
    dateToPay = -1, -- Instant Payment
    percentageForSociety = 20,
    invoiceData = {
        {qty = 1, unitPrice = 3000, description = "first row"},
        {qty = 5, unitPrice = 8000, description = "second row"},
        {qty = 2, unitPrice = 1000, description = "third row"},
    },
    taxFromInvoice = 5.0, 
}, giveItem, function(fineId)
    print('Player ' .. src .. ' received invoice #' .. fineId)
end)

Example of Ticket

local src = 1
local giveItem = true

exports['vms_cityhall']:giveBill(src, 'ticket', {
    society = 'society_police',
    job = 'police',
    jobLabel = 'LSPD',
    issuerName = 'NPC Officer',
    dateToPay = 5, -- 5 Days
    amount = 2000,
    percentageForSociety = 20,
    locationOfViolation = "Mission Row",
    violation = "Test ticket",
    comments = "",
}, giveItem, function(fineId)
    print('Player ' .. src .. ' received ticket #' .. fineId)
end)

Example of Traffic Ticket

local src = 1
local giveItem = true

local myPed = GetPlayerPed(src)
local myVehicle = GetVehiclePedIsIn(myPed, false)

exports['vms_cityhall']:giveBill(src, 'traffic-ticket', {
    society = 'society_police',
    job = 'police',
    jobLabel = 'LSPD',
    issuerName = 'Speed Camera',
    dateToPay = -1, -- Instant Payment
    amount = 5000,
    percentageForSociety = 20,
    locationOfViolation = "Mission Row",
    violation = "Exceeding the speed limit",
    comments = "The speed camera recorded the speed 143/50 MPH",
    vehicle = {
        plate = GetVehicleNumberPlateText(myVehicle),
        make = "-",
        model = "-",
        vin = "-",
    },
    license = 'drive_b',
    licenseRevocation = false,
    licenseSuspensionTime = nil, -- days or nil
    penaltyPointsCount = 2,
}, giveItem, function(fineId)
    print('Player ' .. src .. ' received traffic ticket #' .. fineId)
end)

suspenseLicense

Cancellation of the license and its suspension for a specified period of time, using, for example, vms_driveschoolv2, then the player will not be able to take the exam until the lockout ends.

---@param {src: number}: player id
---@param {licenseName: string}: license name like 'drive_b'
---@param {time: number}: The value given in seconds - for example, 7 * 24 * 60 * 60, then it will be 7 days of blocking the license
exports['vms_cityhall']:suspenseLicense(src, licenseName, time)

reinstateLicense

Restores the ability to take exams * It does not return previously revoked licenses to the player.

---@param {src: number}: player id
---@param {licenseName: string}: license name like 'drive_b'
exports['vms_cityhall']:reinstateLicense(src, licenseName)

isLicenseSuspended

Checking the license information, this will return information on whether the license is suspended and if it is, it will also return the end date of the suspension.

---@param {src: number}: player id
---@param {licenseName: string}: license name like 'drive_b'

---@return {isSuspended: boolean}: true or false, you can add to your driving school the ability to take the exam
---@return {suspendedTime: number or nil}: timestamp of the date when the license suspension penalty will end
local isSuspended, suspendedTime = exports['vms_cityhall']:isLicenseSuspended(src, licenseName)

getPenaltyPoints

Get information about a player's penalty points.

---@param {src: number}: player id

---@return {penaltyPoints: number}: number of penalty points
local penaltyPoints = exports['vms_cityhall']:getPenaltyPoints(src)

addPenaltyPoints

Add penalty points to the player.

---@param {src: number}: player id
---@param {count: number}: number of penalty points
exports['vms_cityhall']:addPenaltyPoints(src, count)

removePenaltyPoints

Remove penalty points for the player.

---@param {src: number}: player id
---@param {count: number}: number of penalty points
---@param {removeFromList: boolean}
exports['vms_cityhall']:removePenaltyPoints(src, count, removeFromList)
Explanation

Explanation of removeFromList

The script automatically removes after the time specified in Config.RemovePenaltyPointsAfter penalty points from the time they were given to the citizen, you set this parameter to true, then the points will be subtracted from the list which will result in the correct removal of penalty points automatically in the future.


resetPenaltyPoints

Resets the penalty points and clears the player's list of penalty points.

---@param {src: number}: player id
exports['vms_cityhall']:resetPenaltyPoints(src)

setResumeAllowed

Allows or prevents citizens from sending resumes to a specific job in the Job Center section of the city hall menu.

---@param {jobName: string}: job name like 'mechanic'
---@param {isAllowed: boolean}
exports['vms_cityhall']:setResumeAllowed(jobName, isAllowed)

getJobResumes

Returns all active resumes sent by citizens for a specific job.

---@param {jobName: string}: job name like 'mechanic'

---@return {resumes: table}:
local resumes = exports['vms_cityhall']:getJobResumes(jobName)
Explanation

Return value is a table that has information about all received active resumes to the company, below is an explanation of the parameters and an example.

Parameters:

  • sender: string

  • sender_name: string

  • job: string

  • date: number

  • informations: table

    • phone_number: string

    • photo: string

    • about_me: string

    • work_experience: string

    • skills: table

    • interests: table


Example:

{
    ['char1:11000000a0aa00a'] = {
        sender = "char1:11000000a0aa00a",
        sender_name "Character Name",
        job = "mechanic",
        date = 1729737106,
        informations = {
            phone_number = "123-5678",
            photo = "data:image/png;base64,iVBO...",
            about_me = "My example of about me!",
            work_experience = "My example of work experience!",
            skills = {"👥 Teamwork","✊ Leadership"},
            interests = {"📸 Photography","🎮 Video games"},
        }
    },
}

getJobTaxes

Returns all the company's taxes, both paid and not yet paid

---@param {jobName: string}: job name like 'mechanic'

---@return {taxes: table}:
local taxes = exports['vms_cityhall']:getJobTaxes(jobName)
Explanation

Return value is a table that has information about all taxes from the company, below is an explanation of the parameters and an example.

Parameters:

  • period: string

  • job: string

  • job_label: string

  • is_paid: boolean

  • paid_date: number

  • paid_amount: number

  • amount: number

  • delayed_amount: number

  • late_fee_applied: number


Example:

{
    ['08:2024'] = {
        period = "08:2024",
        job = "mechanic",
        job_label = "BennyS",
        is_paid = true,
        paid_date = 1729097877
        paid_amount = 13740,
        amount = 12400,
        delayed_amount = 1340,
        late_fee_applied = 1,
    },
}

getTaxAmount

Calculates tax information on the specified amount.

---@param {amount: number}: 
---@param {tax: number or string}: 

---@return {totalAmount: number}
---@return {taxAmount: number}
---@return {taxPercentage: number}
local totalAmount, taxAmount, taxPercentage = exports['vms_cityhall']:getTaxAmount(amount, tax)
Explanation

Example of custom tax:

local amount = 50000
local tax = 33 -- custom value given as number

local totalAmount, taxAmount, taxPercentage = exports['vms_cityhall']:getTaxAmount(amount, tax)

---@return totalAmount: 66500.0   |  (amount + tax)
---@return taxAmount: 16500.0     |  (tax value alone)
---@return taxPercentage: 33      |  (tax percentage)

Example of tax from Config.Taxes:

local amount = 50000
local tax = 'products.food' -- By default it's 33 %

local totalAmount, taxAmount, taxPercentage = exports['vms_cityhall']:getTaxAmount(amount, tax)

---@return totalAmount: 66500.0   |  (amount + tax)
---@return taxAmount: 16500.0     |  (tax value alone)
---@return taxPercentage: 33      |  (tax percentage)

addPlayerTaxToPay

Add a private player tax to be paid on the specified amount using the path from Config.Taxes.

---@param {identifier: number or string}: player server id or player identifier
---@param {fromAmount: number}: the amount on which tax is to be charged
---@param {taxPath: string}: example: 'products.food'
---@param {title: string}: reason for imposing the tax
exports['vms_cityhall']:addPlayerTaxToPay(identifier, fromAmount, taxPath, title)

addPlayerCustomTaxToPay

Add a private player custom tax to be paid on the specified amount.

---@param {identifier: number or string}: player server id or player identifier
---@param {fromAmount: number}: the amount on which tax is to be charged
---@param {percentage: number}: percentage to be charged on the amount
---@param {title: string}: reason for imposing the tax
exports['vms_cityhall']:addPlayerCustomTaxToPay(identifier, fromAmount, percentage, title)

addCompanyTaxAmount

Add the company's tax to be paid on the specified amount using the path from Config.Taxes.

---@param {job: string}: job name like 'mechanic'
---@param {fromAmount: number}: the amount on which tax is to be charged
---@param {taxPath: string}: example: 'products.food'
exports['vms_cityhall']:addCompanyTaxAmount(job, fromAmount, taxPath)

addCompanyCustomTaxAmount

Add custom company tax to be paid on the amount specified.

---@param {job: string}: job name like 'mechanic'
---@param {fromAmount: number}: the amount on which tax is to be charged
---@param {percentage: number}: percentage to be charged on the amount
exports['vms_cityhall']:addCompanyCustomTaxAmount(job, fromAmount, percentage)

addCompanyFlatTaxAmount

Add to the company the amount of tax to be paid.

---@param {job: string}: job name like 'mechanic'
---@param {amount: number}: static number that will be added to the charge in company taxes
exports['vms_cityhall']:addCompanyFlatTaxAmount(job, amount)

registerBusinessTaxAccount

Register the company as a tax business.

You don't have to use this export, you can enter the company data in the Config.TaxBusinessAccounts which is located in vms_cityhall/config/config.taxes.lua

---@param {jobName: string}: job name like 'mechanic'
---@param {jobLabel: string}: job label like 'BennyS'

---@return {period: string}: 'MM:YYYY'
exports['vms_cityhall']:registerBusinessTaxAccount(jobName, jobLabel, function(period)

end)

getCompanyMoney

Get information about the current balance of cityhall.

---@return {amount: number}
local amount = exports['vms_cityhall']:getCompanyMoney()

addCompanyMoney

Add money to cityhall balance.

---@param {amount: number}
---@param {addToTotalEarned: boolean}: are they to be added to the Total Earned section
exports['vms_cityhall']:addCompanyMoney(amount, addToTotalEarned)

removeCompanyMoney

Take money from the balance of cityhall.

---@param {amount: number}
exports['vms_cityhall']:removeCompanyMoney(amount)

GenerateSSN

In the section Generate SSN for current players there is a tutorial on how to generate SSNs for current players who do not have one.

Read also section Automatic SSN generation to implement in your framework the automatic generation of the SSN for players.

---@param {dateOfBirth: string}
---@param {gender: string or number} 
local ssn = exports['vms_cityhall']:GenerateSSN(dateOfBirth, gender)

GenerateVIN

In the section Generate VIN for current vehicles there is a tutorial on how to generate VINs for current vehicles who do not have one.

Read also section Automatic VIN generation to implement in your vehicleshop the automatic generation of the VIN.

local vin = exports['vms_cityhall']:GenerateVIN()

Last updated