Skip to content

Server Exports & Events ​

Call these from any server script. src is the player's server id. Exports do nothing (and return nil) when the player is not online.


Stress ​

Server stress values are exact — the job % is not applied.

GetStress

Returns a player's stress.

Export ​

lua
exports.fwb_hud:GetStress(src)
ParameterTypeDescription
srcnumberPlayer server id

Returns ​

  • number 0–100

Example ​

lua
local stress = exports.fwb_hud:GetStress(source)
print(('Player %s stress: %d'):format(source, stress))
SetStress

Sets a player's stress to an exact value.

Export ​

lua
exports.fwb_hud:SetStress(src, value)
ParameterTypeDescription
srcnumberPlayer server id
valuenumber0–100

Returns ​

  • number — the new stress

Example ​

lua
exports.fwb_hud:SetStress(source, 25)
AddStress

Adds stress to a player.

Export ​

lua
exports.fwb_hud:AddStress(src, amount)
ParameterTypeDescription
srcnumberPlayer server id
amountnumberStress to add

Returns ​

  • number — the new stress

Example ​

lua
-- bank robbery started
AddEventHandler('myrobbery:started', function(src)
    exports.fwb_hud:AddStress(src, 10)
end)
RemoveStress

Removes stress from a player. RelieveStress does the same.

Export ​

lua
exports.fwb_hud:RemoveStress(src, amount)
ParameterTypeDescription
srcnumberPlayer server id
amountnumberStress to remove

Returns ​

  • number — the new stress

Example ​

lua
RegisterNetEvent('myspa:relax', function()
    exports.fwb_hud:RemoveStress(source, 25)
end)
ResetStress

Sets a player's stress back to 0.

Export ​

lua
exports.fwb_hud:ResetStress(src)

Returns ​

  • number — 0

Example ​

lua
-- after a revive
exports.fwb_hud:ResetStress(source)

Statuses ​

GetStatuses

Status values live on the player's PC, so this asks that player's game once and answers through a callback. The callback gets nil if there is no answer within 3 seconds.

Export ​

lua
exports.fwb_hud:GetStatuses(src, cb)
ParameterTypeDescription
srcnumberPlayer server id
cbfunctionCalled with { health = 86, hunger = 54, ... } or nil

Example ​

lua
exports.fwb_hud:GetStatuses(source, function(statuses)
    if statuses then
        print('Health:', statuses.health, 'Thirst:', statuses.thirst)
    end
end)
GetStatus

Same as GetStatuses, for one status.

Export ​

lua
exports.fwb_hud:GetStatus(src, id, cb)
ParameterTypeDescription
srcnumberPlayer server id
idstringStatus id
cbfunctionCalled with the value (0–100) or nil

Example ​

lua
exports.fwb_hud:GetStatus(source, 'hunger', function(hunger)
    if hunger and hunger < 10 then
        print('Player is starving')
    end
end)
SetStatus

Sets a status (0–100) on a player's HUD.

Export ​

lua
exports.fwb_hud:SetStatus(src, id, value)
ParameterTypeDescription
srcnumberPlayer server id
idstringStatus id
valuenumber0–100

Example ​

lua
AddEventHandler('myhygiene:changed', function(src, level)
    exports.fwb_hud:SetStatus(src, 'hygiene', level)
end)
SetStatusHidden

Hides or shows one status icon on a player's HUD.

Export ​

lua
exports.fwb_hud:SetStatusHidden(src, id, hidden)
ParameterTypeDescription
srcnumberPlayer server id
idstringStatus id
hiddenbooleantrue to hide, false to show

Example ​

lua
exports.fwb_hud:SetStatusHidden(source, 'armor', true)

HUD ​

SetHudVisible

Shows or hides a player's HUD.

Export ​

lua
exports.fwb_hud:SetHudVisible(src, visible)
ParameterTypeDescription
srcnumberPlayer server id
visiblebooleantrue to show, false to hide

Example ​

lua
-- hide the HUD during a server cutscene
exports.fwb_hud:SetHudVisible(source, false)
OpenSettings

Opens the HUD menu for a player.

Export ​

lua
exports.fwb_hud:OpenSettings(src)

Example ​

lua
exports.fwb_hud:OpenSettings(source)
ApplyPreset

Applies a theme preset to a player's HUD. Preset ids are in bridge/defaults/themes.lua.

Export ​

lua
exports.fwb_hud:ApplyPreset(src, presetId)
ParameterTypeDescription
srcnumberPlayer server id
presetIdstringe.g. 'linea_clean', 'dash_race'

Example ​

lua
-- give racers the motorsport look
exports.fwb_hud:ApplyPreset(source, 'dash_race')
ResetHud

Clears a player's own HUD changes so they get the server look again.

Export ​

lua
exports.fwb_hud:ResetHud(src)

Example ​

lua
exports.fwb_hud:ResetHud(source)
IsAdmin

Returns whether a player has the fwb_hud.admin ACE.

Export ​

lua
exports.fwb_hud:IsAdmin(src)

Returns ​

  • boolean

Example ​

lua
if exports.fwb_hud:IsAdmin(source) then
    print('Player is a HUD admin')
end

Server Events (from client scripts) ​

EventArgumentsWhat it does
fwb_hud:server:addStressamountAdd stress to the calling player.
fwb_hud:server:relieveStressamountRemove stress from the calling player.
lua
TriggerServerEvent('fwb_hud:server:addStress', 5)

QBCore / Qbox hud:server:GainStress and hud:server:RelieveStress keep working.

FWB Studio documentation.