Fivecore
  • Fivecore - FiveM Scripts
  • Discord
  • General
    • Common issues
  • RESOURCES
    • Zombies
      • Installation
      • Usage
      • Functions
        • Server Functions
      • Events
        • Server Events
    • Looting
      • Installation
      • Setup
      • Events
        • Server Events
      • Functions
        • Client Functions
        • Server Functions
      • Loot editor
    • NPC Dialogs
      • Installation
      • Usage
      • Extras
    • Dynamic Guides
      • Installation
      • Usage
    • Interact
      • Installation
      • Usage
      • InteractOptions
      • Functions
        • Client
Powered by GitBook
On this page
  • Setup client config
  • Setup available items for loot
  • Extra settings
  1. RESOURCES
  2. Looting

Setup

Setup client config

config_client.lua

First, we need to configure the ImagesPath option. This is essential for the system to locate the correct path to load the item's image in the interface. If you are using ox_inventory, set the ImagesPath to:

ImagesPath = 'nui://ox_inventory/web/images/'

If you are using qb-inventory, set the ImagesPath to:

ImagesPath = 'nui://qb-inventory/html/images/'

If you are not using either of these or if the path is a web link, you should enter the link without the .png extension. For example:

Original link: https://r2.fivemanage.com/ryfJZiNwBGGSsHzTvTa2B/bandage.png

You should set it as:

ImagesPath = 'https://r2.fivemanage.com/ryfJZiNwBGGSsHzTvTa2B/'

Setup available items for loot

config_server.lua

First, we need to create the item categories with all the available items that will be used later. For example, if you are setting up a medical items category with three medical items and a ammo category with some ammo, it would look like this:

Categories = {
    ['medical'] = { -- Category name
        ['painkiller'] = { -- Item name
            chance = 60, -- Chance of appearing in the loot point (1 to 100 in %)
            min = 1, max = 3, -- Minimum and maximum quantity of the item (if not defined, it will be 1)
            metadata = {durability = 50} -- Metadata to be added to the item (if not defined, it will be nil)
        },
        ['bandage'] = {
            chance = 50,
        },
        ['firstaidkit'] = {
            chance = 20,
        }
    },
    ['ammo'] = {
        ['ammo-22'] = {
            chance = 30,
            min = 6, max = 20
        },
        ['ammo-38'] = {
            chance = 20,
            min = 7, max = 15
        },
        ['ammo-44'] = {
            chance = 20,
            min = 5, max = 15
        }
    },
}

Next, we need to define which categories will be available for each object. For example, for a broken car model (prop_rub_carwreck_2), we want players to be able to find medical items and ammunition. The configuration would look like this::

Props = {
    ["prop_rub_carwreck_2"] = { -- Model name
        label = "Destroyed Vehicle", -- Name that will appear in the interface
        categories = {'medical', 'ammo'}, -- Categories that this loot spot will have
        -- excludeDefault = true -- If you want to exclude the default loot spots for this model set to true
    },
}

Whenever a player encounters this object and it is available for looting, the player will have the opportunity to find all the items defined within the specified categories. The items will be distributed according to the defined quantities and probabilities. For example, if the prop_rub_carwreck_2 is set to provide items from the "medical" and "ammo" categories: The player may find various medical items such as bandages and first aid kits, as defined within the "medical" category. Similarly, the player may find ammunition items, as defined within the "ammo" category. The actual items and their quantities will be determined based on the configuration for each category and the chance assigned.

Extra settings

Now that the essential configurations are complete, you should proceed to the client and server configuration files (config_client.lua and config_server.lua) to finalize the remaining settings according to your preferences.

In these files, you will find various settings along with explanations for each one. Adjust the configurations as needed to match your desired setup.

  • config_client.lua: This file contains client-specific settings. Customize it to control how the client-side of the system behaves.

  • config_server.lua: This file contains server-specific settings. Modify it to manage server-side behavior and interactions.

Be sure to review the explanations provided in these files for each configuration option to ensure you set everything correctly according to your requirements.

PreviousInstallationNextEvents

Last updated 5 months ago