> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Refresh player owned vehicles

> Refresh a player's owned vehicles list server side, for example after a purchase.

Using this export (from server side) will refresh the list of the player's owned vehicles (from `owned_vehicles` on ESX or `player_vehicles` on QBCore).

```lua Export theme={null}
exports["vehicles_keys"]:refreshPlayerOwnedVehicles(playerId, instantly)
```

### Parameters

| Name        | Data Type | Description                                                                                                                                       |
| ----------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `playerId`  | integer   | The player server ID                                                                                                                              |
| `instantly` | boolean   | Optional. By default, it waits 2 seconds before refreshing. If you know for sure you need it instantly, pass `true`, otherwise it can be omitted. |

### Example

```lua theme={null}
RegisterNetEvent("vehicle_shop:playerBoughtVehicle", function(playerId, plate)
    -- This will refresh the player's owned vehicles after they buy a vehicle (just an example)

    exports["vehicles_keys"]:refreshPlayerOwnedVehicles(playerId)
end)
```


## Related topics

- [Server](/vehicles-keys/server/index.md)
- [Refresh self owned vehicles](/vehicles-keys/client/refresh-self-owned-vehicles.md)
- [FAQ](/vehicles-keys/faq.md)
- [Fix hotwiring bought car](/vehicles-keys/fix-hotwiring-bought-car.md)
- [Get owned plates of local player](/vehicles-keys/client/get-owned-plates-of-local-player.md)
