Refresh player owned vehicles

Refresh player owned vehicles

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)

Event

exports["vehicles_keys"]:refreshPlayerOwnedVehicles(playerId, instantly)

Parameters

Give keys to identifier

NameData TypeDescription

playerId

integer

The player server ID

instantly

boolean

OPTIONAL - By default, it will wait 2 seconds before actually refreshing, if you know for sure that you need it instantly, pass true as second parameter, otherwise can be empty

Example

RegisterNetEvent("vehicle_shop:playerBoughtVehicle", function(playerId, plate)
    -- This will refresh the player's owned vehicles after he buys a vehicle (just an example)

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

Last updated