For the complete documentation index, see llms.txt. This page is also available as Markdown.

Needs add system

Our HUD is already compatible with several needs systems: esx_basicneeds, esx_status, okokNeeds, qb-hud, and renewed-lib.

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.


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.lua

  • In 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 Needs

  • qb-hud - QB-Core HUD

  • okokNeeds - OkOk Needs

  • renewed-lib - Renewed Library

  • Metabolic - Metabolic system

  • Or your custom filename

Step 3: Restart Resource


Troubleshooting

HUD Not Updating

  1. Check if your file is loaded

    • Make sure the filename matches Config.NeedsSystem

    • File should be in phud/editable/needs/ folder

  2. Check console for errors

    • Look for Lua errors in F8 console

    • Check server console for warnings

  3. Verify data format

    • Hunger/thirst should be numbers between 0-100

    • Use print() to debug values

  4. 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 integers

  • Verify 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:

  1. Find out what events your system triggers

  2. Or find out what exports your system provides

  3. Use one of the methods above to integrate it

  4. Check your system's documentation for available functions

Common event patterns:

  • system_name:onTick

  • system_name:update

  • system_name:onChange

Common export patterns:

  • exports['system_name']:GetHunger()

  • exports['system_name']:GetNeeds()

Last updated