All exports and events available to integrate this resource into others.
Types & Classes
All types & classes can be found in types.lua.
Suggestions?
If you wish to have any exports and or events added, please head over to our Discord and create a suggestion post. We are happy to allow for easier integration within other resources.
Status Names
When refering to a primary status name, it is the base name of the status.
For multi statuses like being high on thc, the primary is "high" and the secondary is "thc".
For non-multi statuses like "hunger", both the primary & secondary is "hunger". This is why a secondary name is not always required as input.
Client Sided Exports
Get All Statuses
If you want to grab all initialized & cached statuses straight from our cache, you can use this export.
Example:
---@returntable<StatusName, PlayerStatuses> | nil @nil when unloadedlocalstatuses=exports["zyke_status"]:GetAllRawStatuses()
Shorthands (Hunger, thirst, stress & drunk)
We have created a set of shorthands for common statuses. These are very basic to implement and always returns a number value, 0.0 if not initialized to avoid errors.
Example:
This export allows you to grab any status, even non-initialized ones in a error-handled environment. It always return a table with a value, 0.0 if not initialized. The second return value indicates if the status you grabbed was initialized or not.
Example:
Server Sided Exports
Get All Statuses
If you want to grab all initialized & cached statuses for a player, you can use this export.
Example:
Shorthands (Hunger, thirst, stress & drunk)
We have created a set of shorthands for common statuses. These are very basic to implement and always returns a number value, 0.0 if not initialized to avoid errors.
Example:
Get Raw Status
This export allows you to grab any status for a player, even non-initialized ones in a error-handled environment. It always return a table with a value, 0.0 if not initialized. The second return value indicates if the status you grabbed was initialized or not.
Example:
Get Status
Returns just the number value of a status for a player. Returns 0.0 if not initialized.
Example:
Add To Status
Adds an amount to a status.
Example:
Remove From Status
Removes an amount from a status.
Example:
Auto To Status
Automatically choose add/remove based on amount
Example:
Freeze Status For Player
Freezes the status for a player to avoid drain and effects.
Example:
Unfreeze Status For Player
Unfreezes the status for a player to avoid drain and effects. Reset for Freeze Status For Player.
Example:
Get Frozen Players
If you want a list of all frozen players, this export will do just that.
Example:
Is Player Statuses Frozen
Return if a player has their statuses frozen or not.
Example:
---@return {value: number} | PlayerStatus | AddictionStatus, boolean
local status = exports["zyke_status"]:GetRawStatus()
---@param plyId integer
---@return table<StatusName, PlayerStatuses>
local statuses = exports["zyke_status"]:GetAllRawStatuses(plyId)
local hunger = exports["zyke_status"]:GetHunger(plyId)
local thirst = exports["zyke_status"]:GetThirst(plyId)
local stress = exports["zyke_status"]:GetStress(plyId)
local drunk = exports["zyke_status"]:GetDrunk(plyId)
---@param plyId integer
---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName}
---@return number
local value = exports["zyke_status"]:GetStatus(plyId, {"hunger", "hunger"})
---@param plyId integer
---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName}
---@param amount number
---@param skipEnsuring? boolean @Only skip if you have a pool with ensured players
exports["zyke_status"]:AddToStatus(plyId, statusNames, amount, skipEnsuring)
---@param plyId integer
---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName}
---@param amount number
---@param skipEnsuring? boolean @Only skip if you have a pool with ensured players
exports["zyke_status"]:RemoveFromStatus(plyId, statusNames, amount, skipEnsuring)
---@param plyId integer
---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName}
---@param amount number
---@param skipEnsuring? boolean @Only skip if you have a pool with ensured players
exports["zyke_status"]:AutoToStatus(plyId, statusNames, amount, skipEnsuring)