ScriptsM Metal Detecting
This script allows you to walk with metal detector and find items underground. Metal detector prop have realtime screen, that shows VDI(Visual Discrimination Indication) and distance to metal object. When digging, a hole appears and an item that you can pick up.
Installation
Download a resource (opens in a new tab) from keymaster or buy it by buttons at the top
Install all resource dependencies
- Ox Target (opens in a new tab) or
- Qb Target (opens in a new tab)
- QBCore (opens in a new tab) or
- ESX (opens in a new tab)
- InteractSound (opens in a new tab)
Resource start order
It's important for your resources to start in a logical order to prevent errors from missing dependencies.
start framework
start targetsystem
start InteractSound
start ScriptsM-MetalDetecting
Set up the InteractSound (opens in a new tab)
To get sounds working, you need to install .ogg files from zip archive following this guide:
- Add .ogg files from zip archive to InteractSound/client/html/sounds
- Open __resource.lua and modify following portion:
files({
'client/html/index.html',
-- Begin Sound Files Here...
-- client/html/sounds/*.ogg
...
})
- Now you are done with sounds
Config
There you can find an config of resource with description for all params
Config.Framework = 'esx' -- esx/qb
Config.ShovelMinusDur = 10 -- Shovel duration minus
Config.ShovelName = 'shovel' -- Shovel inventory name
Config.DetectorName = 'metaldetector' -- Detector inventory name
Config.UseBlips = true -- Use zone blips?
Config.BlipSprite = 587 -- Can be found here: https://docs.fivem.net/docs/game-references/blips/
Config.BlipColor = 6 -- Can be found here: https://docs.fivem.net/docs/game-references/hud-colors/
Config.BlipText = 'Metal detecting' -- Blip text
Config.UseVid = false -- Use VID(Visual Discrimination Indication)?
Config.AllowRun = true -- Allow run when holding metal detector?
-- Stage distance
Config.Stage1 = 40
Config.Stage2 = 30
Config.Stage3 = 25
Config.Stage4 = 20
Config.Stage5 = 15
Config.Stage6 = 10
Config.Stage7 = 5
Config.Stage8 = 3
Config.Stage9 = 1
Config.MaxSpawnRadius = 40 -- Max loot spawn radius
Config.DigoutDistance = 3 -- Allow digging from distance
Config.ZoneFindRadius = 100 -- Zone findout radius by points
Config.UseObjectSystem = true -- Use item pickup system?
Config.TargetSystem = 'ox' -- ox/qb
Config.TargetText = "Pickup Item" -- Target text
Config.Locations = {
{
name = "vespucci",
FirstPoint = vector2(-2105, -554),
SecondPoint = vector2(-2070, -517),
ThirdPoint = vector2(-1893, -693),
FourthPoint = vector2(-1927, -734),
Center = vector2(-1993, -628),
loot = "beach-common"
},
{
name = "chumash", -- Name of zone
FirstPoint = vector2(-3089, 525),
SecondPoint = vector2(-3091, 584),
ThirdPoint = vector2(-3074, 587),
FourthPoint = vector2(-3070, 527),
Center = vector2(-3079, 545), -- Center of zone
loot = "beach-rare" -- Loot category
}
}
Config.Loot = { -- Loot categories
{
name = 'beach-common', -- Category name
items = {
{name = 'bottle', chance = 20, vid = 78, object = `prop_bottle_cognac`, x = 0.0, y = 0.0, z = 1.1, pitch = 20.0, yaw = 0.0, roll = 0.0},
{name = 'gold', chance = 20, vid = 28, object = `prop_gold_bar`, x = 0.0, y = 0.0, z = 1.0, pitch = 0.0, yaw = 90.0, roll = 0.0},
}
},
{
name = 'beach-rare',
items = {
{name = 'bottle', chance = 1, vid = 78, object = `prop_bottle_cognac`, x = 0.0, y = 0.0, z = 1.1, pitch = 20.0, yaw = 0.0, roll = 0.0},
{name = 'gold', chance = 99, vid = 28, object = `prop_gold_bar`, x = 0.0, y = 0.0, z = 1.0, pitch = 0.0, yaw = 90.0, roll = 0.0},
}
}
}
Config.PersistNotify = function() -- Remove metal detector from your hands hotkey
--your export here
end
Config.PersistNotifyEnd = function() -- End of notification
--your export here
end
Config.HaveDetector = function() -- Have detector in hands when using shovel
--your export here
end