# Mileage System

## getMileage

With following export you can get mileage of an vehicle \[vehicle must be networked].

{% tabs %}
{% tab title="Client Side" %}
* entity `number`

```lua
exports['p_mechanicjob']:getMileage(entity)
```
{% endtab %}

{% tab title="Server Side" %}
* entity `number`

```lua
exports['p_mechanicjob']:getMileage(entity)
```
{% endtab %}
{% endtabs %}

### Example of Usage

{% tabs %}
{% tab title="Client Side" %}
```lua
local entity = GetVehiclePedIsIn(PlayerPedId(), false)
local mileage = exports['p_mechanicjob']:getMileage(entity)
print(mileage)
-- THIS CODE WILL RETURN MILEAGE OF PLAYER VEHICLE
```
{% endtab %}

{% tab title="Server Side" %}
```lua
local playerId = 1 -- replace with existing player id
local playerPed = GetPlayerPed(playerId)
local entity = GetVehiclePedIsIn(playerPed, false)
local mileage = exports['p_mechanicjob']:getMileage(entity)
print(mileage)
-- THIS CODE WILL PRINT MILEAGE OF PLAYER VEHICLE
```
{% endtab %}
{% endtabs %}

***

## formatMileage

With this export you can format vehicle mileage.

{% tabs %}
{% tab title="Client Side" %}
* mileage `number`

```lua
exports['p_mechanicjob']:formatMileage(mileage)
```
{% endtab %}

{% tab title="Server Side" %}
* mileage `number`

```lua
exports['p_mechanicjob']:formatMileage(mileage)
```
{% endtab %}
{% endtabs %}

### Example of Usage

{% tabs %}
{% tab title="Client Side" %}
```lua
local entity = GetVehiclePedIsIn(PlayerPedId(), false)
local mileage = exports['p_mechanicjob']:getMileage(entity)
local formattedMileage = exports['p_mechanicjob']:formatMileage(mileage)
print(formattedMileage)
-- THIS CODE WILL PRINT FORMATTED MILEAGE OF PLAYER VEHICLE
```
{% endtab %}

{% tab title="Server Side" %}
```lua
local playerId = 1 -- replace with existing player id
local playerPed = GetPlayerPed(playerId)
local entity = GetVehiclePedIsIn(playerPed, false)
local mileage = exports['p_mechanicjob']:getMileage(entity)
local formattedMileage = exports['p_mechanicjob']:formatMileage(mileage)
print(formattedMileage)
-- THIS CODE WILL PRINT FORMATTED MILEAGE OF PLAYER VEHICLE
```
{% endtab %}
{% endtabs %}
