STG ScriptsDocumentation
Treasure Map

Installation

Install STG Treasure Map on your FiveM server, with item definitions for ESX, QBCore and ox_inventory.

Treasure Map

STG Treasure Map

ESXQBCoreQBOX
View in store

Download the script

Sign in to the Cfx.re portal with the account you used at checkout and download stg-treasuremap from Granted Assets.

Move the resource

Extract the zip and place the stg-treasuremap folder inside the [STG] category folder in your resources directory.

resources/
└── [STG]/
    └── stg-treasuremap/

Keep the folder name stg-treasuremap. If it is renamed, the script keeps printing a rename warning in the console.

Install the dependencies

Treasure Map needs ox_lib. On ESX it also needs oxmysql. Skip this step if your server already runs them.

Add the items

The script uses eight items: three maps, the shovel and four rewards.

NameLabelRole
treasure_map_smallSmall Treasure MapUsable, opens the map with the player's spots
treasure_map_mediumMedium Treasure MapUsable, opens the map with the player's spots
treasure_map_largeLarge Treasure MapUsable, opens the map with the player's spots
shovelShovelUsable, digs at the player's position
goldbarGold BarReward
diamond_ringDiamond RingReward
diamondDiamondReward
goldchainGold ChainReward

Many servers already have shovel, goldbar, diamond_ring, diamond or goldchain. Only add the ones you are missing. QBOX servers use the ox_inventory tab.

Run this in your database:

INSERT INTO items (name, label)
VALUES
    ('treasure_map_small', 'Small Treasure Map'),
    ('treasure_map_medium', 'Medium Treasure Map'),
    ('treasure_map_large', 'Large Treasure Map'),
    ('shovel', 'Shovel'),
    ('goldbar', 'Gold Bar'),
    ('diamond_ring', 'Diamond Ring'),
    ('diamond', 'Diamond'),
    ('goldchain', 'Gold Chain');

Add these to qb-core/shared/items.lua:

treasure_map_small  = { name = 'treasure_map_small', label = 'Small Treasure Map', weight = 500, type = 'item', image = 'treasure_map_small.png', unique = true, useable = true, shouldClose = true, description = 'A small treasure map that leads to minor rewards' },
treasure_map_medium = { name = 'treasure_map_medium', label = 'Medium Treasure Map', weight = 700, type = 'item', image = 'treasure_map_medium.png', unique = true, useable = true, shouldClose = true, description = 'A medium treasure map that reveals better rewards' },
treasure_map_large  = { name = 'treasure_map_large', label = 'Large Treasure Map', weight = 1000, type = 'item', image = 'treasure_map_large.png', unique = true, useable = true, shouldClose = true, description = 'A large treasure map that uncovers great rewards' },
shovel              = { name = 'shovel', label = 'Shovel', weight = 2000, type = 'item', image = 'shovel.png', unique = false, useable = true, shouldClose = true, description = 'A sturdy shovel, essential for digging up treasures' },
goldbar             = { name = 'goldbar', label = 'Gold Bar', weight = 1500, type = 'item', image = 'goldbar.png', unique = false, useable = false, shouldClose = true, description = 'A shiny gold bar, valuable for trade' },
diamond_ring        = { name = 'diamond_ring', label = 'Diamond Ring', weight = 300, type = 'item', image = 'diamond_ring.png', unique = false, useable = false, shouldClose = true, description = 'A luxurious diamond ring, perfect for selling' },
diamond             = { name = 'diamond', label = 'Diamond', weight = 200, type = 'item', image = 'diamond.png', unique = false, useable = false, shouldClose = true, description = 'A precious diamond, highly valuable' },
goldchain           = { name = 'goldchain', label = 'Gold Chain', weight = 400, type = 'item', image = 'goldchain.png', unique = false, useable = false, shouldClose = true, description = 'A fancy gold chain, good for resale' },

Add these to ox_inventory/data/items.lua:

['treasure_map_small'] = {
    label = 'Small Treasure Map',
    weight = 500,
    stack = false,
},

['treasure_map_medium'] = {
    label = 'Medium Treasure Map',
    weight = 700,
    stack = false,
},

['treasure_map_large'] = {
    label = 'Large Treasure Map',
    weight = 1000,
    stack = false,
},

['shovel'] = {
    label = 'Shovel',
    weight = 2000,
    stack = false,
},

['goldbar'] = {
    label = 'Gold Bar',
    weight = 1500,
    stack = true,
},

['diamond_ring'] = {
    label = 'Diamond Ring',
    weight = 300,
    stack = true,
},

['diamond'] = {
    label = 'Diamond',
    weight = 200,
    stack = true,
},

['goldchain'] = {
    label = 'Gold Chain',
    weight = 400,
    stack = true,
},

The maps and the shovel are registered as usable items through your framework, so they need no client field.

If you rename an item, change it in Config.Items or Config.TreasureItems as well.

Add the item images

Copy the images from stg-treasuremap/[SETUP]/item-images/ into your inventory's image folder, for example ox_inventory/web/images/ or qb-inventory/html/images/.

Start the script

Make sure [STG] starts after your framework, inventory and ox_lib in server.cfg:

ensure oxmysql
ensure ox_lib
# your framework: es_extended, qb-core or qbx_core
# your inventory, and ox_target or qb-target if you use one
ensure [STG]

Then restart the whole server.

Unfinished maps are saved in stg-treasuremap/data.json. Keep your own copy of this file when you update the script, otherwise players lose the spots they have not dug up yet.

Nothing happens or the console shows an error? See Common Errors.

Next steps

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page