Skip to content

FIVEM - Vehicle Respawn Script / Prevent Vehicle Despawning

License

Notifications You must be signed in to change notification settings

ogidevs/vehicle-respawn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

I was fed up with paid resources for basic functionality, so I created a vehicle respawn script for QBCore and decided to release it for free. ๐Ÿš—โœจ

๐Ÿ“œ What Does It Do?

This script helps keep vehicles in the world even if they despawn! It checks for vehicles that have despawned and respawns them with the same properties and at the same location as long as thereโ€™s a player nearby (minimum distance configurable). Perfect for ensuring vehicles donโ€™t just vanish without reason during RP!

๐Ÿ”ง Features:

  • Automatic respawn of despawned vehicles with the exact same location and properties.
  • Configurable check timer (default: every 2 minutes).
  • Ensures respawn only happens if no players are within 100 meters (configurable).
  • Lightweight and optimized for performance.
  • Built for QBCore servers, but can be easily adjusted for others.

๐Ÿ“‚ Installation:

Make sure you have QBCore and baseevents installed

  1. Place the script in your resources folder.
  2. Add ensure vehicle-respawn to your server.cfg.
  3. Customize the configuration values if needed, and youโ€™re good to go! ๐Ÿš™
    Hereโ€™s an improved and clearer version of that text:

โš ๏ธ IMPORTANT NOTICE โš ๏ธ

To ensure proper functionality, you must call:
TriggerServerEvent('Ogi-NoDespawn:Server:RemoveVehicleNoDespawn', vehPlate)
before using any DeleteVehicle native in your client scripts. This also applies for any serverside scripts that uses the mentioned native.

This step is crucial to prevent issues with vehicle still respawning after deletion. Make sure to integrate it into every script where vehicles are being deleted.

๐Ÿ› ๏ธ How It Works:

  • Every [configurable interval], the script checks if any vehicles have despawned.
  • If a despawned vehicle is detected and thereโ€™s a player within the set radius (default: 100 meters), it respawns the vehicle at its last known location with all its properties intact.

๐Ÿ“ Notes:

  • This script is not a despawn prevention tool but rather a respawn solution for despawned vehicles.
  • Tested on QBCore with excellent performance โ€” should work on most setups with minor adjustments.

๐Ÿ’ฌ Feedback & Support:

Iโ€™d love to hear your feedback or suggestions! If you run into issues, drop a comment below or create an issue on the GitHub repo. Contributions are always welcome! ๐Ÿ™Œ

About

FIVEM - Vehicle Respawn Script / Prevent Vehicle Despawning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages