Server-Side

Server Exports

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


getSociety

Get all the information about the registered company/gang

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@return table or nil
local society = exports['vms_bossmenu']:getSociety(jobName)
Explanation

If you use the above export, you will get the return information in the table if the job/gang is registered in the config, if not, you will get the return as nil.

Parameters:

  • type: string

  • balance: number

  • accountName: string

  • data: table

  • announcements: table


getSocietyTransactions

Get a list of all transactions from the company

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@return table or nil
local societyTransactions = exports['vms_bossmenu']:getSocietyTransactions(jobName)
Explanation

If you use the above export, you will get the return information in the table if the job/gang is registered in the config, if not, you will get the return as nil.

Result:

{
    {
        id = 192,
        name = 'police',
        executor = 'Character Name',
        executor_identifier = 'char1:XXXXXXXXXXXX',
        type = 'withdraw',
        amount = 5000,
        title = '',
        date = 1732069344,
    },
    {
        id = 242,
        name = 'police',
        executor = 'Character Name',
        executor_identifier = 'char1:XXXXXXXXXXXX',
        type = 'transfer_outgoing',
        amount = 5000,
        title = 'Test Transfer to EMS',
        date = 1732069486,
    },
}

addTransaction

Register a new transaction

---@param {src: playerId}: 
---@param {jobNameFrom: string}: 
---@param {jobNameTo: string | nil}: 
---@param {type: string}: 'withdraw' / 'deposit' / 'transfer_outgoing' / 'transfer_incoming' / 'tax_payment' / 'payout'
---@param {amount: number}
---@param {title: string | nil} 
---@param {cb: function | nil} 
exports['vms_bossmenu']:addTransaction(src, jobNameFrom, jobNameTo, type, amount, title, cb)
Explanation

This export is for entering transactions into the registry, but it will not perform the flow of funds, it will only register the transaction in the database for the job / gang.

Example:

local src = 1 -- player id
local jobNameFrom = 'police' -- from whom the transaction is going out
local jobNameTo = 'ambulance' -- to whom the transaction comes (if there is a jobNameTo parameter other than nil in the transaction, then it will automatically add a transaction for the receiving transaction as well)
local type = 'transfer_outgoing'
local amount = 50000
local title = 'Money transfer to EMS'

exports['vms_bossmenu']:addTransaction(src, jobNameFrom, jobNameTo, type, amount, title, function(success)
    print(success)

    -- Here you can continue your function when a transaction is registered
    -- For example, here you can take money away from the company or add it
    
    -- exports['vms_bossmenu']:removeMoney(jobNameFrom, amount)
    -- exports['vms_bossmenu']:addMoney(jobNameTo, amount)
end)

getMoney

Get company/gang balance

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@return number
local money = exports['vms_bossmenu']:getMoney(jobName)

setMoney

Set the balance of the company/gang account

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {amount: number}
---@param {cb: function | nil}
exports['vms_bossmenu']:setMoney(jobName, amount, cb)
Explanation

Example:

local jobName = 'police'
local amount = 3000
exports['vms_bossmenu']:setMoney(jobName, amount, function(success, totalBalance)
    print(success)
    print('Total balance after setting the amount', totalBalance)
end)

addMoney

Add money to the business/gang account

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {amount: number}
---@param {cb: function | nil}
exports['vms_bossmenu']:addMoney(jobName, amount, cb)
Explanation

Example:

local jobName = 'police'
local amount = 10000
exports['vms_bossmenu']:addMoney(jobName, amount, function(success, totalBalance)
    print(success)
    print('Total balance after adding the amount', totalBalance)
end)

removeMoney

Remove money from the business/gang account

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {amount: number}
---@param {cb: function | nil}
exports['vms_bossmenu']:removeMoney(jobName, amount, cb)
Explanation

Example:

local jobName = 'police'
local amount = 15000
exports['vms_bossmenu']:removeMoney(jobName, amount, function(success, totalBalance)
    print(success)
    print('Total balance after removing the amount', totalBalance)
end)

getEmployees

Get information on all employees of a job

---@param {jobName: string}: Registered job name, e.g. 'police' / 'ambulance'
---@return table
local employees = exports['vms_bossmenu']:getEmployees(jobName)
Explanation

After using this export, you will get the return information as a table if the job/gang is registered in the config, if not, you will get nil.

Parameters:

  • isOnline: boolean

  • name: string

  • identifier: string

  • job: table

    • name: string

    • label: string

    • grade: number

    • grade_name: string


getEmployeesCount

Get the number of employees of a given job

---@param {jobName: string}: Registered job name, e.g. 'police' / 'ambulance'
local employeesCount = exports['vms_bossmenu']:getEmployeesCount(jobName)

getGangMembers

Get information on all gang members

---@param {gangName: string}: Registered gang name, e.g. 'vagos' / 'ballas'
---@return table
local members = exports['vms_bossmenu']:getGangMembers(gangName)
Explanation

After using this export, you will get the return information as a table if the job/gang is registered in the config, if not, you will get nil.

Parameters:

  • isOnline: boolean

  • name: string

  • identifier: string

  • job: table

    • name: string

    • label: string

    • grade: number

    • grade_name: string


getGangMembersCount

Get the number of gang members

---@param {gangName: string}: Registered gang name, e.g. 'vagos' / 'ballas'
---@return number
local membersCount = exports['vms_bossmenu']:getGangMembersCount(gangName)

