✅Garages

qb-garages/server.lua

Search this:

QBCore.Functions.CreateCallback('qb-garage:server:spawnvehicle', function (source, cb, vehInfo, coords, warp)
    local plate = vehInfo.plate
    local veh = QBCore.Functions.SpawnVehicle(source, vehInfo.vehicle, coords, warp)
    SetEntityHeading(veh, coords.w)
    SetVehicleNumberPlateText(veh, plate)
    local vehProps = {}
    local result = MySQL.query.await('SELECT mods FROM player_vehicles WHERE plate = ?', {plate})
    if result[1] then vehProps = json.decode(result[1].mods) end
    local netId = NetworkGetNetworkIdFromEntity(veh)
    OutsideVehicles[plate] = {netID = netId, entity = veh}
    cb(netId, vehProps)
end)

Replace with:

QBCore.Functions.CreateCallback('qb-garage:server:spawnvehicle', function (source, cb, vehInfo, coords, warp)
    local plate = vehInfo.plate
    if exports['m-Impound_QB']:isVehicleSeized(plate) then
        TriggerClientEvent('QBCore:Notify', source, "Your vehicle is seized!", 'error')
        return
    else
        local veh = QBCore.Functions.SpawnVehicle(source, vehInfo.vehicle, coords, warp)
        SetEntityHeading(veh, coords.w)
        SetVehicleNumberPlateText(veh, plate)
        local vehProps = {}
        local result = MySQL.query.await('SELECT mods FROM player_vehicles WHERE plate = ?', {plate})
        if result[1] then vehProps = json.decode(result[1].mods) end
        local netId = NetworkGetNetworkIdFromEntity(veh)
        OutsideVehicles[plate] = {netID = netId, entity = veh}
        cb(netId, vehProps)
    end
end)

okokGarage/sv_utils.lua

Search this:

function takeOutVehicle(db, _source, vehicle_plate, vehicle_id, index, vehicle_name, garageName, isSociety)
    if db ~= nil and db.stored == 1 then
        local vehicle = db.mods
        local tyreCondition = db.tyrecondition
        local doorCondition = db.doorcondition
        local windowCondition = db.windowcondition
        MySQLexecute('UPDATE player_vehicles SET `state` = @state, `garage` = @stategarage WHERE plate = @plate', {
            ['@state'] = 0,
            ['@stategarage'] = garageName,
            ['@plate'] = vehicle_plate,
        }, function (rowsChanged)
            if rowsChanged > 0 then
                TriggerClientEvent(Config.EventPrefix..":takeOut", _source, vehicle, vehicle_plate, vehicle_id, tyreCondition, doorCondition, windowCondition, index)
                local xPlayer = QBCore.Functions.GetPlayer(_source)
                giveKeysToPlayer(_source, xPlayer.PlayerData.citizenid, vehicle_plate, vehicle_name, isSociety)
                if Webhook ~= "" then
                    data = {
                        playerid = _source,
                        type = "takeout-vehicle",
                        info = vehicle_plate:match( "^%s*(.-)%s*$" ),
                    }

                    discordWebhook(data)
                end
            end
        end)
    elseif db ~= nil and db.stored == 0 then
        TriggerClientEvent(Config.EventPrefix..":takeOutsideVehicle", _source, vehicle_plate)
        TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_isnt_stored').title, _L('vehicle_isnt_stored').text, _L('vehicle_isnt_stored').time, _L('vehicle_isnt_stored').type)
    elseif db ~= nil and db.stored == 2 then
        TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_is_impounded').title, _L('vehicle_is_impounded').text, _L('vehicle_is_impounded').time, _L('vehicle_is_impounded').type)
    elseif db ~= nil and db.stored == 3 then
        TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_is_stolen').title, _L('vehicle_is_stolen').text, _L('vehicle_is_stolen').time, _L('vehicle_is_stolen').type)
    end
end

Replace with this:

function takeOutVehicle(db, _source, vehicle_plate, vehicle_id, index, vehicle_name, garageName, isSociety)
    if exports['m-Impound_QB']:isVehicleSeized(plate) then
        TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_isnt_stored').title, "That vehicle has been seized!", 5000, "error")
        return
    else
        if db ~= nil and db.stored == 1 then
            local vehicle = db.mods
            local tyreCondition = db.tyrecondition
            local doorCondition = db.doorcondition
            local windowCondition = db.windowcondition
            MySQLexecute('UPDATE player_vehicles SET `state` = @state, `garage` = @stategarage WHERE plate = @plate', {
                ['@state'] = 0,
                ['@stategarage'] = garageName,
                ['@plate'] = vehicle_plate,
            }, function (rowsChanged)
                if rowsChanged > 0 then
                    TriggerClientEvent(Config.EventPrefix..":takeOut", _source, vehicle, vehicle_plate, vehicle_id, tyreCondition, doorCondition, windowCondition, index)
                    local xPlayer = QBCore.Functions.GetPlayer(_source)
                    giveKeysToPlayer(_source, xPlayer.PlayerData.citizenid, vehicle_plate, vehicle_name, isSociety)
                    if Webhook ~= "" then
                        data = {
                            playerid = _source,
                            type = "takeout-vehicle",
                            info = vehicle_plate:match( "^%s*(.-)%s*$" ),
                        }

                        discordWebhook(data)
                    end
                end
            end)
        elseif db ~= nil and db.stored == 0 then
            TriggerClientEvent(Config.EventPrefix..":takeOutsideVehicle", _source, vehicle_plate)
            TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_isnt_stored').title, _L('vehicle_isnt_stored').text, _L('vehicle_isnt_stored').time, _L('vehicle_isnt_stored').type)
        elseif db ~= nil and db.stored == 2 then
            TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_is_impounded').title, _L('vehicle_is_impounded').text, _L('vehicle_is_impounded').time, _L('vehicle_is_impounded').type)
        elseif db ~= nil and db.stored == 3 then
            TriggerClientEvent(Config.EventPrefix..':notification', _source, _L('vehicle_is_stolen').title, _L('vehicle_is_stolen').text, _L('vehicle_is_stolen').time, _L('vehicle_is_stolen').type)
        end
    end
end

Last updated