Below is a condensed example of your Config.lua, showing the essential parameters for an advanced metal detecting system. You can expand or adjust as needed for your server.
Config = {}
-- Framework selection: "auto", "esx", or "qb"
Config.Framework = "auto"
Config.Language = "en" -- en, de, fr, sp, pt
Config.DiscordImage = true -- If true, uses an image in Discord embed
Config.MoneyType = "EUR" -- Display currency type in NUI (e.g., "USD", "EUR")
Config.ChestModel = "xm_prop_x17_chest_closed"
Config.digTime = 8000 -- ms for the digging progress bar
Config.Item = "metal_detector"
Config.Price = {
buy = 2500, -- Cost to buy a metal detector
rent = 500 -- Cost to rent a metal detector
}
-- Keys to disable while scanning/digging
Config.DisableKeys = {21, 24}
-- Shop & NPC
Config.Shop = {
marker = false,
npc = true,
model = "s_m_y_dockwork_01",
coord = vec4(-1368.8090, -1492.8373, 3.4431, 83.1140),
blip = {
label = "Metal Detector Shop",
sprite = 605,
scale = 0.7,
color = 5,
visible = true
}
}
-- Tasks / Achievements
Config.Tasks = {
[1] = {
type = "time",
value = 30, -- In minutes
title = "Play 30 Minutes!",
money = 3000,
prize = {
{ item="pizza", image="images/items/pizza.png", amount=4 },
{ item="icedtea", image="images/items/icedtea.png", amount=3 }
}
},
-- More tasks...
}
-- Rewards: Items discovered by digging
Config.Rewards = {
["jewelry"] = {
title = "Jewelry",
price = 500,
chance = 20,
score = 80
-- ...
},
["rock"] = {
title = "Rock",
price = 25,
chance = 35,
score = 10
-- ...
},
-- More reward items...
}
-- Upgrades: Battery capacity, detection radius, radar, etc.
Config.Upgrades = {
["max_battery"] = {
type = "upgrade",
title = "BATTERY LEVEL",
image = "images/upgrades/battery.png",
description = "...",
levels = {
[1] = { time=15 },
[2] = { time=30, price=30000 },
-- More levels...
}
},
["radar"] = {
type = "upgrade",
title = "RADAR LEVEL",
image = "images/upgrades/radar.png",
description = "...",
levels = {
[1] = { radius=0.0 },
[2] = { radius=50.0, price=50000 },
[3] = { radius=30.0, price=50000 }
}
},
["battery"] = {
type = "item",
title = "BATTERY CAPSULE",
item = "battery",
time = 5000,
price = 5000
},
["shovel"] = {
type = "item",
title = "SHOVEL",
item = "shovel",
price = 5000
}
}
-- Localization
Config.Locales = {
["en"] = {
success_buy = "You have successfully purchased it!",
no_money = "You don't have enough money!",
-- ...
digging = "Digging...",
cancel = "Digging canceled!",
-- ...
},
["de"] = {
success_buy = "Du hast es erfolgreich gekauft!",
-- ...
},
-- ...
}
function getFramework()
-- Auto-detection snippet:
if Config.Framework == "esx" then
return exports['es_extended']:getSharedObject(), "esx"
elseif Config.Framework == "qb" then
return exports["qb-core"]:GetCoreObject(), "qb"
elseif Config.Framework == "auto" then
if GetResourceState('qb-core') == 'started' then
return exports["qb-core"]:GetCoreObject(), "qb"
elseif GetResourceState('es_extended') == 'started' then
return exports['es_extended']:getSharedObject(), "esx"
end
end
end
Highlights
Config.Framework:"auto" tries to see if qb-core or es_extended is active.
Config.Tasks: Time-based or dig-based achievements awarding money and item prizes.
Config.Rewards: Items discovered by digging, each with a chance and score.
Config.Upgrades: Battery, radius, radar, or shovel (item). Levels may have price or extended time.
Config.Locales: Quick multi-language support (English, German, etc.).