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

# Code Snippets

## Prevent player from exiting while their seatbelt is on

Update `HasSeatbeltOn`function in the framework file to integrate with your seatbelt script.

We provided an implementation fo qbox and qbcore by default.

Note for qbcore, `qb-smallresources/seatbelt.lua` you will need to add an export to the file.

If the following PR gets merged then you will not need to add it: <https://github.com/qbcore-framework/qb-smallresources/pull/496>

```lua
function HasSeatbeltOn()
    return seatbeltOn
end
exports("HasSeatbeltOn", HasSeatbeltOn)
```

## Prevent car theft alerts when player enters the taxi

Add this into your alerts script where carjacking alerts are triggered.

```lua
-- If the player has a taxi dispatched, dont trigger this alert 
-- as they are likely entering the taxi that was dispatched
if exports["wp-ai-taxi"]:isTaxiDispatched() then return end
```

If you are using `ps-dispatch`, look for `AddEventHandler('CEventPedJackingMyVehicle', function(witnesses, jacker)` in the cl\_eventhandlers.lua and add the snippet in here.

```lua
---@param witnesses table | Array of Ped IDs that witnessed the event
---@param jacker number | The Ped ID of the jacker
AddEventHandler('CEventPedJackingMyVehicle', function(witnesses, jacker)
    -- If AutoAlerts are disabled, don't trigger
    if not Config.Enable['Autotheft'] then return end

    -- If the player has a taxi dispatched, dont trigger this alert as they are likely entering the taxi that was dispatched
    if exports["wp-ai-taxi"]:isTaxiDispatched() then return end
   ...
end)
```
