> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add item to trunk

> Fügt Items zu einem Fahrzeugkofferraum hinzu, nur anhand des Kennzeichens, mit automatischer Auflösung der vollständigen Inventar-ID.

Fügt Items zu einem Fahrzeugkofferraum hinzu, nur anhand des Kennzeichens, mit automatischer Auflösung der vollständigen Inventar-ID.

<CodeGroup>
  ```lua Export theme={null}
  exports['jaksam_inventory']:addItemToTrunk(plate, itemName, amount, metadata, slotId)
  ```

  ```lua Example theme={null}
  -- 5 Wasserflaschen zum Fahrzeugkofferraum hinzufügen
  local plate = GetVehicleNumberPlateText(vehicle)
  local success, result = exports['jaksam_inventory']:addItemToTrunk(plate, 'water', 5)

  if not success then
      print("Failed to add item: " .. result)
  end

  -- Item mit Metadaten hinzufügen
  local success = exports['jaksam_inventory']:addItemToTrunk("ABC 123", 'phone', 1, {
      number = "555-0123"
  })
  ```
</CodeGroup>

### Parameter

| Name       | Datentyp | Beschreibung                                           |
| ---------- | -------- | ------------------------------------------------------ |
| `plate`    | string   | Das Fahrzeugkennzeichen                                |
| `itemName` | string   | Der Name des hinzuzufügenden Items                     |
| `amount`   | number   | Wie viele Items hinzugefügt werden sollen              |
| `metadata` | table    | Zusätzliche Daten für das Item                         |
| `slotId`   | number   | Bestimmter Slot, in dem das Item platziert werden soll |

### Rückgabewert

| Name               | Datentyp | Beschreibung                                                                     |
| ------------------ | -------- | -------------------------------------------------------------------------------- |
| `success`          | boolean  | True, falls die Items erfolgreich hinzugefügt wurden                             |
| `resultCode`       | string   | Fehlermeldung, falls der Vorgang fehlgeschlagen ist (z.B. "vehicle\_not\_found") |
| `notificationType` | string   | Art der Benachrichtigung, die dem Nutzer angezeigt werden soll                   |

### Hinweise

* Funktioniert mit eigenen Fahrzeugen (auch wenn nicht gespawnt/in der Garage)
* Funktioniert mit NPC-Fahrzeugen (falls aktuell gespawnt)
* Erstellt bei Bedarf automatisch das Kofferraum-Inventar
* Bei eigenen Fahrzeugen ist das Inventar persistent (in der Datenbank gespeichert)


## Related topics

- [Server](/de/jaksam-inventory/functions/server/index.md)
- [Remove item from trunk](/de/jaksam-inventory/functions/server/remove-item-from-trunk.md)
- [Add item](/de/jaksam-inventory/functions/server/add-item.md)
- [Add item to glovebox](/de/jaksam-inventory/functions/server/add-item-to-glovebox.md)
- [Inventory created](/de/jaksam-inventory/hooks/on-inventory-created.md)
