Price
UnknownMetal Detector Script [Paid][Standalone]
A script by SaltyFug
Full Description
A Metal Detector script for FiveM
- Ideal for players wanting to find buried items in the sand or dirt
Demo: https://youtu.be/vFOSVxQK5Cg
Available here: https://saltyscripts.tebex.io/
- Fully multiplayer compatible
- E.x. All players can see the same locations, but if someone digs it up first then it is gone for all other players while being a standalone script
- No Framework Required (QB, ESX)
- Framework only needed for handling player inventory/money, otherwise you can’t get items
- Configurable Loot Tables (framework required for items)
- Over 100 Configurable Locations
## GAME BUILD >= 2699 REQUIRED
- set sv_enforceGameBuild 2699 # the criminal enterprises dlc
# Over 100 locations across the map (beaches and mountains)
Or create your own
Config.Locations = {
[1] = {
["coords"] = vector3(-1711.87, -1030.02, 3.82), -- Set any coords you want
["isActive"] = false, -- DONT TOUCH
["loot"] = "beach-common" -- Select which group you want from the LootTable
},
)
Define your own loot tables
Items must be created in your framework
Config.LootTable = {
["beach-common"] = {'sandwich', 'water_bottle', 'bandage', 'fitbit'},
["beach-uncommon"] = {'lockpick', 'joint', 'beer'},
["beach-rare"] = {'weapon_pistol', 'diamond_ring'},
["forest-common"] = {'weapon_wrench', 'sandwich', 'water_bottle'},
["forest-uncommon"] = {'vodka', 'cigs', 'advancedlockpick'},
["forest-rare"] = {'phone', 'rolex', 'goldchain'},
["ultra-rare"] = {'weapon_pumpshotgun', 'coke_brick', 'weapon_smg'}
}
Example of creating the item in QBCore shared/items.lua
['weapon_metaldetector'] = {['name'] = 'weapon_metaldetector', ['label'] = 'Metal Detector', ['weight'] = 1000, ['type'] = 'weapon', ['ammotype'] = nil, ['image'] = 'WEAPON_METALDETECTOR.png', ['unique'] = true, ['useable'] = true, ['description'] = 'Metal Detector'},
Option to add a chance to find money instead of an item
Config.ChanceForMoney = 20
Config.MinMoney = 1
Config.MaxMoney = 10000
Customize your Framework’s behavior
custom.lua (Open)
local Framework
if Config.Framework == 'QBCore' then
Framework = exports['qb-core']:GetCoreObject()
elseif Config.Framework == 'ESX' then
TriggerEvent('esx:getSharedObject', function(obj) Framework = obj end)
else
-- Do something else for whatever framework you have
end
function RewardPlayer(src, item, money)
if Config.Framework == 'QBCore' then
local Player = Framework.Functions.GetPlayer(src)
if item then
Player.Functions.AddItem(item, 1)
-- CHANGE THIS TO WHATEVER NOTIFICATION SCRIPT YOU USE
TriggerClientEvent('QBCore:Notify', src, 'You found a ' .. Framework.Shared.Items[item].label)
elseif money then
Player.Functions.AddMoney('cash', money)
-- CHANGE THIS TO WHATEVER NOTIFICATION SCRIPT YOU USE
TriggerClientEvent('QBCore:Notify', src, 'You found $' .. money)
end
elseif Config.Framework == 'ESX' then
local xPlayer = Framework.GetPlayerFromId(src)
if item then
xPlayer.addInventoryItem(item, 1)
-- CHANGE THIS TO WHATEVER NOTIFICATION SCRIPT YOU USE
TriggerClientEvent('ESX:Notify', src, 'You found a '.. item)
else
xPlayer.addMoney(money)
-- CHANGE THIS TO WHATEVER NOTIFICATION SCRIPT YOU USE
TriggerClientEvent('ESX:Notify', src, 'You found $' .. money)
end
else
-- Do something else if you're not using QB or ESX
end
end
| Code is accessible | Some |
| Subscription-based | No |
| Lines (approximately) | ~1000 |
| Requirements | NONE |
| Support | Yes |
Community Reviews
See what others are saying about this script.
Leave a Review
Share your experience and help others.