Inactive veh respawn timers

This commit is contained in:
Vortrex
2021-12-11 20:16:56 -06:00
parent a49dc41096
commit f86f1c7038

View File

@@ -107,6 +107,7 @@ function oneMinuteTimerFunction() {
function tenMinuteTimerFunction() {
showRandomTipToAllPlayers();
saveAllServerDataToDatabase();
checkInactiveVehicleRespawns();
}
// ===========================================================================
@@ -231,4 +232,15 @@ function showRandomTipToAllPlayers() {
}
}
// ===========================================================================
function checkInactiveVehicleRespawns() {
let vehicles = getElementsByType(ELEMENT_VEHICLE);
for(let i in vehicles) {
if(getCurrentUnixTimestamp() - getVehicleData(vehicles[i]).respawnTime >= getGlobalConfig().vehicleInactiveRespawnDelay) {
respawnVehicle(vehicles[i]);
}
}
}
// ===========================================================================