esx_status

MLO-uri, interioare, hărți optimizate și asset-uri pentru stream.
Post Reply
User avatar
greenie
Full Member
Full Member
Posts: 4444
Joined: Sun Nov 21, 2021 4:55 pm
Jucator SA:MP ?: Nu
Nick:: greenie
Jucator CS ?: Da

esx_status

Post by greenie »

https://github.com/esx-framework/ESX-Le ... esx_status

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:
TriggerEvent("esx_status:registerStatus", 'hunger', 1000000, {r = 255, g = 255, b = 255}, function(status)
status.remove(1000)
end)
unregisterStatus
Parameters:

name (string): The name of the status.
Example:
TriggerEvent("esx_status:unregisterStatus", 'hunger')
set
Sets the value of a status.

Parameters:

name (string): The name of the status.
val (number): The value to set the status to.
Example:
TriggerEvent("esx_status:set", 'hunger', 1000000)
add
Adds a value to a status.

Parameters:

name (string): The name of the status.
val (number): The value to add to the status.
Example:
TriggerEvent("esx_status:add", 'hunger', 1000)
remove
Removes a value from a status.

Parameters:

name (string): The name of the status.
val (number): The value to remove from the status.
TriggerEvent("esx_status:remove", 'hunger', 1000)
getStatus
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.
TriggerEvent("esx_status:getStatus", 'hunger', function(status)
print(status.val)
end)
getAllStatus
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)
𝑴𝒂𝒚𝒃𝒆 𝒕𝒉𝒆 𝑬𝒂𝒓𝒕𝒉 𝒊𝒔 𝒕𝒉𝒆 𝑯𝒆𝒍𝒍 𝒐𝒇 𝑨𝒏𝒐𝒕𝒉𝒆𝒓 𝑷𝒍𝒂𝒏𝒆𝒕... ☢️

✅ GAZDUIRE JOCURI / VPS / GAZDUIRE WEB / SERVERE DEDICATE - Stock NELIMITAT / Valabil comandati pe https://www.zonek.ro/
Post Reply

Return to “Server Resources”