gp_visum/configs/config.lua
-- (Server)
-- Simple function to add the visum vehicle to a player
Config.addVehicleToOwner = function(src, plate, visumVehicleData)
local player = QBCore.Functions.GetPlayer(src)
MySQL.Async.execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate, @garage, @state)',
{
['@license'] = player.PlayerData.license,
['@citizenid'] = player.PlayerData.citizenid,
['@vehicle'] = visumVehicleData.vehicleModel,
['@hash'] = GetHashKey(visumVehicleData.vehicleModel),
['@mods'] = json.encode({model = GetHashKey(visumVehicleData.vehicleModel), plate = plate}),
['@plate'] = plate,
['@garage'] = "pillboxgarage",
['@state'] = "0",
}, function(rowsChanged)
Config.debug("Added vehicle to player " .. visum.getPlayerName(src) .. " with plate " .. plate)
-- Add key to the user with the given plate and source
Config.addVehicleKeys(src, plate, visumVehicleData.vehicleName)
end)
end