Made this config using Cops_FiveM as a base.
Now got this:
Config = {
General = {
paycheckDelay = 300, --5 Minutes
hungerRate = 120, --2 Minutes
thirstRate = 120, --2 Minutes
relifRate = 120 --2 Minutes
},
Var = {
life_money = 0,
life_bank = 0,
life_hunger = 0,
life_thirst = 0,
life_relif = 0,
life_paycheck = 5000,
life_threatlevel = "Green",
life_recentmajorcrime = false,
cop_isonduty = false,
medic_isonduty = false
},
STR = {
Example_Test = "Example String",
Shops_Clothing = "Clothing Store",
Shops_Gang = "Gang Clothing Store",
Shops_Diving = "Diving Store",
Shops_Weapon = "Weapon Store",
Shops_Market = "General Market",
Shops_FishMarket = "Fish Market",
Shops_Coffee = "Coffee Shop",
Shops_DrugDealer = "Drug Dealer",
Shops_Oil = "Oil Trader",
Shops_Glass = "Glass Trader",
Shops_Cement = "Cement Shop"
},
VehShops = {
{model=vehiclename, buyprice, sellprice, insuranceprice, faction},
{model=adder, 1000000, 500000, 5000, civilian},
{model=firetruck, 10000, 5000, 500, ems},
{model=police, 10000, 5000, 500, cop}
},
VehShopLocations = {
{title="marker name", colour=1, id=361, x=X, y=Y, z=Z},
{title="Gas Station", colour=1, id=361, x=49.4187, y=2778.793, z=58.043},
}
}
Use in script
function textHealth(content)
SetTextFont(1)
SetTextProportional(0)
SetTextScale(0.5,0.5)
SetTextEntry("STRING")
AddTextComponentString("Health: " ..content.."%")
DrawText(0.88,0.62)
end
function textHunger(content)
SetTextFont(1)
SetTextProportional(0)
SetTextScale(0.5,0.5)
SetTextEntry("STRING")
AddTextComponentString("Hunger: " ..content.."%")
DrawText(0.88,0.65)
end
function textThirst(content)
SetTextFont(1)
SetTextProportional(0)
SetTextScale(0.5,0.5)
SetTextEntry("STRING")
AddTextComponentString("Thirst: " ..content.."%")
DrawText(0.88,0.68)
end
function textRelif(content)
SetTextFont(1)
SetTextProportional(0)
SetTextScale(0.5,0.5)
SetTextEntry("STRING")
AddTextComponentString("Relif: " ..content.."%")
DrawText(0.88,0.71)
end
function textStamina(content)
SetTextFont(1)
SetTextProportional(0)
SetTextScale(0.5,0.5)
SetTextEntry("STRING")
AddTextComponentString("Stamina: " ..content.."%")
DrawText(0.88,0.74)
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(2)
local Health = GetEntityHealth(GetPlayerPed(-1))
local HealthNew = Health - 100
textHealth(math.floor(HealthNew))
textHunger(math.floor(Config.Var.life_hunger))
textThirst(math.floor(Config.Var.life_thirst))
textRelif(math.floor(Config.Var.life_relif))
textStamina(math.floor(GetPlayerSprintStaminaRemaining(GetPlayerPed(-1))))
end
end)
Error on debug console:
Error resuming coroutine: @Catraz_RP/client/functions/fbc_RPHUD.lua:47: Attempt to call a nil value (global "Config")
Any ideas why?