# External Item Use Exports

External item-use exports let another resource own the gameplay behavior while Nord remains authoritative over the inventory transaction.

# Admin Studio setup

Open the item and go to:

```text
Behavior → Use behavior
```

Enable **Usable**, then select:

```text
Use handler: External export
```

Configure:

- **Resource name** — resource that exposes the handler.
- **Export name** — export function name.
- **Execution side** — `Client` or `Server`.
- **Remove on use** — whether Nord should consume the item after success.

External mode skips Nord's internal duration, animation, hand prop and stat effects.

# Client handler contract

Definition:

```lua
client = {
 export = 'UseScanner',
 remove = 0
}
```

Handler:

```lua
exports('UseScanner', function(item, slot)
 -- item.name
 -- item.label
 -- item.image
 -- item.category
 -- item.count
 -- item.weight
 -- item.metadata
 -- item.slot

 return true
end)
```

`return false` explicitly rejects the use. Returning `true` is recommended for clear success semantics.

# Server handler contract

Definition:

```lua
server = {
 export = 'UseRepairKit',
 remove = 1
}
```

Handler:

```lua
exports('UseRepairKit', function(source, item, slot, definition)
 -- validate permission/business state server-side
 return true
end)
```

Server exports execute directly on the server in current builds.

# Remove behavior

```lua
remove = 0 -- keep item
remove = 1 -- remove one after success
remove = 2 -- remove two after success, capped by stack count
```

Removal happens only after the external action is accepted.

# Existing database item

If the item is already owned by Admin Studio/database, do not try to overwrite it with `RegisterItem`.

Attach only the use handler:

```lua
exports.nord_inventory:RegisterUseExport('carplay', 'carplay', 'client')
```

Because the export name is bare, it is bound to the resource making the registration call.

# Failure behavior

The use is cancelled when:

- the target resource is not started;
- the export descriptor is invalid;
- the export throws an error;
- the export explicitly returns `false`;
- the pending use request expires;
- the player no longer owns the same item/slot instance.

Nord does not consume the item when the external use fails.