getClothings

Get information on all job/gang outfits

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {withOutfit: boolean}
---@return table
local clothingList = exports['vms_bossmenu']:getClothings(jobName, withOutfit)
Explanation

After using this export, you will get the return information as a table with all available outfits.

Parameters:

  • id: string

  • job: string

  • grades: table

  • name: string

  • gender: number (0 = male, 1 = female)

  • outfit: table or nil (depending on whether prarameter withOutfit will be as true or false)

Result:

{
    ["123"] = { -- withOutfit as false 
        id = "123",
        job = "police",
        grades = {1,2,4}
        name = "LSPD Outfit 1",
        gender = 0,
    },
    ["155"] = { -- withOutfit as true
        id = "155",
        job = "police",
        grades = {4}
        name = "Boss Outfit 1",
        gender = 0,
        outfit = {
            ['tshirt_1'] = 15, ['tshirt_2'] = 0,
            ['torso_1'] = 152, ['tshirt_2'] = 1,
            ['pants_1'] = 95, ['pants_2'] = 5,
            ['arms'] = 52, ['arms_2'] = 0,
        }
    },
}

getClothing

Get information about a specific outfit from job/gang

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {id: number}
---@return table
local clothing = exports['vms_bossmenu']:getClothing(jobName, id)
Explanation

After using this export, you will get the return information as a table if the provided outfit exist.

Parameters:

  • id: string

  • job: string

  • grades: table

  • name: string

  • gender: number (0 = male, 1 = female)

  • outfit: table

Result:

{
    id = 155,
    job = "police",
    grades = {4}
    name = "Boss Outfit 1",
    gender = 0,
    outfit = {
        ['tshirt_1'] = 15, ['tshirt_2'] = 0,
        ['torso_1'] = 152, ['tshirt_2'] = 1,
        ['pants_1'] = 95, ['pants_2'] = 5,
        ['arms'] = 52, ['arms_2'] = 0,
    }
},

sendAnnouncement

Send a message to the job/gang

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {text: string}: Message
---@param {type: string}: Name of the sender, configurable in config.translation.lua
exports['vms_bossmenu']:sendAnnouncement(jobName, text, type)
Explanation

You can use this as a message to the jobs / gangs, example use for storyline event for gangs.

Example:

local jobName = 'ballas'
local text = 'I heard that tomorrow (24.11.2024) in the evening 18:00 - 20:00, there will be a transport of police weapons from the warehouse on Mission Row to the warehouse on Paleto Bay, get information about the route of the convoy and steal as much loot for us, you will receive a decent salary, good luck!'
local type = 'mafia'

exports['vms_bossmenu']:sendAnnouncement(jobName, text, type)

New type of announcement

By default there is no mafia message type in the script, there is only cityhall, so if you want to use a custom one, you need to register a translation, for this purpose go to config.translation.lua, find announcement.cityhall in your language and add a new one underneath for example:

['announcement.mafia'] = "Mafia",

getGradePermissions

Get permissions information for grade specific jobs or gangs

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {grade: number}: Grade ID
---@param {getValues: boolean}: 
---@return boolean, table | string
local access, perms = exports['vms_bossmenu']:getGradePermissions(jobName, grade, getValues)
Explanation

Results:

Getting informations about grade permissions for which no permissions are configured:

local jobName = 'police'
local grade = 0 -- (Lowest grade - Recruit)
local getValues = false

local access, perms = exports['vms_bossmenu']:getGradePermissions(jobName, grade, getValues)

print(access)
-- print result: true or false

prints(perms)
-- perms will be always nil, because you set getValues = false

Getting informations about grade perms for which it has permissions configured

local jobName = 'police'
local grade = 1
local getValues = true

local access, perms = exports['vms_bossmenu']:getGradePermissions(jobName, grade, getValues)

print(access)
-- print result: true or false

print(json.decode(perms))
-- example print result: {"employeesAccess":true,"safeDeposit":true,"clothingAccess":true,"safeAccess":true}

Getting informations about grade perms, which is entered in theConfig.JobMenusSettings - maxPermissionsGrades

local jobName = 'police'
local grade = 4 -- entered in maxPermissionsGrades
local getValues = true

local access, perms = exports['vms_bossmenu']:getGradePermissions(jobName, grade, getValues)

print(access)
-- print result: true or false

print(perms)
-- print result: "max"
-- returns the value "max" if the grade is in maxPermissionsGrades.

havePermission

Check if a certain grade of job/gang has permissions for a certain action

---@param {jobName: string}: Registered job or gang name, e.g. 'police' / 'ballas'
---@param {grade: number}: Grade ID
---@param {action: string}: permission name (List of permissions in #Explanation)
---@return boolean
local access = exports['vms_bossmenu']:havePermission(jobName, grade, action)
Explanation

Example:

local jobName = 'police'
local grade = 3
local action = 'safeTransfer'

local access = exports['vms_bossmenu']:havePermission(jobName, grade, action)

print(access)
-- print result: true or false

Permissions List:

  • employeesAccess

    employeesGrantBonus employeesChangeGrade

    employeesFire

    employeesHire

  • clothingAccess

    clothingCreate

    clothingModify

  • safeAccess

    safeBalance

    safeWithdraw

    safeDeposit

    safeTransfer

    safeTransactions

  • announcementsAccess

  • resumesAccess

  • taxesAccess

Last updated