Exports & Events
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:lua---@return table<StatusName, PlayerStatuses> | nil @nil when unloaded local statuses = 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:lualocal hunger = exports["zyke_status"]:GetHunger() local thirst = exports["zyke_status"]:GetThirst() local stress = exports["zyke_status"]:GetStress() local drunk = exports["zyke_status"]:GetDrunk()
#Get Raw Status
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:lua---@return {value: number} | PlayerStatus | AddictionStatus, boolean local status = exports["zyke_status"]:GetRawStatus()
#Server Sided Exports
#Get All Statuses
If you want to grab all initialized & cached statuses for a player, you can use this export.
Example:lua---@param plyId integer ---@return table<StatusName, PlayerStatuses> local statuses = exports["zyke_status"]:GetAllRawStatuses(plyId)
#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:lualocal 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)
#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:lua---@param plyId integer ---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName} ---@return {value: number} | PlayerStatus | AddictionStatus, boolean local status, isInitialized = exports["zyke_status"]:GetRawStatus(plyId, {"stress", "stress"})
#Get Status
Returns just the number value of a status for a player. Returns 0.0 if not initialized.
Example:lua---@param plyId integer ---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName} ---@return number local value = exports["zyke_status"]:GetStatus(plyId, {"hunger", "hunger"})
#Add To Status
Adds an amount to a status.
Example:lua---@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)
#Remove From Status
Removes an amount from a status.
Example:lua---@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)
#Auto To Status
Automatically choose add/remove based on amount
Example:lua---@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)
#Freeze Status For Player
Freezes the status for a player to avoid drain and effects.
Example:lua---@param plyId PlayerId @ (integer) exports["zyke_status"]:FreezeStatus(plyId)
#Unfreeze Status For Player
Unfreezes the status for a player to avoid drain and effects. Reset for Freeze Status For Player.
Example:lua---@param plyId PlayerId @ (integer) exports["zyke_status"]:UnfreezeStatus(plyId)
#Get Frozen Players
If you want a list of all frozen players, this export will do just that.
Example:lua---@class FrozenPlayer ---@field plyId PlayerId @ (integer) ---@field frozenAt OsTime @ (integer) ---@return table<PlayerId, FrozenPlayer> @ (integer) exports["zyke_status"]:GetFrozenPlayers()
#Is Player Statuses Frozen
Return if a player has their statuses frozen or not.
Example:lua---@param plyId PlayerId @ (integer) ---@return boolean exports["zyke_status"]:IsPlayerFrozen(plyId)
