10.06.2016, 18:35
can i respawn all the AddStaticVehicleґs if they arenґt used for like a 10 minutes?
That's why AddStaticVehicleEx exists because it has a respawn_delay parameter. It is in seconds, so set it to 600 seconds (equals to 10 minutes).
|
AddStaticVehicleEx (520, 2109.1763, 1503.0453, 32.2887, 82.2873, -1, -1, 8000);
Yes but only if the vehicle has been left, i want to make it to respawn if it arenґt used not when they left...
PLAYER ON VEHICLE - NOT RESPAWN VEHICLE ALONE 10 MINUTES - RESPAWN Donґt start the count when the player left the vehicle... |
new carResetTimer; // create a reference-variable for the timer
carResetTimer = SetTimer("CarResetTimer",600000,1); //timer that will call a callback "CarResetTimer" every 10 minutes. OnGameModeInit
KillTimer(carResetTimer); // put this OnGameModeExit , you need it
IsVehicleOccupied(vehicleid) // function to check if someone is using the vehicle. Useful if you don't want vehicles to be respawned while the player is using it. Place it outside other publics
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) // loop through every player
{
if(IsPlayerInVehicle(i, vehicleid)) return 1;
}
return 0;
}
forward CarResetTimer();
public CarResetTimer()
{
for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++) // loop through every vehicle
{
if(!IsVehicleOccupied(i)) // if the vehicle IS NOT being used at the moment!
{
SetVehicleToRespawn(i);
}
}
SendClientMessageToAll(-1, "All vehicles have been respawned!");
return 1;
}
If its not used, so what's the point to respawn it there again?
|
There are some points:
1. If a player runs into a car and moves it that way where he wants 2. If some vehicles are bugged/glitched 3. Just proper cleaning AddStaticVehicleEx won't help you at those points, only a manual respawn or an automatic via timer will help you. |