> For the complete documentation index, see [llms.txt](https://scythecode-studios.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scythecode-studios.gitbook.io/docs/redm-scripts/grave-robbery/installation.md).

# Installation

{% hint style="info" %}
Step by Step instructions to ensure a smooth installation experience
{% endhint %}

***

<figure><img src="https://2019895826-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL0j9g22qUvIxSf5O0gzy%2Fuploads%2FFF7igGEgSXD4COPRwzj1%2Fscs_graverobbery_thumbnail.png?alt=media&amp;token=b6725dfd-cbe9-49e5-8544-e5bbd05468fc" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
First download the asset from [cfx portal](https://portal.cfx.re/assets/granted-assets)
{% endhint %}

1. extract **scs\_graverobbery** into your resource folder
2. ensure it is name **scs\_graverobbery** and **NOT** anything else
3. head to your server.cfg and put&#x20;

   ```lua
   ensure scs_graverobbery
   ```
4. Now head to `scs_graverobbery/install/items.lua` and copy the item into your `rsg-core/shared/items.lua`
5. Configure the script to your liking `scs_graverobbery/shared/config.lua`
6. Restart your server and enjoy

***

{% hint style="info" %}
To <mark style="color:$success;">**ensure**</mark> that your <mark style="color:$success;">**grave\_shovel**</mark> shows the green durability bar when you acquire it via a shop or however you give it to players, you will need to follow this next step. <mark style="color:$warning;">**HOWEVER**</mark> this is not mandatory.
{% endhint %}

> Head to `rsg-inventory/server/exports.lua` and search for `Inventory.AddItem` **replace** the entire export with the following

```lua
// --- Adds an item to the player's inventory or a specific inventory.
--- @param identifier string The identifier of the player or inventory.
--- @param item string The name of the item to add.
--- @param amount number The amount of the item to add.
--- @param slot number (optional) The slot to add the item to. If not provided, it will find the first available slot.
--- @param info table (optional) Additional information about the item.
--- @param reason string (optional) The reason for adding the item.
--- @return boolean Returns true if the item was successfully added, false otherwise.
Inventory.AddItem = function(identifier, item, amount, slot, info, reason)
   amount = tonumber(amount) or 1
   if amount <= 0 then
       print('AddItem: Invalid amount')
       return false
   end

   local itemInfo = RSGCore.Shared.Items[item:lower()]
   if not itemInfo then
       print('AddItem: Invalid item')
       return false
   end

   local inventory, inventoryWeight, inventorySlots
   local player = RSGCore.Functions.GetPlayer(identifier)

   if player then
       inventory = player.PlayerData.items
       inventoryWeight = player.PlayerData.weight
       inventorySlots = player.PlayerData.slots
   elseif Inventories[identifier] then
       inventory = Inventories[identifier].items
       inventoryWeight = Inventories[identifier].maxweight
       inventorySlots = Inventories[identifier].slots
   elseif Drops[identifier] then
       inventory = Drops[identifier].items
       inventoryWeight = Drops[identifier].maxweight
       inventorySlots = Drops[identifier].slots
   end

   if not inventory then
       print('AddItem: Inventory not found')
       return false
   end

   Inventory.CheckItemsDecay(inventory)
    
   local totalWeight = Inventory.GetTotalWeight(inventory)
   if totalWeight + (itemInfo.weight * amount) > inventoryWeight then
       print('AddItem: Not enough weight available')
       return false
   end

   info = info or {}
   -- Assign quality to items that decay OR are unique (like pickaxes)
   if itemInfo.decay or itemInfo.unique then
       info.quality = info.quality or 100
       if itemInfo.decay then
           info.lastUpdate = info.lastUpdate or os.time()
       end
   end

   local updated = false
   if not itemInfo.unique then
       if not slot then
           if itemInfo.decay or info.quality then
               slot = Inventory.GetFirstSlotByItemWithQuality(inventory, item, info.quality)
           else
               slot = Inventory.GetFirstSlotByItem(inventory, item)
           end
       end
       if slot then
           for _, invItem in pairs(inventory) do
               if invItem.slot == slot and invItem.name == item then
                   -- Only check quality if the item decays, otherwise stack freely
                   if not itemInfo.decay or (info.quality == invItem.info.quality) then
                       invItem.amount = (invItem.amount or 0) + amount
                       updated = true
                       break
                   end
               end
           end
       end
   end

   if not updated then
       slot = slot or Inventory.GetFirstFreeSlot(inventory, inventorySlots)
       if not slot then
           print('AddItem: No free slot available')
           return false
       end

       inventory[slot] = {
           name = item,
           amount = amount,
           info = info,
           label = itemInfo.label,
           description = itemInfo.description or '',
           weight = itemInfo.weight,
           type = itemInfo.type,
           unique = itemInfo.unique,
           useable = itemInfo.useable,
           image = itemInfo.image,
           shouldClose = itemInfo.shouldClose,
           slot = slot,
           combinable = itemInfo.combinable
       }

       if itemInfo.type == 'weapon' then
           if not inventory[slot].info.serie then
               inventory[slot].info.serie = tostring(
                   RSGCore.Shared.RandomInt(2) .. 
                   RSGCore.Shared.RandomStr(3) .. 
                   RSGCore.Shared.RandomInt(1) .. 
                   RSGCore.Shared.RandomStr(2) .. 
                   RSGCore.Shared.RandomInt(3) .. 
                   RSGCore.Shared.RandomStr(4)
               )
           end
           if not inventory[slot].info.quality then
               inventory[slot].info.quality = 100
           end
       end

--         -- Add quality to items that decay or are unique (durability system)
        if (itemInfo.decay or itemInfo.unique) and not inventory[slot].info.quality then
            inventory[slot].info.quality = 100
            if itemInfo.decay then
                inventory[slot].info.lastUpdate = os.time()
            end
        end
    end

    if player then player.Functions.SetPlayerData('items', inventory) end
    local invName = player and GetPlayerName(identifier) .. ' (' .. identifier .. ')' or identifier
    local addReason = reason or 'No reason specified'
    local resourceName = GetInvokingResource() or 'rsg-inventory'
    TriggerEvent(
        'rsg-log:server:CreateLog',
        'playerinventory',
        'Item Added',
        'green',
        '**Inventory:** ' .. invName .. ' (Slot: ' .. slot .. ')\n' ..
        '**Item:** ' .. item .. '\n' ..
        '**Amount:** ' .. amount .. '\n' ..
        '**Reason:** ' .. addReason .. '\n' ..
        '**Resource:** ' .. resourceName
    )
    return true
end

exports('AddItem', Inventory.AddItem)
```

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://scythecode-studios.gitbook.io/docs/redm-scripts/grave-robbery/installation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
