> For the complete documentation index, see [llms.txt](https://tgiann.gitbook.io/tgiann/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tgiann.gitbook.io/tgiann/scripts/tgiann-hotwire/exports.md).

# Exports

##

{% hint style="warning" %}
This is an ultra-realistic vehicle key system. Therefore, use the exports as recommended. If you put the `giveKey` export into every script, players will end up with hundreds of keys by the end of the day. Also, there is no `removeKey` export because this is a realistic key system. In real life, if you leave the key in the vehicle's ignition it stays there; if you take it out and put it in your pocket, it stays in your pocket, keys are not deleted. The script works exactly like this, provided you use the exports the recommended way.
{% endhint %}

## Suggestions for Export Usage

* When a player purchases or acquires a new vehicle, use the `GiveKeyVehicle` or `GiveKeyPlate` exports to give them the key.
* In your garage scripts, use the `CheckKeyInIgnitionWhenSpawn` export. This way, if the player parked the vehicle with the key in the ignition, it will spawn in the same state. If they removed the key, it will already be with the player.
* For scripts where you don’t want the key to be removable from the ignition, such as jobs or driving schools, use the `SetNonRemoveableIgnition` export.

***

## Client Exports

### CheckKeyInIgnitionWhenSpawn

If the vehicle's key is in the ignition when the vehicle is stored in the garage, and you trigger this export when retrieving the vehicle, it will put the key back in the ignition.

**You can use it to give keys in your garage script or different scripts**

**Note:** Event 'vehiclekeys:client:SetOwner' in qb triggers this export

```lua
exports["tgiann-hotwire"]:CheckKeyInIgnitionWhenSpawn(vehicle, plate)
```

#### Parameters :

<table><thead><tr><th width="183">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>vehicle</td><td>int</td><td>you don't have to use plate or vehicle data at the same time. just use one of them</td></tr><tr><td>plate</td><td>string</td><td>you don't have to use plate or vehicle data at the same time. just use one of them</td></tr></tbody></table>

***

### SetNonRemoveableIgnition

You can use this export in situations where you don't want the vehicle's key to be removed. For example, if you have a farming job and you're spawning a vehicle, you can use this export to insert the key into the ignition, preventing the player from removing it!

```lua
exports["tgiann-hotwire"]:SetNonRemoveableIgnition(vehicle, bool)
```

#### Parameters :

<table><thead><tr><th width="109">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>vehicle</td><td>int</td><td>Vehicle entity id</td></tr><tr><td>bool</td><td>bool</td><td>if true, put it on, if false, take it remove</td></tr></tbody></table>

***

### GiveKeyPlate

Gives the player the vehicle key

```lua
exports["tgiann-hotwire"]:GiveKeyPlate(plate, isNew)
```

#### Parameters :

<table><thead><tr><th width="100">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>plate</td><td>text</td><td>Vehicle plate text</td></tr><tr><td>isNew</td><td>boolen</td><td>If true, the vehicle's key id changes and old keys cannot be used</td></tr></tbody></table>

***

### GiveKeyVehicle

Gives the player the vehicle key

```lua
exports["tgiann-hotwire"]:GiveKeyVehicle(vehicle, isNew)
```

#### Parameters :

<table><thead><tr><th width="114">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>vehicle</td><td>int</td><td>Vehicle entity id</td></tr><tr><td>isNew</td><td>boolen</td><td>If true, the vehicle's key id changes and old keys cannot be used</td></tr></tbody></table>

***

### HaveKeyPlate

Returns data on whether the player has a key to the vehicle

```lua
exports["tgiann-hotwire"]:HaveKeyPlate(plate)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>plate</td><td>string</td><td>Vehicle plate text</td></tr></tbody></table>

***

### HaveKeyVehicle

Returns data on whether the player has a key to the vehicle

```lua
exports["tgiann-hotwire"]:HaveKeyVehicle(vehicle)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>vehicle</td><td>int</td><td>Vehicle entity id</td></tr></tbody></table>

***

### KeyInIgnition

Returns data on whether the key is inserted in the ignition

```lua
exports["tgiann-hotwire"]:KeyInIgnition(vehicle)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>vehicle</td><td>int</td><td>Vehicle entity id</td></tr></tbody></table>

***

### SetKeyInIgnition

Inserts or removes the key in the ignition

```lua
exports["tgiann-hotwire"]:SetKeyInIgnition(vehicle, bool)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="117">Type</th><th>Description</th></tr></thead><tbody><tr><td>vehicle</td><td>number</td><td>Vehicle entity id</td></tr><tr><td>bool</td><td>boolen</td><td>if true, put it on, if false, take it remove</td></tr></tbody></table>

***

### ChangeLockStatus

Change the vehicle lock status

```lua
exports["tgiann-hotwire"]:ChangeLockStatus(status, vehicle)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="117">Type</th><th>Description</th></tr></thead><tbody><tr><td>status</td><td>number</td><td><p></p><pre class="language-cpp"><code class="lang-cpp">enum eVehicleLockState {
// No specific lock state, vehicle behaves according to the game's default settings.
VEHICLELOCK_NONE = 0,
// Vehicle is fully unlocked, allowing free entry by players and NPCs.
VEHICLELOCK_UNLOCKED = 1,
// Vehicle is locked, preventing entry by players and NPCs.
VEHICLELOCK_LOCKED = 2,
// Vehicle locks out only players, allowing NPCs to enter.
VEHICLELOCK_LOCKOUT_PLAYER_ONLY = 3,
// Vehicle is locked once a player enters, preventing others from entering.
VEHICLELOCK_LOCKED_PLAYER_INSIDE = 4,
// Vehicle starts in a locked state, but may be unlocked through game events.
VEHICLELOCK_LOCKED_INITIALLY = 5,
// Forces the vehicle's doors to shut and lock.
VEHICLELOCK_FORCE_SHUT_DOORS = 6,
// Vehicle is locked but can still be damaged.
VEHICLELOCK_LOCKED_BUT_CAN_BE_DAMAGED = 7,
// Vehicle is locked, but its trunk/boot remains unlocked.
VEHICLELOCK_LOCKED_BUT_BOOT_UNLOCKED = 8,
// Vehicle is locked and does not allow passengers, except for the driver.
VEHICLELOCK_LOCKED_NO_PASSENGERS = 9,
// Vehicle is completely locked, preventing entry entirely, even if previously inside.
VEHICLELOCK_CANNOT_ENTER = 10
};
</code></pre></td></tr><tr><td>vehicle</td><td>number</td><td>Vehicle entity id</td></tr></tbody></table>

***

### ChangeEngineStateButton

Triggers the function of the button you use to turn the vehicle start and stop.

```lua
exports["tgiann-hotwire"]:ChangeEngineStateButton(bool)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="117">Type</th><th>Description</th></tr></thead><tbody><tr><td>bool?</td><td>boolean</td><td>If the value is nill, it is started or stopped depending on the engine status</td></tr></tbody></table>

***

## Server Exports

### CheckKeyInIgnitionWhenSpawn

If the vehicle's key is in the ignition when the vehicle is stored in the garage, and you trigger this export when retrieving the vehicle, it will put the key back in the ignition.

**You can use it to give keys in your garage script or different scripts**

```lua
exports["tgiann-hotwire"]:CheckKeyInIgnitionWhenSpawn(netid, vehicle)
```

#### Parameters :

<table><thead><tr><th width="183">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>netid</td><td>int</td><td>Vehicle Net Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr><tr><td>entity</td><td>int</td><td>Vehicle Entity Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr></tbody></table>

***

### SetNonRemoveableIgnition

You can use this export in situations where you don't want the vehicle's key to be removed. For example, if you have a farming job and you're spawning a vehicle, you can use this export to insert the key into the ignition, preventing the player from removing it!

```lua
exports["tgiann-hotwire"]:SetNonRemoveableIgnition(netid, entity, bool)
```

#### Parameters :

<table><thead><tr><th width="109">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>netid</td><td>int</td><td>Vehicle Net Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr><tr><td>entity</td><td>int</td><td>Vehicle Entity Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr><tr><td>bool</td><td>bool</td><td>if true, put it on, if false, take it remove</td></tr></tbody></table>

***

### GiveKeyPlate

Gives the player the vehicle key

```lua
exports["tgiann-hotwire"]:GiveKeyPlate(src, plate, isNew)
```

#### Parameters :

<table><thead><tr><th width="100">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>src</td><td>int</td><td>Player source</td></tr><tr><td>plate</td><td>text</td><td>Vehicle plate text</td></tr><tr><td>isNew</td><td>boolen</td><td>If true, the vehicle's key id changes and old keys cannot be used</td></tr></tbody></table>

***

### KeyInIgnition

Returns data on whether the key is inserted in the ignition

```lua
exports["tgiann-hotwire"]:KeyInIgnition(netid, entity)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td>netid</td><td>int</td><td>Vehicle Net Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr><tr><td>entity</td><td>int</td><td>Vehicle Entity Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr></tbody></table>

***

### SetKeyInIgnition

Inserts or removes the key in the ignition

```lua
exports["tgiann-hotwire"]:SetKeyInIgnition(netid, entity, bool)
```

#### Parameters :

<table><thead><tr><th width="208">Name</th><th width="117">Type</th><th>Description</th></tr></thead><tbody><tr><td>netid</td><td>int</td><td>Vehicle Net Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr><tr><td>entity</td><td>int</td><td>Vehicle Entity Id (You don't have to use netid or vehicle data at the same time. just use one of them)</td></tr><tr><td>bool</td><td>boolen</td><td>if true, put it on, if false, take it remove</td></tr></tbody></table>

***
