[QBCORE] Vehicle rental - OPEN SOURCE

Showcase
VEHICLE RENTAL

Purchase [OPEN SOURCE]
[QBCORE] - Vehicle rental

Features

  • Easy customization
  • Rental documents (item)
  • A public or private garage can be used to store rented vehicles
  • Cancel rent
  • Add days (rent)



Optimization
Full optimized.
0.00 ms

Code is accessible Yes
Subscription-based No
Lines (approximately) : ~400
Requirements [QB] oxmysql (qb-menu, qb-target, qb-input - optional, you can adapt to your own.)
Support Yes

Other Resources

Config

Config.Target = "qb-target"
Config.KickReason = "[d3MBA-vehicle rent] | Protection"

Config.Blip = {
    Use = true, 
    Sprite = 225,
    Scale = 0.7,
    Color = 3,
}

Config.SpawnPointCheck = {
    Use = true,
    Radius = 3.5
}

Config.ExpireDelete = -1 -- 1 days after the rent is due before its deleted (default -1)


RegisterNetEvent('d3-vehicleRent:GiveCarKeys', function(vehicle, plate)
    local vehiclePlate = QBCore.Functions.GetPlate(vehicle) or plate
    -- Here you can put event or export to give player vehicle keys
    TriggerEvent("vehiclekeys:client:SetOwner", vehiclePlate) -- QB-CORE
        -- For T1GER-KEYS script use ("vehicle")
        -- exports['t1ger_keys']:SetVehicleLocked(vehicle, 0) -- If you using T1GER-KEYS script just uncoment line. 
end)

-- Fuel function if you're set "FullFuel = true" 
function fullFuel(vehicle) 
    exports["LegacyFuel"]:SetFuel(vehicle, 100) -- If you using "lj-fuel"/"ps-fuel" just replace "LegacyFuel" with "lj-fuel"/"ps-fuel"!  
end

Config.VehRent = { -- You can add more rent locations, or vehicles for rent. 
    ["lossantos"] = {
        BlipLabel = "Vehicle rent - Paleto Bay", 

        Ped = {
            Model = "mp_m_waremech_01", -- https://docs.fivem.net/docs/game-references/ped-models/
            Pos = vector4(-118.675, 6208.706, 31.201, 36.95),
            InteractDistance = 1.5,

            Animation = {
                Name = "",
                Dict = ""
            }
        }, 

        VehicleSpawnPos = vector4(-118.543, 6217.716, 30.849, 132.09),

        VehiclesMenu = {
            ["sultanrs"] = {
                label = "Sultan RS",
                price = 400, 
                img = "<img src= https://media.discordapp.net/attachments/1038535419865870406/1055526295359983736/1000.png width=45px>"
            }, 
           
        }
        
    }, 

    ["sandy"] = {
        BlipLabel = "Vehicle rent - Sandy Shores", 

        Ped = {
            Model = "mp_m_waremech_01", -- https://docs.fivem.net/docs/game-references/ped-models/
            Pos = vector4(1774.793, 3640.258, 34.544, 33.74),
            InteractDistance = 1.5,

            Animation = {
                Name = "",
                Dict = ""
            }
        }, 

        VehicleSpawnPos = vector4(1769.002, 3651.306, 33.814, 29.93),

        VehiclesMenu = {
            ["sultanrs"] = {
                label = "Sultan RS",
                price = 400, 
                img = "<img src= https://media.discordapp.net/attachments/1038535419865870406/1055526295359983736/1000.png width=45px>"
            }, 

            ["rumpo"] = {
                label = "Rumpo",
                price = 350, 
                img = "<img src= https://media.discordapp.net/attachments/1038535419865870406/1055525770266693692/1000.png width=45px>"
            }, 

            ["neon"] = {
                label = "Neon",
                price = 450, 
                img = "<img src= https://media.discordapp.net/attachments/1038535419865870406/1055526125671026738/1000.png width=45px>"
            }, 
           
        }
        
    }, 
}


Config.Notifications = {

    Settings = {
        Info = "primary", 
        Error = "error", 
        Success = "success",    
    },

    ["spawnpoint_check"] = "Spawnpoint has been blocked!",
    ["no_enough_money"] = "You don't have enough money - %s$",
    ["add_days"] = "[Vehicle rental] - Added %s days.",
    ["cancel_rent"] = "Rent for vehicle with license plate - %s canceled.",
    ["cancel_rent_error"] = "The rental of a vehicle with one or fewer rental days cannot be canceled!",
}


Config.TargetLabels = {
    ["rent_a_car"] =  "Vehicle rent",
}

Config.TargetIcons = {
    ["rent_a_car"] = "fas fa-car",
}

2 Likes

Cool script!

1 Like