Needs add system
Custom Needs System Integration Guide
This guide explains how to integrate your own needs system (hunger/thirst) with PHUD.
📋 Table of Contents
How It Works
Method 1: Using Event Handlers
Method 2: Using Polling Loop
Available Exports
Real Examples
Configuration
Troubleshooting
How It Works
PHUD needs to receive hunger and thirst values (0-100 scale) from your needs system:
0 = empty/dead
100 = full/satisfied
The HUD will automatically update when values change.
Method 1: Using Event Handlers (Recommended)
This method listens to events triggered by your needs system.
Step 1: Create Your Integration File
Create a new file in this folder: your-system-name.lua
Step 2: Use This Template
Real Example: ESX Status
Method 2: Using Polling Loop
This method actively checks your needs system at regular intervals.
Template
Real Example: QB-Core HUD
Available Exports
Use these functions in your integration file:
Update Functions
Get Functions
Force Set Functions
Real Examples
ESX Basic Needs
OkOk Needs
Renewed Library
Configuration
Step 1: Create Your Integration File
Create a new .lua file in the phud/editable/needs/ folder.
Example:
Create the file:
phud/editable/needs/custom.luaIn config.lua:
Config.NeedsSystem = "custom"
Important: The filename (without .lua) must EXACTLY match the value you set in Config.NeedsSystem.
Step 2: Enable Your System in Config
Open phud/config.lua and set:
Available systems:
esx_status- ESX Status (default version)esx_basicneeds- ESX Basic Needsqb-hud- QB-Core HUDokokNeeds- OkOk Needsrenewed-lib- Renewed LibraryMetabolic- Metabolic systemOr your custom filename
Step 3: Restart Resource
Troubleshooting
HUD Not Updating
Check if your file is loaded
Make sure the filename matches
Config.NeedsSystemFile should be in
phud/editable/needs/folder
Check console for errors
Look for Lua errors in F8 console
Check server console for warnings
Verify data format
Hunger/thirst should be numbers between 0-100
Use
print()to debug values
Check events are triggering
Values Not Correct
Check if you need to convert values (e.g., from 0-1000000 to 0-100)
Ensure you're using
math.floor()to convert to integersVerify your needs system is actually running
Auto-Detection Not Working
Set specific system name instead of "auto"
Check if your needs resource is started before PHUD
Ensure your needs system resource name matches
Need Help?
If your needs system is not listed here:
Find out what events your system triggers
Or find out what exports your system provides
Use one of the methods above to integrate it
Check your system's documentation for available functions
Common event patterns:
system_name:onTicksystem_name:updatesystem_name:onChange
Common export patterns:
exports['system_name']:GetHunger()exports['system_name']:GetNeeds()
Last updated

