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

# Usage

### Exports

#### Start Mission (Server-Sided)

```lua
exports["petris-npctaximission"]:StartNPCTaxiMission(playerId)
```

#### Stop Mission (Server-Sided)

```lua
exports["petris-npctaximission"]:StopNPCTaxiMission(playerId)
```

### Routes Configuration

```lua
Routes = { -- INFO: It will pick a random route every time the export function is triggered. 
        {   
            ["PickUp"] = vector4(-1378.91, -74.53, 51.29, 12.091267585754),
            ["Destination"] = vector3(1004.13, -700.54, 55.87), 
        },
        {   
            ["PickUp"] = vector4(-352.58, -1445.13, 28.43, 5.0990152359009),
            ["Destination"] = vector3(1110.72, -1444.34, 34.58), 
        },
        {   
            ["PickUp"] = vector4(374.12, -415.62, 44.97, 36.246059417725),
            ["Destination"] = vector3(-98.43, 6295.35, 29.9), 
        },
        {   
            ["PickUp"] = vector4(-2113.15, -350.84, 12.05, 158.67686462402),
            ["Destination"] = vector3(299.05, -234.87, 52.46), 
        },
        {   
            ["PickUp"] = vector4(-1412.03, -567.61, 29.37, 216.83416748047),
            ["Destination"] = vector3(-408.76, 1199.92, 324.65), 
        },
        {   
            ["PickUp"] = vector4(285.46, 1092.02, 215.63, 304.25314331055),
            ["Destination"] = vector3(236.27, 3102.8, 41.42), 
        },
    },
```

{% hint style="info" %}
You can add as many possible routes as you want. They will be chosen randomly once the mission starts.
{% endhint %}

### Open Framework Functions

{% code fullWidth="false" %}

```lua
Functions = {
        CanStart = function(playerId)
            -- You can add any terms here.
            return true
        end,
        GetIdentifier = function(playerId)
            -- ESX EXAMPLE
            local xPlayer = Config.Framework.GetPlayerFromId(playerId)
            return xPlayer.identifier
        end,
        SendNotification = function(playerId, text)
            TriggerClientEvent('esx:showNotification', playerId, text)
        end,
        PayDriver = function(driverId, reward)
            local xPlayer = Config.Framework.GetPlayerFromId(driverId)
            xPlayer.addAccountMoney('money', reward, 'Taxi Mission')
        end
    }
```

{% endcode %}

{% hint style="info" %}
We've added <mark style="color:orange;">ESX functionality</mark> as it's the most popular framework right now, <mark style="color:green;">but you can use any framework</mark> and make the script work.\
\
If you need extra assistance, please don't hesitate to open a ticket on my [Discord Server.](https://discord.gg/x4487hW9FC)
{% endhint %}
