QBCore

QBCore setup tutorial for "Advanced Ownable Rent Creator" script

This tutorial will help you disable your players to take out owned vehicles marked as rentable from the garage. If you don't manage to do it alone, please open ticket on our Discord Server.

What you need to find is function/event/callback in your garage's script server side where the script is getting all owned garage vehicles (qb-garages - "qb-garage:server:GetGarageVehicles"). Inside the function/event/callback you will find MySQL query where all vehicles from "player_vehicles" table (usually player_vehicles on qb-core) where citizenid = player's citizenid. Example:

MySQL.query('SELECT * FROM player_vehicles WHERE citizenid = ? AND garage = ? AND state = ?', {pData.PlayerData.citizenid, garage, 1}, function(result)
    if result[1] then
        cb(result)
    else
        cb(nil)
    end
end)

What you need to do is to inside the query selector add this code snippet:

AND rentable = 0

... so it shoud look like this:

MySQL.query('SELECT * FROM player_vehicles WHERE citizenid = ? AND garage = ? AND state = ? AND rentable = 0', {pData.PlayerData.citizenid, garage, 1}, function(result)
    if result[1] then
        cb(result)
    else
        cb(nil)
    end
end)

Do it for all query selectors.

Last updated