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. ๐โจ
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!
- 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.
Make sure you have QBCore and baseevents installed
- Place the script in your
resourcesfolder. - Add
ensure vehicle-respawnto yourserver.cfg. - Customize the configuration values if needed, and youโre good to go! ๐
Hereโs an improved and clearer version of that text:
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.
- 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.
- 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.
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! ๐