Statuses

Dynamically handle your statuses.

In our UIV2 (version 2.9) you can handle status registers and unregisters through simple exports.

Registering new status

In order to register status you need to use such export:

exports['ZSX_UIV2']:RegisterStatus(statusName, icon, defaultValue, getFunction)

Params explained

Parameter
Type
About

statusName

String

Name of your status

icon

String

Icon of your status

defaultValue

Number

Default value of the status

getFunction

Function

Function that returns value of the status

Example register of the status

Since it might be a bit confusing, here's an example how to properly register your status:

local statusName = "hygiene" -- name of the status
local icon = "fas fa-soap" -- icon of the status
local defaultValue = 100 -- default value of the status, 100 means max level
local getFunction = function()
    return exports['my-pseudo-status']:GetHygieneLevel() -- returns hygiene level from 
    --our pseudo resource called "my-pseudo-status" with export name of GetHygieneLevel()
end

exports['ZSX_UIV2']:RegisterStatus(statusName, icon, defaultValue, getFunction)

Be careful!

Make sure that all of the parameters uses proper types, such as strings, functions etc. and that getFunction parameter returns number values.

Unregistering status

To properly unregister status you need to know the status name of it. Then you can easily call:

Params explained

Parameter
Type
About

statusName

String

Name of your status

Last updated