Inventory

Here is the information. If you encounter an issue with your custom inventory, you can configure it as shown below.

The folder you need to modify for a custom inventory is located at: server/inv/default/main.lua.

Exemple

print("^2[DRONE] DEFAULT Inventory loaded ✓^0")

-- Check if items are enabled in the config
if not config.items.enabled then
    return
end

-- Using the drone
RegisterUsableItem(config.items.drone, function(source)
    local playerInfo = GetPlayerInfo(source)

    SendDiscordLog(
        "🚁 Drone Deployed",
        "A player has used a drone",
        3066993,
        {
            {name = "Player", value = playerInfo.name, inline = true},
            {name = "ID", value = tostring(playerInfo.source), inline = true},
            {name = "Identifier", value = playerInfo.identifier, inline = false}
        }
    )

    TriggerClientEvent("al:useDrone", source)
end)

-- Using the grenade
RegisterUsableItem(config.items.grenade, function(source)
    TriggerClientEvent("al:reloadGrenade", source)
end)

-- Functions to manage custom inventory
function AddItem(playerSource, item, amount)
    -- Add an item to the player
end

function RemoveItem(playerSource, item, amount)
    -- Remove an item from the player
end

function GetItemCount(playerSource, item)
    -- Returns 1 if the player can carry the item, otherwise 0
    local canCarry = true -- replace with your custom inventory logic
    return canCarry and 1 or 0
end

Last updated