SLEEK HUD
Here check the installation guide
Last updated
Here check the installation guide
Last updated
INSTALLATION GUIDE
Download from KEYMASTER and Unzip the forge-hud.pack.zip
and place this folder in your server's resource folder.
Add the resource to your server start config: ensure forge-hud
,the name of the folder must not be changed or the resource will not function correctly.
Delete any other HUD you have. Like the QB or ESX HUD. You must delete them. Only Forge's can remain.
Clear the cache of your server and also of your own FiveM.
Reboot the entire server with the forge script well ensured in your server.cfg.
This script does not have any SQL to install.
Do not rename this script, this may cause it to fail when opening the interface.
IMPORTANT REMEMBER: The HUD cannot be ENSURED within the server (ensure forge-hud
cannot be used in F8 or in your chat), as many things will fail.
The HUD can only be reset with a FULL RESET of the server.
CONFIG
The following will explain all the settings, one of the most important things that I recommend you spend a few minutes to understand in order to offer your users the best possible experience.
Fill all the CONFIG very carefully. You can hide and modify many parts of the HUD from here. Look at it very carefully, everything is explained with comments.
Config = Config or {}
-- _____ _____ _ _ ______ _____ _____ _ _______ ___ _____ _____ _____ _ _
-- / __ \ _ | \ | || ___|_ _| __ \ | | | ___ \/ _ \_ _|_ _| _ | \ | |
-- | / \/ | | | \| || |_ | | | | \/ | | | |_/ / /_\ \| | | | | | | | \| |
-- | | | | | | . ` || _| | | | | __| | | | /| _ || | | | | | | | . ` |
-- | \__/\ \_/ / |\ || | _| |_| |_\ \ |_| | |\ \| | | || | _| |_\ \_/ / |\ |
-- \____/\___/\_| \_/\_| \___/ \____/\___/\_| \_\_| |_/\_/ \___/ \___/\_| \_/
--WARNING!: The HUD cannot be ensured with the server open, it has to be done with a full server restart, or else some things will not work like the location marker or the connected people marker.
Config.Debug = false -- Use it for debug
Config.Framework = "qb" -- Use "esx" or "qb" - If you use a different framework or a renamed esx/qb in the config_framework you can modify all the functions
Config.Delay = 100 -- Delay in milliseconds for script operations. Higher values reduce consumption but may cause delays. Recommended range: 100-200ms for optimal performance.
Config.ShowTotalPlayers = true -- If you set false, the grid showing how many players are online will disappear.
Config.MaxPlayers = GetConvarInt('sv_maxclients', 32) -- Use it for get max players
Config.KeyChangeCyclePromixity = GetConvar('voice_defaultCycle', 'F11') -- Key for the cycle proximity for pma-voice
Config.UseStaticID = false -- Owners that want to use static id should add their export in config_framework > MAV.Functions.GetStaticId
Config.UseKeyOpen = true -- Set if the hud config can be open with Config.OpenMenu
Config.OpenMenu = 'I' -- See the list : https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/
Config.UseWeaponSystem = true -- If shet to true show the weapon you are using and its bullets. This causes the HUD to increase its consumption when activated, this is normal
Config.UseWeaponImages = true -- If true it will display a PNG image of the weapon along with the bullets, if false it will display just the bullets with nothing else
Config.UseRadarMiniMap = true -- If it is true the minimap will appear and if it is false it will not appear at all
Config.ShowRadarOnlyInVehicle = true -- Show the player radar only if the player is in a car
Config.UseAddressMarker = true -- If it is true the address marker will appear on the screen and if it is false it will not appear at all
Config.UseMPH = false -- Use mp/h with "true" and km/h with "false"
Config.UseLowFuel = true -- If set to true the fuel level is checked
Config.ShowMoneyInHud = true -- Show the cash and bank on the hud
Config.ExtraMoney = { -- Activate it if you want a third money rectangle, for example if you want to show black money, cryptos or anything. You must go to the config_framework to modify the function to your liking.
Active = false,
Image = 'wallet.svg' -- The icon to be seen. You will have to add it in the nui > images folder and put the name of the file.
}
Config.ShowGang = true -- ONLY if you use QB - It will show in the HUD the gang and the rank of your character
Config.CustomStress = false -- If you set it to TRUE it will use system stress from esx_status or whatever you put in config_framework.lua
Config.UseStress = true -- Use stress. An internal system created from scratch and optimized
Config.StressChance = 0.1 -- Default: 10% β’ Percentage stress chance when shooting (0-1)
Config.MinimumStress = 50 -- Minimum stress level for screen shaking
Config.MinimumFuel = 20 -- Under this % of fuel, the player is notify (Config.Notification.FuelIsLow = true) and with sound (Config.Sounds['FUEL'])
Config.MinimumSpeed = 100 -- Going over this speed will cause stress
Config.MinimumSpeedUnbuckled = 80 -- Going over this Speed without seatbelt will cause stress
Config.DisableStressJobs = true -- If true will disable stress for people with the job you choose below
Config.StressWhitelistJobs = { 'police', 'ambulance' } -- You can add all the jobs you want that do not add stress
Config.UseSeatBelt = true -- Seat belt system
Config.UseKeyToggleseatbelt = true -- Set if the seatbelt can be toggled by Config.ToggleSeatbelt
Config.ToggleSeatbelt = 'B' -- See the list : https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/
Config.EjectSpeed = 45.0 -- Minimum speed at which a player can be ejected from a vehicle
Config.EjectAccel = 100.0 -- Minimum acceleration for ejection
Config.Notification = {
HudIsLoaded = true, -- Show notification when the hud settings is loaded.
MapIsLoaded = true, -- Show notification when the map is loaded.
FuelIsLow = true, -- Show notification when the fuel is low.
GainStress = true, -- Show notification when player gain stress
Seatblet = true, -- Shows notification when the player puts on or removes the car seat belt.
CashChange = true, -- Show notification when there is a cash transaction.
BankChange = true, -- Show notification when there is a bank account change.
LowHealth = true, -- Show notification when player's health is low.
LowThirst = true, -- Show notification when player's thirst is low.
LowHunger = true, -- Show notification when player's hunger is low.
}
Config.Settings = {
ShowJob = true, -- If set to false, hide the job grid
ShowHealth = true, -- Show health bar on HUD
ShowHunger = true, -- Show hunger indicator on HUD
ShowThirst = true, -- Show thirst indicator on HUD
ShowArmor = true, -- Show armor indicator on HUD
ShowOxygen = true, -- Show oxygen level when underwater
ShowMicroVolume = true, -- Show microphone volume indicator
ShowSpeedometer = true -- Show speedometer on HUD
}
Config.Commands = {
Cinematic = 'cinematic', -- Command to start/stop cinematic mode
NoHud = 'nohud', -- Command to show / hide the HUD
ResetHUD = 'resethud', -- Command name to reset the configuration
Announce = 'announce', -- Command name to launch a announcement
OpenHUD = 'menu', -- Command name to open the hud configuration
ZoneTP = 'zone', -- Command to test zone (only available with : Config.Debug = true)
ToggleSeatbelt = 'toggleseatbelt', -- Command name to toggle seatbelt
}
Config.Sounds = { -- See the list : https://pastebin.com/DCeRiaLJ
['BUCKLE'] = {
Enabled = true,
AudioName = 'Beep_Red',
AudioRef = 'DLC_HEIST_HACKING_SNAKE_SOUNDS',
},
['UNBUCKLE'] = {
Enabled = true,
AudioName = 'Beep_Red',
AudioRef = 'DLC_HEIST_HACKING_SNAKE_SOUNDS',
},
['FUEL'] = {
Enabled = true,
AudioName = 'Beep_Red',
AudioRef = 'DLC_HEIST_HACKING_SNAKE_SOUNDS',
},
['ANNOUNCE'] = {
Enabled = true,
AudioName = 'CHARACTER_SELECT',
AudioRef = 'HUD_FRONTEND_DEFAULT_SOUNDSET',
},
}
Config.Zones = { -- The Safe Zone and Red Zone system will warn you with a sign on the HUD that you are in the Safe Zone and Red Zone. You can add as many as you want
['RED'] = {
{
coords = vector3(-1852.42, -778.63, 6.75), -- The co-ordinate of the centre of the zone where you want it to be red zone/hot zone.
radius = 5.0, -- This is the radius, the larger the number, the larger the area.
},
-- {
-- coords = vector3(-1852.42, -778.63, 6.75), -- The co-ordinate of the centre of the zone where you want it to be red zone/hot zone.
-- radius = 5.0, -- This is the radius, the larger the number, the larger the area.
-- },
},
['SAFE'] = {
{
coords = vector3(-1871.06, -724.59, 8.3),
radius = 5.0,
},
-- {
-- coords = vector3(-1871.06, -724.59, 8.3),
-- radius = 5.0,
-- },
}
}
Config.Menu = { -- Default HUD display mode for players (options: normal, reduced, minimal)
isNormal = true,
isReduced = false,
isMinimal = false,
size = 1, -- Default size for HUD elements
color = "#31afd4" -- Default color for HUD elements
}
Config.Jobs = { -- Here you have to add all the jobs that will appear in your HUD. This ensures that it appears the way you want it to appear, and it also reduces the HUD consumption by half.
['unemployed'] = { [0] = 'Freelancer' },
['police'] = { [0] = 'Recruit', [1] = 'Officer', [2] = 'Sergeant', [3] = 'Lieutenant', [4] = 'Chief' },
['ambulance'] = { [0] = 'Recruit', [1] = 'Paramedic', [2] = 'Doctor', [3] = 'Surgeon', [4] = 'Chief' },
['realestate'] = { [0] = 'Recruit', [1] = 'House Sales', [2] = 'Business Sales', [3] = 'Broker', [4] = 'Manager' },
['taxi'] = { [0] = 'Recruit', [1] = 'Driver', [2] = 'Event Driver', [3] = 'Sales', [4] = 'Manager' },
['bus'] = { [0] = 'Driver' },
['cardealer'] = { [0] = 'Recruit', [1] = 'Showroom Sales', [2] = 'Business Sales', [3] = 'Finance', [4] = 'Manager' },
['mechanic'] = { [0] = 'Recruit', [1] = 'Novice', [2] = 'Experienced', [3] = 'Advanced', [4] = 'Manager' },
['judge'] = { [0] = 'Judge' },
['lawyer'] = { [0] = 'Associate' },
['reporter'] = { [0] = 'Journalist' },
['trucker'] = { [0] = 'Driver' },
['tow'] = { [0] = 'Driver' },
['garbage'] = { [0] = 'Collector' },
['vineyard'] = { [0] = 'Picker' },
['hotdog'] = { [0] = 'Sales' },
['firefighter'] = { [0] = 'Recruit', [1] = 'Fire fighter', [2] = 'Lieutenant', [3] = 'Captain', [4] = 'Boss' }
}
Config.WhitelistedWeaponStress = { `weapon_petrolcan`, `weapon_hazardcan`, `weapon_fireextinguisher` } -- List of weapons that do not cause stress when used
Config.EffectInterval = { -- If you activate the use of Stress, there will be a blur effect whenever your character is stressed.
[1] = { min = 50, max = 60, timeout = math.random(50000, 60000) },
[2] = { min = 60, max = 70, timeout = math.random(40000, 50000) },
[3] = { min = 70, max = 80, timeout = math.random(30000, 40000) },
[4] = { min = 80, max = 90, timeout = math.random(20000, 30000) },
[5] = { min = 90, max = 100, timeout = math.random(15000, 20000) }
}
Config.Intensity = { -- Configures the intensity of stress effects based on stress level
["BLUR"] = {
[1] = { min = 50, max = 60, intensity = 1500 },
[2] = { min = 60, max = 70, intensity = 2000 },
[3] = { min = 70, max = 80, intensity = 2500 },
[4] = { min = 80, max = 90, intensity = 2700 },
[5] = { min = 90, max = 100, intensity = 3000 },
}
}
Config.Cruise = {
Active = true, -- Toggle the cruise control feature
Keybind = 'U', -- Keybind to toggle cruise control
Command = 'cruise' -- Command to toggle cruise control
}
Config.Weapons = { -- These are the images of the weapons, if there are weapons you don't like, you can change them inside the NUI images folder.
[GetHashKey('WEAPON_UNARMED')] = { 'WEAPON_UNARMED' },
[GetHashKey('WEAPON_KNIFE')] = { 'WEAPON_KNIFE' },
[GetHashKey('WEAPON_NIGHTSTICK')] = { 'WEAPON_NIGHTSTICK' },
[GetHashKey('WEAPON_HAMMER')] = { 'WEAPON_HAMMER' },
[GetHashKey('WEAPON_BAT')] = { 'WEAPON_BAT' },
[GetHashKey('WEAPON_GOLFCLUB')] = { 'WEAPON_GOLFCLUB' },
[GetHashKey('WEAPON_CROWBAR')] = { 'WEAPON_CROWBAR' },
[GetHashKey('WEAPON_PISTOL')] = { 'WEAPON_PISTOL' },
[GetHashKey('WEAPON_COMBATPISTOL')] = { 'WEAPON_COMBATPISTOL' },
[GetHashKey('WEAPON_APPISTOL')] = { 'WEAPON_APPISTOL' },
[GetHashKey('WEAPON_PISTOL50')] = { 'WEAPON_PISTOL50' },
[GetHashKey('WEAPON_MICROSMG')] = { 'WEAPON_MICROSMG' },
[GetHashKey('WEAPON_SMG')] = { 'WEAPON_SMG' },
[GetHashKey('WEAPON_ASSAULTSMG')] = { 'WEAPON_ASSAULTSMG' },
[GetHashKey('WEAPON_ASSAULTRIFLE')] = { 'WEAPON_ASSAULTRIFLE' },
[GetHashKey('WEAPON_CARBINERIFLE')] = { 'WEAPON_CARBINERIFLE' },
[GetHashKey('WEAPON_ADVANCEDRIFLE')] = { 'WEAPON_ADVANCEDRIFLE' },
[GetHashKey('WEAPON_MG')] = { 'WEAPON_MG' },
[GetHashKey('WEAPON_COMBATMG')] = { 'WEAPON_COMBATMG' },
[GetHashKey('WEAPON_PUMPSHOTGUN')] = { 'WEAPON_PUMPSHOTGUN' },
[GetHashKey('WEAPON_SAWNOFFSHOTGUN')] = { 'WEAPON_SAWNOFFSHOTGUN' },
[GetHashKey('WEAPON_ASSAULTSHOTGUN')] = { 'WEAPON_ASSAULTSHOTGUN' },
[GetHashKey('WEAPON_BULLPUPSHOTGUN')] = { 'WEAPON_BULLPUPSHOTGUN' },
[GetHashKey('WEAPON_STUNGUN')] = { 'WEAPON_STUNGUN' },
[GetHashKey('WEAPON_SNIPERRIFLE')] = { 'WEAPON_SNIPERRIFLE' },
[GetHashKey('WEAPON_HEAVYSNIPER')] = { 'WEAPON_HEAVYSNIPER' },
[GetHashKey('WEAPON_GRENADELAUNCHER')] = { 'WEAPON_GRENADELAUNCHER' },
[GetHashKey('WEAPON_GRENADELAUNCHER_SMOKE')] = { 'WEAPON_GRENADELAUNCHER_SMOKE' },
[GetHashKey('WEAPON_RPG')] = { 'WEAPON_RPG' },
[GetHashKey('WEAPON_MINIGUN')] = { 'WEAPON_MINIGUN' },
[GetHashKey('WEAPON_GRENADE')] = { 'WEAPON_GRENADE' },
[GetHashKey('WEAPON_STICKYBOMB')] = { 'WEAPON_STICKYBOMB' },
[GetHashKey('WEAPON_SMOKEGRENADE')] = { 'WEAPON_SMOKEGRENADE' },
[GetHashKey('WEAPON_BZGAS')] = { 'WEAPON_BZGAS' },
[GetHashKey('WEAPON_MOLOTOV')] = { 'WEAPON_MOLOTOV' },
[GetHashKey('WEAPON_FIREEXTINGUISHER')] = { 'WEAPON_FIREEXTINGUISHER' },
[GetHashKey('WEAPON_PETROLCAN')] = { 'WEAPON_PETROLCAN' },
[GetHashKey('WEAPON_FLARE')] = { 'WEAPON_FLARE' },
[GetHashKey('WEAPON_SNSPISTOL')] = { 'WEAPON_SNSPISTOL' },
[GetHashKey('WEAPON_SPECIALCARBINE')] = { 'WEAPON_SPECIALCARBINE' },
[GetHashKey('WEAPON_HEAVYPISTOL')] = { 'WEAPON_HEAVYPISTOL' },
[GetHashKey('WEAPON_BULLPUPRIFLE')] = { 'WEAPON_BULLPUPRIFLE' },
[GetHashKey('WEAPON_HOMINGLAUNCHER')] = { 'WEAPON_HOMINGLAUNCHER' },
[GetHashKey('WEAPON_PROXMINE')] = { 'WEAPON_PROXMINE' },
[GetHashKey('WEAPON_SNOWBALL')] = { 'WEAPON_SNOWBALL' },
[GetHashKey('WEAPON_VINTAGEPISTOL')] = { 'WEAPON_VINTAGEPISTOL' },
[GetHashKey('WEAPON_DAGGER')] = { 'WEAPON_DAGGER' },
[GetHashKey('WEAPON_FIREWORK')] = { 'WEAPON_FIREWORK' },
[GetHashKey('WEAPON_MUSKET')] = { 'WEAPON_MUSKET' },
[GetHashKey('WEAPON_MARKSMANRIFLE')] = { 'WEAPON_MARKSMANRIFLE' },
[GetHashKey('WEAPON_HEAVYSHOTGUN')] = { 'WEAPON_HEAVYSHOTGUN' },
[GetHashKey('WEAPON_GUSENBERG')] = { 'WEAPON_GUSENBERG' },
[GetHashKey('WEAPON_HATCHET')] = { 'WEAPON_HATCHET' },
[GetHashKey('WEAPON_RAILGUN')] = { 'WEAPON_RAILGUN' },
[GetHashKey('WEAPON_COMBATPDW')] = { 'WEAPON_COMBATPDW' },
[GetHashKey('WEAPON_KNUCKLE')] = { 'WEAPON_KNUCKLE' },
[GetHashKey('WEAPON_MARKSMANPISTOL')] = { 'WEAPON_MARKSMANPISTOL' },
[GetHashKey('WEAPON_FLASHLIGHT')] = { 'WEAPON_FLASHLIGHT' },
[GetHashKey('WEAPON_MACHETE')] = { 'WEAPON_MACHETE' },
[GetHashKey('WEAPON_MACHINEPISTOL')] = { 'WEAPON_MACHINEPISTOL' },
[GetHashKey('WEAPON_SWITCHBLADE')] = { 'WEAPON_SWITCHBLADE' },
[GetHashKey('WEAPON_REVOLVER')] = { 'WEAPON_REVOLVER' },
[GetHashKey('WEAPON_COMPACTRIFLE')] = { 'WEAPON_COMPACTRIFLE' },
[GetHashKey('WEAPON_DBSHOTGUN')] = { 'WEAPON_DBSHOTGUN' },
[GetHashKey('WEAPON_FLAREGUN')] = { 'WEAPON_FLAREGUN' },
[GetHashKey('WEAPON_AUTOSHOTGUN')] = { 'WEAPON_AUTOSHOTGUN' },
[GetHashKey('WEAPON_BATTLEAXE')] = { 'WEAPON_BATTLEAXE' },
[GetHashKey('WEAPON_COMPACTLAUNCHER')] = { 'WEAPON_COMPACTLAUNCHER' },
[GetHashKey('WEAPON_MINISMG')] = { 'WEAPON_MINISMG' },
[GetHashKey('WEAPON_PIPEBOMB')] = { 'WEAPON_PIPEBOMB' },
[GetHashKey('WEAPON_POOLCUE')] = { 'WEAPON_POOLCUE' },
[GetHashKey('WEAPON_SWEEPER')] = { 'WEAPON_SWEEPER' },
[GetHashKey('WEAPON_WRENCH')] = { 'WEAPON_WRENCH' },
[GetHashKey('WEAPON_PISTOL_MK2')] = { 'WEAPON_PISTOL_MK2' },
[GetHashKey('WEAPON_SNSPISTOL_MK2')] = { 'WEAPON_SNSPISTOL_MK2' },
[GetHashKey('WEAPON_REVOLVER_MK2')] = { 'WEAPON_REVOLVER_MK2' },
[GetHashKey('WEAPON_SMG_MK2')] = { 'WEAPON_SMG_MK2' },
[GetHashKey('WEAPON_PUMPSHOTGUN_MK2')] = { 'WEAPON_PUMPSHOTGUN_MK2' },
[GetHashKey('WEAPON_ASSAULTRIFLE_MK2')] = { 'WEAPON_ASSAULTRIFLE_MK2' },
[GetHashKey('WEAPON_CARBINERIFLE_MK2')] = { 'WEAPON_CARBINERIFLE_MK2' },
[GetHashKey('WEAPON_SPECIALCARBINE_MK2')] = { 'WEAPON_SPECIALCARBINE_MK2' },
[GetHashKey('WEAPON_BULLPUPRIFLE_MK2')] = { 'WEAPON_BULLPUPRIFLE_MK2' },
[GetHashKey('WEAPON_COMBATMG_MK2')] = { 'WEAPON_COMBATMG_MK2' },
[GetHashKey('WEAPON_HEAVYSNIPER_MK2')] = { 'WEAPON_HEAVYSNIPER_MK2' },
[GetHashKey('WEAPON_MARKSMANRIFLE_MK2')] = { 'WEAPON_MARKSMANRIFLE_MK2' }
}
This SCRIPT is STANDALONE, you will have to configure the functions here.
If you use ESX or QB you can also modify functions here. The most typical are, for example, if you use a Gasoline system other than the default one. You can modify EVERYTHING to fit your server perfectly.
To modify or add functions you must have a minimum of knowledge. Don't touch anything without knowing.
MAV = MAV or {}
Core = Core or nil
-- Here you can modify all the functions that the HUD uses, in case you use a different ESX or QB or even another framework.
MAV.Debug = function(...)
if not Config.Debug then return end
print(('^4[' .. GetCurrentResourceName() .. ']^7 # %s'):format(...))
end
if GetResourceState('es_extended') == 'started' then
Core = exports['es_extended']:getSharedObject()
MAV.Debug('framework - esx')
end
if GetResourceState('qb-core') == 'started' then
Core = exports['qb-core']:GetCoreObject()
MAV.Debug('framework - qbcore')
end
-- ? Events
MAV.Events = MAV.Events or {}
MAV.Events.OnPlayerLoaded = function ()
local events = {
['qb'] = 'QBCore:Client:OnPlayerLoaded',
['esx'] = 'esx:playerLoaded'
}
return events[Config.Framework]
end
MAV.Events.OnPlayerUnload = function()
local events = {
['qb'] = 'QBCore:Client:OnPlayerUnload',
['esx'] = 'esx:onPlayerLogout'
}
return events[Config.Framework]
end
MAV.Events.OnJobUpdate = function()
local events = {
['qb'] = 'QBCore:Client:OnJobUpdate',
['esx'] = 'esx:setJob'
}
return events[Config.Framework]
end
--[[MAV.Events.OnUpdateNeeds = function()
return 'forge-hud:ManualUpdateNeeds'
end--]]
MAV.Events.OnUpdateNeeds = function()
local events = {
['qb'] = 'hud:client:UpdateNeeds',
['esx'] = 'esx_status:onTick'
}
return events[Config.Framework]
end
MAV.Events.OnMoneyChange = function()
local events = {
['qb'] = 'hud:client:OnMoneyChange',
['esx'] = 'esx:setAccountMoney'
}
return events[Config.Framework]
end
-- ? Functions
MAV.Functions = MAV.Functions or {}
-- Get the notification
-- @return void
MAV.Functions.Notify = function(message, type)
if Config.Framework == 'qb' then
Core.Functions.Notify(message, type)
end
if Config.Framework == 'esx' then
Core.ShowNotification(message, type, 3000)
end
end
-- Get the current fuel of the vehicle
-- @param vehicle
-- @return number
MAV.Functions.GetFuel = function(vehicle)
if vehicle == 0 then return 0 end
if Config.Framework == 'qb' then
return GetVehicleFuelLevel(vehicle)
end
if Config.Framework == 'esx' then
return GetVehicleFuelLevel(vehicle)
end
end
-- Get the current job of the player
-- @param job
-- @return table
MAV.Functions.GetJob = function(job)
if Config.Framework == 'qb' then
return {
name = job.name,
level = Config.Jobs[job.name][job.grade.level]
}
end
if Config.Framework == 'esx' then
return {
name = job.name,
level = job.grade_name
}
end
end
-- Get the current player data
-- @return object
MAV.Functions.GetPlayerData = function()
if Config.Framework == 'qb' then
return Core.Functions.GetPlayerData()
end
if Config.Framework == 'esx' then
return Core.GetPlayerData()
end
end
-- If you set Config.ShowGang = true it will show your gang through this function
MAV.Functions.GetGang = function()
if Config.Framework == 'qb' then
local data = MAV.Functions.GetPlayerData()
if Config.ShowGang then
return {
name = data.gang.label,
level = data.gang.grade.name
}
else
return {
name = false,
level = false
}
end
end
if Config.Framework == 'esx' then
return {
name = false,
level = false
}
end
end
-- Get account money of the current player
-- @return table
MAV.Functions.GetAccount = function()
if Config.Framework == 'qb' then
local data = MAV.Functions.GetPlayerData()
return {
wallet = data.money['cash'],
bank = data.money['bank']
}
end
if Config.Framework == 'esx' then
local data = MAV.Functions.GetPlayerData()
local money = nil
local bank = nil
for key, account in pairs(data.accounts) do
if account.name == 'bank' then
bank = account.money
elseif account.name == 'money' then
money = account.money
end
end
return {
wallet = money,
bank = bank
}
end
end
-- Check if the player is logged or not
-- @return boolean
MAV.Functions.PlayerIsLogged = function()
if Config.Framework == 'qb' then return LocalPlayer.state.isLoggedIn end
if Config.Framework == 'esx' then return Core.IsPlayerLoaded() end
end
-- Check if the weapon is whitelisted for the stress
-- @return boolean
MAV.Functions.IsWhitelistedWeaponStress = function(weapon)
if weapon then
for _, v in pairs(Config.WhitelistedWeaponStress) do
if weapon == v then
return true
end
end
end
return false
end
-- Get the effect interval
-- @param level
-- @return number
MAV.Functions.GetEffectInterval = function(level)
for _, v in pairs(Config.EffectInterval) do
if level >= v.min and level <= v.max then
return v.timeout
end
end
return 60000
end
-- Get the blur intensity
-- @param stress
-- @return number
MAV.Functions.GetBlurIntensity = function(stress)
for _, v in pairs(Config.Intensity['BLUR']) do
if stress >= v.min and stress <= v.max then
return v.intensity
end
end
return 1500
end
MAV.Functions.PlaySound = function(Data)
if Data.Enabled then
PlaySoundFrontend(-1, Data.AudioName, Data.AudioRef, true)
end
end
-- This function is the one that will read when you set GetExtrMoneyAmount to true in the Config
MAV.Functions.GetExtraMoneyAmount = function()
if Config.Framework == 'qb' then
local data = MAV.Functions.GetPlayerData()
return data.money['crypto'] or 0
end
if Config.Framework == 'esx' then
local data = MAV.Functions.GetPlayerData()
return data.accounts[3].crypto or 0
end
end
-- Add here the function that you use for the static ID, it will only be activated if you set UseIDStatic to true, in the CONFIG
MAV.Functions.GetStaticId = function()
end
-- This will only trigger if you fill it in and set Config.CustomStress = true to true. If you set true and set this empty it will take the stress of esx_status
MAV.Functions.GetStress = function()
end
-- All functions related to the "Seat Belt" system are open here.
local seatbelt = false
MAV.Functions.Seatbelt = function()
if Config.UseKeyToggleseatbelt then
RegisterKeyMapping(Config.Commands.ToggleSeatbelt, Lang.seatbelt_command_description, 'keyboard', Config.ToggleSeatbelt)
end
RegisterCommand(Config.Commands.ToggleSeatbelt, function()
local ped = PlayerPedId()
if IsPedInAnyVehicle(ped, false) then
local class = GetVehicleClass(GetVehiclePedIsIn(ped))
if class ~= 14 then
seatbelt = not seatbelt
if Config.Notification then
if seatbelt then
MAV.Functions.Notify(Lang.seatbelt_on, 'success')
else
MAV.Functions.Notify(Lang.seatbelt_off, 'success')
end
end
end
end
end, false)
local currSpeed = 0.0
local prevSpeed = currSpeed
local prevVelocity = { x = 0.0, y = 0.0, z = 0.0 }
CreateThread(function()
local wait = 1000
while true do
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local position = GetEntityCoords(PlayerPedId())
if vehicle ~= 0 then
local prevSpeed = currSpeed
currSpeed = GetEntitySpeed(vehicle)
local class = GetVehicleClass(vehicle)
if not seatbelt and class ~= 8 and class ~= 13 then
local vehIsMovingFwd = GetEntitySpeedVector(vehicle, true).y > 1.0
local vehAcc = (prevSpeed - currSpeed) / GetFrameTime()
if (vehIsMovingFwd and (prevSpeed > (Config.EjectSpeed / 2.237)) and (vehAcc > (Config.EjectAccel * 9.81))) then
SetEntityCoords(PlayerPedId(), position.x, position.y, position.z - 0.47, true, true, true)
SetEntityVelocity(PlayerPedId(), prevVelocity.x, prevVelocity.y, prevVelocity.z)
Wait(1)
SetPedToRagdoll(PlayerPedId(), 1000, 1000, 0, 0, 0, 0)
else
prevVelocity = GetEntityVelocity(vehicle)
end
elseif seatbelt then
DisableControlAction(0, 75)
end
wait = 0
else
prevSpeed = 0.0
wait = 1000
end
Wait(wait)
end
end)
end
MAV.Functions.GetSeatbeltState = function()
return seatbelt
end
if Config.Debug then
for cb, _ in pairs(MAV.Functions) do
MAV.Debug(('function - MAV.Functions.%s'):format(
cb
))
end
for _, event in pairs(MAV.Events) do
MAV.Debug(('event - %s'):format(
event()
))
end
end
Lang = Lang or {}
Lang.hud_loaded = 'Hud settings is loaded'
Lang.map_loaded = 'Map is loaded'
Lang.command_description = 'Open hud'
Lang.low_fuel = 'Your fuel level is low'
Lang.gain_stress = 'Feeling more stressed'
Lang.seatbelt_command_description = 'Toggle Seatbelt'
Lang.seatbelt_on = 'You have put on your seatbelt'
Lang.seatbelt_off = 'You have taken off your seatbelt'
Lang.gasolinelow = 'Your gasoline level is low'
Lang.lowhealth = 'Your health level is low'
Lang.lowthirst = 'Your thirst level is low'
Lang.lowhunger = 'Your hunger level is low'
Lang.cashchanged = 'Your cash balance has changed by $%s'
Lang.bankchanged = 'Your bank balance has changed by $%s'
Lang.cruisecontrolon = 'Cruise control activated'
Lang.cruisecontroloff = 'Cruise control deactivated'
Lang.cruisehelp = 'Turn cruise mode on / off'
If you want to edit the aesthetics or design. You have the HTML open so you can modify the style and everything as you want.
The script is RESPONSIVE for all resolutions as well.