Exports & Hooks
Use your folder name instead of kartik-hud if you renamed the resource.
Need names are hunger, thirst, stress, cleanliness, fatigue, alcohol, drug and sickness, all from 0 to 100.
🖥️ Client exports
exports['kartik-hud']:ShowHud(state) -- false hides the HUD, true shows it
exports['kartik-hud']:IsHudVisible()
exports['kartik-hud']:OpenSettings()
exports['kartik-hud']:SetPhotoMode(state)
exports['kartik-hud']:GetNeed(name)
exports['kartik-hud']:GetNeeds() -- table of every need
exports['kartik-hud']:SetNeed(name, value)
exports['kartik-hud']:AddNeed(name, amount) -- negative to take away
exports['kartik-hud']:SetNeeds({ hunger = 100, thirst = 100 })
exports['kartik-hud']:ResetNeeds()
exports['kartik-hud']:Consume(item, metadata) -- plays and applies a consumable, true when finished
exports['kartik-hud']:IsConsuming()
exports['kartik-hud']:AddEffect(id, { label = 'Blessed', icon = 'sparkles', kind = 'buff', duration = 300 })
exports['kartik-hud']:RemoveEffect(id)
exports['kartik-hud']:HasEffect(id)
exports['kartik-hud']:AddWarmth(amount, seconds)
exports['kartik-hud']:GetTemperature() -- air, feels, status ('ok', 'cold', 'hot') and wet
exports['kartik-hud']:RegisterWidget(widget)
exports['kartik-hud']:SetWidget(id, value, text)
exports['kartik-hud']:RemoveWidget(id)
exports['kartik-hud']:ShowTitle('Fort Wallace', 'New Hanover')
exports['kartik-hud']:Progress('Lighting the lantern', 3000)kind is buff (green) or debuff (red). Leave duration out for an effect that stays until you remove it.
🗄️ Server exports
exports['kartik-hud']:SetNeed(source, name, value)
exports['kartik-hud']:AddNeed(source, name, amount)
exports['kartik-hud']:GetNeeds(source) -- last values the player sent, or nil
exports['kartik-hud']:ResetNeeds(source)
exports['kartik-hud']:Consume(source, item, metadata)
exports['kartik-hud']:AddEffect(source, id, data)
exports['kartik-hud']:RemoveEffect(source, id)
exports['kartik-hud']:SetWidget(source, id, value, text)📝 Examples
A bath script cleaning the player:
exports['kartik-hud']:SetNeed('cleanliness', 100)A bed script letting players rest:
exports['kartik-hud']:SetNeed('fatigue', 0)A doctor curing a patient from the server:
exports['kartik-hud']:SetNeed(target, 'sickness', 0)
exports['kartik-hud']:AddEffect(target, 'treated', { label = 'Treated', icon = 'pill', kind = 'buff', duration = 600 })🪝 Hooks
These files are yours to edit. Keep a copy of them when you update the resource.
bridge/custom/client/hooks.lua
| Function | What it's for |
|---|---|
CanShowHud() | Return false to hide the HUD, for example in your own menus |
Notify(message, kind) | Return true after showing the message with your own notify script |
GetHorseName(horse) | Return the horse's name. Reads the horseName state bag by default |
GetWeather() | Return a weather name if your weather script knows better than the game |
GetAirTemperature(coords) | Return a temperature in °C to override the game's |
OnNeedEmpty(name) | Runs while hunger or thirst is at 0 |
OnConsumed(item, data) | After a consumable is finished |
OnPassOut() | When a player drinks until they pass out |
bridge/custom/server/hooks.lua
| Function | What it's for |
|---|---|
CanUseItem(source, item, metadata) | Return false to block a consumable |
OnItemUsed(source, item, metadata) | After a consumable is finished and the item removed |