ESX Status is a basic script that provides an easy way to add player status’s to your server. It is what allows esx_basicneeds to handle the player’s hunger and thirst.
Configuration
Config.StatusMax
type: integer
default: 1000000
description: The maximum value a status can have.
Config.TickTime
type: integer
default: 1000
description: The time in milliseconds between each tick.
Config.UpdateInterval
type: integer
default: 10000
description: The time in milliseconds between each status save.
Config.Display
type: boolean
default: false
description: Whether to display the status on the screen.
Usage
Client
registerStatus
Parameters:
name (string): The name of the status.
default (number): The default value of the status.
color (table): The color of the status.
r (number): The red value of the color.
g (number): The green value of the color.
b (number): The blue value of the color.
visible (boolean): (deprecated) Whether the status is visible on the screen.
tickCallback (function): A function that is called every status tick.
Example:
unregisterStatusTriggerEvent("esx_status:registerStatus", 'hunger', 1000000, {r = 255, g = 255, b = 255}, function(status)
status.remove(1000)
end)
Parameters:
name (string): The name of the status.
Example:
setTriggerEvent("esx_status:unregisterStatus", 'hunger')
Sets the value of a status.
Parameters:
name (string): The name of the status.
val (number): The value to set the status to.
Example:
addTriggerEvent("esx_status:set", 'hunger', 1000000)
Adds a value to a status.
Parameters:
name (string): The name of the status.
val (number): The value to add to the status.
Example:
removeTriggerEvent("esx_status:add", 'hunger', 1000)
Removes a value from a status.
Parameters:
name (string): The name of the status.
val (number): The value to remove from the status.
getStatusTriggerEvent("esx_status:remove", 'hunger', 1000)
Gets the value of a status.
Parameters:
name (string): The name of the status.
callback (function): A function that is called with the status value.
getAllStatusTriggerEvent("esx_status:getStatus", 'hunger', function(status)
print(status.val)
end)
Gets the value of all statuses.
Parameters:
callback (function): A function that is called with a table of all status values.
TriggerEvent("esx_status:getAllStatus", function(stats)
for i=1, #stats, 1 do
print(stats.name, stats.val)
end
end)
Server
getStatus
Gets the value of a status.
Parameters:
source (number): The player’s server ID.
name (string): The name of the status.
callback (function): A function that is called with the status value.
TriggerEvent("esx_status:getStatus", source, 'hunger', function(status)
print(status.val)
end)

