> ## 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.

# Optimisation

> Branche-toi sur les events d'items de ton inventaire pour améliorer les performances de Trackers Creator.

Cette page te montre comment optimiser le script. Suivre toutes les instructions ci-dessous améliorera les performances du script.

## Vérification des items

Utilise ces events **côté serveur** juste après tout ajout/retrait d'item. Ils peuvent être utilisés n'importe où, tant que tu remplaces les paramètres par les bons.

```lua theme={null}
TriggerEvent("framework:onItemAdded", playerId, itemName, itemCount)
```

```lua theme={null}
TriggerEvent("framework:onItemRemoved", playerId, itemName, itemCount)
```

### Exemples

<Note>
  Si tu utilises quelque chose qui n'est pas listé dans les exemples, sa modification est à ta charge — les events listés ci-dessus fonctionnent partout s'ils sont utilisés correctement.
</Note>

#### ESX

<Info>
  ESX par défaut a déjà `esx:onAddInventoryItem` et `esx:onRemoveInventoryItem`, ce qui signifie que tu n'auras rien à ajouter. Suis l'exemple ci-dessous uniquement si tu n'as pas ces events pour une raison quelconque.
</Info>

Va dans `es_extended/server/classes/player.lua` et ajoute le code suivant :

<Frame>
  <img src="https://mintcdn.com/jaksam/cS_rA3IcGZ7NTj0G/images/immagine-2-1.png?fit=max&auto=format&n=cS_rA3IcGZ7NTj0G&q=85&s=d88303125c9d955b51c94f033f3d6f5b" alt="ESX item added/removed hook example 1" width="652" height="299" data-path="images/immagine-2-1.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/jaksam/cS_rA3IcGZ7NTj0G/images/immagine-3.png?fit=max&auto=format&n=cS_rA3IcGZ7NTj0G&q=85&s=fb86973babfb7820b9cd00faf766d37d" alt="ESX item added/removed hook example 2" width="777" height="379" data-path="images/immagine-3.png" />
</Frame>

#### OX Inventory (ESX)

Va dans `es_extended/server/classes/overrides/oxinventory.lua` et ajoute le code suivant :

<Frame>
  <img src="https://mintcdn.com/jaksam/cS_rA3IcGZ7NTj0G/images/immagine-4-1.png?fit=max&auto=format&n=cS_rA3IcGZ7NTj0G&q=85&s=a36548992235d59e7918f046332d6745" alt="OX Inventory hook example 1" width="626" height="166" data-path="images/immagine-4-1.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/jaksam/cS_rA3IcGZ7NTj0G/images/immagine.png?fit=max&auto=format&n=cS_rA3IcGZ7NTj0G&q=85&s=68b0a99ae22a608fb20c10e6a3931907" alt="OX Inventory hook example 2" width="645" height="171" data-path="images/immagine.png" />
</Frame>

#### QBCore (dernière version)

Va dans `qb-inventory/server/main.lua` et ajoute le code suivant :

<Frame>
  <img src="https://mintcdn.com/jaksam/cS_rA3IcGZ7NTj0G/images/immagine-5-1.png?fit=max&auto=format&n=cS_rA3IcGZ7NTj0G&q=85&s=4af8bc5666aa514902387070cfb17def" alt="QBCore hook example 1" width="913" height="666" data-path="images/immagine-5-1.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/jaksam/cS_rA3IcGZ7NTj0G/images/immagine-6.png?fit=max&auto=format&n=cS_rA3IcGZ7NTj0G&q=85&s=041507c082406954f7b070ad611878d6" alt="QBCore hook example 2" width="822" height="525" data-path="images/immagine-6.png" />
</Frame>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.