EZ Scripts
DiscordTebex
  • 💡Welcome To EZ Scripts
  • FIVEM
    • 🍀EZ White Widow
      • Config File
      • Add more locations
      • Common Issues
    • 🟣EZ Lean Drug
      • Config File
      • Add more locations
    • ❄️EZ Coke & Crack Drug
      • Config File
      • Add more locations
    • 🔠EZ Plate Changer
      • Config File
    • 📑Ez Lib
      • Config File
    • 🛡️Ez Admin Authority
      • Config File
    • 🫳Ez Item Spawner
      • Config File
      • Permission Check
      • Add Item
      • Get Items
  • RedM
    • 💼EZ Society & Job Meny
      • Config File
      • Exports
      • Syn Society
    • 🌍EZ Fast Travel
      • Config File
    • 🛡️Ez Admin Authority
      • Config File
    • 🍖Ez Consumables
      • Config File
    • 📺Ez HUD
      • Config File
      • Exports and Events
    • 🚷EZ Combat Logging
      • Config File
    • 🗽EZ Life Style
      • Getting Life Style
      • Config File
    • ☢️EZ Radial Menu
      • Config File
    • 🫳Ez Item Spawner
      • Config File
      • Permission Check
      • Add Item
      • Get Items
Powered by GitBook
On this page
  • VORP
  • QBCore

Was this helpful?

  1. FIVEM
  2. Ez Item Spawner

Get Items

A function which gets the items that exist in the server. How you can adapt the function for other framework example.

Each item is in the form of ...

items[1] = {
    type = "item",
    item = "water",
    label = "Water",
    limit = 10, -- Optional
}

VORP

SConfig.GetItems = function()
    local items = {
        -- Put all weapons here
    }
    local result = MySQL.Sync.fetchAll("SELECT * FROM items", {})
    for _, db_item in pairs(result) do
        if db_item.id then
            items[#items+1] = {
                type = "item",
                item = db_item.item,
                label = db_item.label,
                limit = db_item.limit,
            }
        end
    end
    return items
end

QBCore

SConfig.GetItems = function()
    local items = {}
    for itemName, itemData in pairs(QBCore.Shared.Items) do
        items[#items + 1] = {
            type = "item",
            item = itemName,
            label = itemData.label,
        }
    end
    return items
end
PreviousAdd ItemNextEZ Society & Job Meny

Last updated 4 months ago

Was this helpful?

🫳