# Mechanic Integration

{% hint style="danger" %}
When integrating mechanics, utilize our export to repair vehicle parts with a minimum of 3 values and a maximum of 4:

1. Part name (e.g., "radiator").
2. Health Points in float number (up to 1000.0 for maximum).
3. Boolean respawn value (true/false).
4. Optional vehicle entity ID (Needs to be client sided entity id).

*<mark style="color:orange;">Avoid setting the respawn option to true unless you have specific requirements or issues.</mark>*

*<mark style="color:orange;">If no vehicle entity ID is provided, it will automatically select the closest vehicle in front of the player's camera or the one they are sitting in.</mark>*
{% endhint %}

{% tabs %}
{% tab title="Vehicle Full Fix" %}

<pre class="language-lua"><code class="lang-lua"><strong>--Without vehicle entity ID
</strong><strong>exports['realisticVehicleSystem']:fixPart("all", 1000.00, false)
</strong><strong>
</strong><strong>--With Vehicle Entity ID
</strong><strong>exports['realisticVehicleSystem']:fixPart("all", 1000.00, false, vehicle)
</strong></code></pre>

{% endtab %}

{% tab title="Specific Part Fix" %}

```lua
--Without vehicle entity ID
exports['realisticVehicleSystem']:fixPart("radiator", 1000.00, false)

--With Vehicle Entity ID
exports['realisticVehicleSystem']:fixPart("radiator", 1000.00, false, vehicle)
```

{% endtab %}

{% tab title="Deformation Only Fix" %}

```lua
--Without vehicle entity ID
exports['realisticVehicleSystem']:fixPart("deformation", 1000.00, false)

--With Vehicle Entity ID
exports['realisticVehicleSystem']:fixPart("deformation", 1000.00, false, vehicle)
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
If you wish to acquire/display the vehicle parts statistics in your resource, use our dedicated export. It necessitates just one input: the vehicle's plate, and it will provide an array containing all the vehicle's statistics.
{% endhint %}

{% tabs %}
{% tab title="Vehicle Parts Array" %}

```lua
local array = exports['realisticVehicleSystem']:getVehiclePartsArray(plate)

print("Engine:" .. array.engine)
print("Radiator:" .. array.radiator)
print("Fuel Tank:" .. array.fueltank)
...

local percentageExampleEngine = array.engine / 10
print("Engine:" .. percentageExampleEngine .. "%")
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.cisoko.net/the-complete-vehicle-system/mechanic-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
