⚙️Config
What i can customize?
You can modify many aspects of our script according to your framework and some scripts you use.
Explentation config.lua
config.lua
Config = {
Inventory = "ESX", ---OX/ESX/QB/CUSTOM
StatusFramework = "ESX", ---ESX/QB/CUSTOM
PlayerLoadedEvent = "esx:playerLoaded", ---"esx:playerLoaded"/"QBCore:Client:OnPlayerLoaded"/CUSTOM
Item = "watch", --"watch"/ false
City = "Los Santos",
OpenKey = "F5",
Lowlevelnotification = {
sound = true,
flash = true,
screenflash = true,
TimerScreenFlashAndSound = 60000,
health = 30, --- -1 disable
thirst = 30, --- -1 disable
hunger = 30, --- -1 disable
},
weatherTypes = {
["EXTRASUNNY"] = {temp = 30, dayIcon = "DEXTRASUNNY.png", nightIcon = "NEXTRASUNNY.png", label = "Very Sunny"},
["CLEAR"] = {temp = 25, dayIcon = "DCLEAR.png", nightIcon = "NCLEAR.png", label = "Clear Sky"},
["CLOUDS"] = {temp = 20, dayIcon = "DCLOUDS.png", nightIcon = "NCLOUDS.png", label = "Cloudy"},
["OVERCAST"] = {temp = 18, dayIcon = "DOVERCAST.png", nightIcon = "NOVERCAST.png", label = "Overcast"},
["RAIN"] = {temp = 15, dayIcon = "DRAIN.png", nightIcon = "NRAIN.png", label = "Rainy"},
["CLEARING"] = {temp = 17, dayIcon = "DCLEARING.png", nightIcon = "NCLEARING.png", label = "Clearing"},
["THUNDER"] = {temp = 10, dayIcon = "DTHUNDER.png", nightIcon = "NTHUNDER.png", label = "Thunderstorm"},
["SMOG"] = {temp = 22, dayIcon = "DSMOG.png", nightIcon = "NSMOG.png", label = "Smoggy"},
["FOGGY"] = {temp = 12, dayIcon = "DFOGGY.png", nightIcon = "NFOGGY.png", label = "Foggy"},
["XMAS"] = {temp = 0, dayIcon = "DXMAS.png", nightIcon = "NXMAS.png", label = "Snowy"}
}
}
Configuration Details
Inventory:
Description: Specifies which inventory management system your server uses. Options:
"ESX"
: Use this if your server runs the ESX framework."OX"
: Select this for the OX framework."QB"
: Choose this for the QB framework."CUSTOM"
: Opt for a custom solution if you're using a non-standard inventory system.
StatusFramework:
Description: Determines the framework used for managing player status such as hunger and thirst. Options:
"ESX"
: For servers using the ESX status management."QB"
: For servers using the QB framework."CUSTOM"
: For a custom status management solution.
PlayerLoadedEvent:
Description: Specifies the event triggered when a player loads into the server. Options:
"esx:playerLoaded"
: Use this if your server runs the ESX framework."QBCore:Client:OnPlayerLoaded"
: Select this for the QB framework."CUSTOM"
: Use a custom event if your server uses a non-standard player loading process.
Item:
Description: Defines the name or ID of the smart watch item in the inventory system. This is used to reference the smart watch within the game's item management. Options:
"watch"
: The default name for the smart watch item.false
: Disables the item if not required.
City:
Description: Name of your city as it will appear in the weather app on the smart watch.
Example: "Los Santos"
OpenKey:
Description: Defines the key used to open the smart watch interface.
Default: "F5"
Lowlevelnotification:
Description: Configuration settings for low-level notifications related to health, thirst, and hunger. Fields:
sound
: Enables or disables sound notifications. (true
/false
)flash
: Enables or disables the flashing of the smart watch screen. (true
/false
)screenflash
: Enables or disables the flashing of the game screen. (true
/false
)TimerScreenFlashAndSound
: Duration (in milliseconds) for how long the screen flash and sound will be active.health
: Threshold percentage for health below which the notification triggers. (-1
to disable)thirst
: Threshold percentage for thirst below which the notification triggers. (-1
to disable)hunger
: Threshold percentage for hunger below which the notification triggers. (-1
to disable)
weatherTypes:
Description: Contains definitions for various weather conditions, including temperature and icons for day and night. Fields:
temp
: The temperature associated with the weather type (in degrees Celsius).dayIcon
: The icon used to represent the weather during the day.nightIcon
: The icon used to represent the weather at night.label
: A descriptive label for the weather condition.
Translation html/config.json
html/config.json
{
"days": ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"],
"thirst": "THIRST",
"hunger": "HUNGER",
"armor": "ARMOR",
"health": "Health",
"heart": "Heart",
"currentHealth": "Current",
"cronometer": "Cronometer",
"start": "Run",
"reset": "Reset",
"stop": "Stop",
"wheater": "Wheater"
}
Custom custom.lua
custom.lua
function HasItem(item)
QBCore = exports['qb-core']:GetCoreObject()
local p = promise.new()
QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
p:resolve(result)
end, item)
return Citizen.Await(p)
end
function ItemInInventory()
if Config.Item then
local count = 0
if Config.Inventory == "OX" then
count = exports.ox_inventory:GetItemCount(Config.Item)
elseif Config.Inventory == "ESX" then
ESX = exports["es_extended"]:getSharedObject()
local inventory = ESX.GetPlayerData().inventory
if inventory ~= nil then
for i=1, #inventory, 1 do
if inventory[i].name == Config.Item then
count = inventory[i].count
end
end
end
elseif Config.Inventory == "QB" then
count = HasItem(Config.Item)
else
print("Setup custom invetory")
end
if count > 0 then
return true
end
return false
else
return true
end
end
local thirst = 0
local hunger = 0
if Config.StatusFramework == "QB" then
RegisterNetEvent('hud:client:UpdateNeeds')
AddEventHandler('hud:client:UpdateNeeds', function(newHunger, newThirst)
hunger = newHunger
thirst = newThirst
end)
end
function getplayerdata()
if Config.StatusFramework == "ESX" then
TriggerEvent('esx_status:getStatus', 'hunger', function(status)
hunger = math.floor(status.getPercent())
end)
TriggerEvent('esx_status:getStatus', 'thirst', function(status)
thirst = math.floor(status.getPercent())
end)
elseif Config.StatusFramework ~= "CUSTOM" then
print("Setup custom status framework")
end
return {thirst = thirst, hunger= hunger,armor = GetPedArmour(PlayerPedId()), health = GetEntityHealth(PlayerPedId())-100}
end
Here you can customize if you have a custom framework!
Last updated