Add VIN Generation

To enable the automatic generation of Vehicle Identification Numbers (VINs) for vehicles in your vehicleshop, some modifications to the vehicleshop system are required.


ESX Vehicleshop

Modified esx_vehicleshop

List of modifications in esx_vehicleshop

esx_vehicleshop/server/server.lua - esx_vehicleshop:setVehicleOwnedPlayerId
esx_vehicleshop/server/server.lua - esx_vehicleshop:buyVehicle


QB Vehicleshop

Modified qb-vehicleshop

List of modifications in qb-vehicleshop

qb-vehicleshop/server.lua - qb-vehicleshop:server:buyShowroomVehicle
qb-vehicleshop/server.lua - qb-vehicleshop:server:financeVehicle
qb-vehicleshop/server.lua - qb-vehicleshop:server:sellShowroomVehicle
qb-vehicleshop/server.lua - qb-vehicleshop:server:sellfinanceVehicle


Custom Vehicleshop

If you have access to the file where the sql execute is located, make modifications based on esx_vehicleshop or qb-vehicleshop.

However, if you do not have this option, but you have access to the function that is run after the purchase of the vehicle, you can enter an execute query that updates the VIN number for the vehicle, remember that you must have a reference to the database, for example, the license plate parameter

Custom locked vehicleshop

Remember that this function must be after server-side.

function YOUR_EXAMPLE_FUNCTION(plate)
    local vin = exports['vms_cityhall']:GenerateVIN()
    MySQL.Async.execute('UPDATE owned_vehicles SET vin = @vin WHERE plate = @plate', {
        ['@vin'] = vin,
        ['@plate'] = plate
    })
end

Last updated

Was this helpful?