A modern, fully-featured car rental system for FiveM servers with a beautiful UI, contract system, and automatic expiry management.
- ๐จ Modern Dark UI - Beautiful, responsive interface with smooth animations
- ๐ Digital Contracts - Usable rental contract items with all rental details
- โฐ Automatic Expiry System - Warnings before expiry and late fee management
- ๐ My Rentals Tab - Track all your active rentals in one place
- ๐ฐ Flexible Pricing - Hourly-based pricing with customizable durations
- ๐ Vehicle Keys Integration - Automatic key assignment (qb-vehiclekeys/qbx_vehiclekeys)
- ๐พ Vehicle Persistence - Rented vehicles persist across reconnects
- ๐บ๏ธ Return Location GPS - Automatic waypoint to return location on expiry
Click to view screenshots
- ox_target / qb-target / interact
- ox_inventory / qb-inventory
- qb-vehiclekeys / qbx_vehiclekeys
-
Download the resource and place it in your
resourcesfolder -
Import the SQL - Run the SQL file in your database:
-- Located in: sql/rental_history.sql -
Add to server.cfg:
ensure ox_lib ensure oxmysql ensure F4-Rental
-
Configure - Edit
config.luato customize:- Rental locations
- Available vehicles
- Rental durations
- Pricing
- And more...
-
Add required item (
rental_contract)
Add this item to your ox_inventory items file (for example ox_inventory/data/items.lua):
['rental_contract'] = {
label = 'Rental Contract',
weight = 0,
stack = false,
consume = 0,
close = true,
description = 'Vehicle rental contract',
server = {
export = 'F4-Rental.rental_contract'
}
},If you renamed this resource folder, replace
F4-Rentalwith your actual resource name.
Add this item to qb-core/shared/items.lua:
['rental_contract'] = {
['name'] = 'rental_contract',
['label'] = 'Rental Contract',
['weight'] = 0,
['type'] = 'item',
['image'] = 'rental_contract.png',
['unique'] = true,
['useable'] = true,
['shouldClose'] = true,
['description'] = 'Vehicle rental contract'
},Config.Locations = {
{
name = "Premium Rentals",
coords = vector3(-50.0, -1090.0, 26.5),
spawnPoint = vector4(-47.0, -1095.0, 26.5, 160.0),
blip = { sprite = 56, color = 5, scale = 0.8 },
},
}Config.RentalDurations = {
{ days = 1, label = "1 Hour", multiplier = 0.5, minutes = 60 },
{ days = 1, label = "3 Hours", multiplier = 0.5, minutes = 180 },
{ days = 1, label = "6 Hours", multiplier = 0.8, minutes = 360 },
{ days = 1, label = "12 Hours", multiplier = 1.0, minutes = 720 },
{ days = 1, label = "1 Day", multiplier = 1.5, minutes = 1440 },
}Config.Vehicles = {
{
model = "sultan",
label = "Sultan",
manufacturer = "Karin",
category = "Sports",
price = 500,
image = "https://docs.fivem.net/vehicles/sultan.webp",
stats = { speed = 75, acceleration = 70, braking = 65, handling = 72 },
},
}| Framework | Status |
|---|---|
| QBox (qbx_core) | โ Full Support |
| QBCore | โ Full Support |
| ESX Legacy | โ Full Support |
This resource is free to use and redistribute. Resale is not permitted.
For support, please open an issue on GitHub or contact the author
| Issue | Status |
|---|---|
| Vehicle duplication after server restart | โ Fixed |
| Multiple rentals bypass after disconnect | โ Fixed |
| Retrieve spawning duplicate vehicles | โ Fixed |
| Return not updating database | โ Fixed |
-
DoesEntityExist Script Error (interact/sleepless_interact)
- โ Fixed entity parameter validation in return vehicle event
- โ Added comprehensive type checking and conversion
- โ No more script errors when using target systems
-
Rental Data Not Deleting After Return
- โ Changed database operation from UPDATE to DELETE
- โ Rentals now properly removed from database on return
- โ Clean database without leftover rental records
-
QBCore Callback Data Handling
- โ Fixed callback bridge for QBCore framework
- โ Proper data passing between client and server
- โ DELETE operations now work correctly in QBCore
- Accurate Accounting - Late fees are added only when charge succeeds
- Retry Logic - If charge fails (insufficient funds), system retries next interval
- ๐ฏ Smart Detection - Only charges online players
- ๐๏ธ Auto-Cleanup - Offline expired rentals are deleted without fees
- ๐๏ธ Clean Records - All returns now DELETE instead of UPDATE status
- ๐ Better Performance - Fewer database records to query
- ๐ Accurate Tracking - Only active rentals in database
- ๐ Enhanced Debugging - Comprehensive debug logging for troubleshooting
- โ Better Validation - Improved entity and data validation
- ๐ Safer Operations - Proper error handling and fallbacks
// Before (Old Code)
UPDATE rental_history SET status = 'returned' WHERE id = ?
// After (New Code)
DELETE FROM rental_history WHERE id = ? AND citizenid = ?- โ Smoother return process without errors
- โ Clear balance warnings when going negative
- โ Fair system: only online players pay late fees
- โ Offline players don't accumulate charges
- Fixed proximity fallback when
TargetSystem = autoand no target script is running. - Added return interaction registration for
ox_targetandqb-target. - Synced initial vehicle spawn to server memory/database (
vehicleSpawnedflow). - Added stale
vehicle_spawnedrecovery to prevent blocked retrieval states. - Added retrieve lock/pending flow to prevent duplicate vehicle spawn race conditions.
- Plate is now generated and saved immediately on rental creation.
- Return callbacks now validate rental vehicle proof (
netId+ rental state checks). - Auto-return event now validates player ownership, vehicle state, and return proximity.
- QBX key grant now verifies rental ownership before giving keys.
- Added stronger return-location enforcement when
Config.ReturnAtAnyLocation = false.
- Improved spawned vehicle lifecycle sync on disconnect and reconnect.
- Added configurable reconnect behavior via
Config.RespawnOnReconnect. - Position save now validates ownership from database and updates reliably.
- Rental contract item is removed on successful return/cancel cleanup paths.
rental_contractinox_inventoryis now handled as non-consumable on use.- Added per-character favorites storage in NUI (
localStoragescoping). - Fixed contract duration display to correctly use minutes/hours.
- Updated price rounding consistency for rental total display.
- Late fee total now increases only when actual money removal succeeds.
- If charge fails, player is warned and the system retries on next interval.
Config.Debugdefault changed tofalsefor production.
- This demo shows the behavior when
Config.RespawnOnReconnect = true. - If the player disconnects and reconnects, the rented vehicle respawns where it was left.




