π§ Configuration
[!NOTE] Don't touch this line
Config, Keys, Noti = {}, {}, {}
Framework Configuration
-- Use "esx" or "qb"
Config.Framework = "esx"
-- Default ESX: "esx:getSharedObject" | Default QB: "qb-core"
Config.Core = "esx:getSharedObject"
Refresh Times
-- 10 seconds. Increase if necessary for resource-poor servers
Config.refreshtime = 10000
-- If you want the script to take a few seconds to start (so as not to show the hud on the loading screen)
Config.scriptTimeout = 5000
-- 2 seconds. Increase if necessary for resource-poor servers
Config.refreshstreets = 2000
-- 0.5 seconds. Increase if necessary for resource-poor servers
Config.refreshhud = 400
HUD Customization
-- If you want to enable/disable car hud
Config.carhudactive = true
-- If you want to see the stats (life, armor, hunger...) as a square or a round one
Config.statsrounded = true
-- Name to be displayed at the top of the HUD
Config.servername = "SERVERNAME"
-- Logo of your server
Config.logo = "./img/logo.png"
-- If you set it to false it will be displayed in MPH
Config.KMH = true
-- If you want to enable/disable the time to be displayed
Config.showtime = true
-- If you want to enable/disable the display of addresses
Config.showstreets = true
-- Show life, armor, thirst and hunger.
Config.showStatus = true
-- Activate only to view errors
Config.devMode = false
Vehicle Controls
-- Seat belt key. Default: G // Change to the one assigned on your server
Config.BeltKey = 183
-- Motor on/off key. Default: L // Change to the one assigned on your server
Config.EngineKey = 182
Keybinds Panel
Keys.active = false -- Show keybinds side panel
Keys.key1 = "M"
Keys.key1desc = "Mobile"
Keys.key2 = "X"
Keys.key2desc = "Hands Up"
Keys.key3 = "F2"
Keys.key3desc = "Inventory"
Keys.key4 = "L"
Keys.key4desc = "Lock Car"
Keys.key5 = "G"
Keys.key5desc = "Seat Belt"
Notification Settings
Noti.time = 5000 -- 5 seconds // How long the notification will be displayed
Notification Info
Notifications can be used through the following trigger:
TriggerEvent('bit-hud:noti', PlayerID, "Title", "Message", "info")
[!NOTE]
- The title of the message cannot exceed 18 characters
- The message cannot exceed 152 characters
- Type of alerts available:
info,warning,success,error
Safe Zones
Configure areas where the HUD will be hidden:
-- If you do not want to use safe zones delete all the following coordinates
-- You can add as many as you wish
safezones = {
{x = -251.21, y = -980.46, z = 31.22}, -- Employment office
{x = 223.55, y = -1394.69, z = 31.22}, -- Driving school
{x = -35.47, y = -1100.37, z = 26.46}, -- Car dealership
{x = 299.04, y = -583.9, z = 43.26}, -- Central Hospital
{x = 1814.53, y = 3678.62, z = 34.28}, -- Sandy Hospital
}
distance = 60.0
Functions
Get Online Users
function getOnlineUsers()
if Config.Framework == "esx" then
local users = ESX.Game.GetPlayers()
usersamount = 0
for _, playerId in ipairs(users) do
users = usersamount + 1
end
return users
elseif Config.Framework == "qb" then
local users = QBCore.Functions.GetPlayers()
usersamount = 0
for _, playerId in ipairs(users) do
users = usersamount + 1
end
return users
end
end
Get Player Money
function getPlayerMoney()
if Config.Framework == "esx" then
money = ESX.GetPlayerData().money
return money
elseif Config.Framework == "qb" then
money = QBCore.Functions.GetPlayerData().money["cash"]
return money
end
end
Get Player Health
function getPlayerHealth(ped)
health = GetEntityHealth(ped) - 100
return health
end
Get Player Armour
function getPlayerArmour(ped)
armour = GetPedArmour(ped)
return armour
end
Get Hunger and Thirst
function GetStatus(cb)
if Config.Framework == "esx" then
TriggerEvent("esx_status:getStatus", "hunger", function(h)
TriggerEvent("esx_status:getStatus", "thirst", function(t)
local hunger = h.getPercent()
local thirst = t.getPercent()
local stress = 0
cb({hunger, thirst, stress})
end)
end)
elseif Config.Framework == "qb" then
local hunger = QBCore.Functions.GetPlayerData().metadata["hunger"]
local thirst = QBCore.Functions.GetPlayerData().metadata['thirst']
local stress = QBCore.Functions.GetPlayerData().metadata['stress']
cb({hunger, thirst, stress})
end
end