15.03.2013, 11:43
Hello guys, i need help to make a automatic car respawn which spawns cars that are used.
I want a 2 minute timer for it.
I want a 2 minute timer for it.
CreateVehicle(541, 0, 0, 0, 10, 149,94, 120); //this 120 =2 minutes
//the timer works by the second....... after a player leaves a vehicle after 2 minutes tada
CreateVehicle(425,364.97200000,2538.03860000,17.30920000,184.00000000,37,48,15); //Hunter
CreateVehicle(425,364.97200000,2538.03860000,17.30920000,184.00000000,37,48, 120); //change 15 to 120 because 15 = 15second 120 = 120second 120/60second = 2minutes got it k bye :)
#define RESPAWN_TIME 3
OnGamemodeInit()
{
SetTimer("VehicleRespawn", RESPAWN_TIME * 50000, 1);
return 1;
}
forward VehicleRespawn();
public VehicleRespawn() {
GameTextForAll("~b~Vehicles~r~Respawn~w~!!!",4000,6);
for(new i = 0; i < MAX_VEHICLES; i ++ ) {
for(new o = 0; o < GetMaxPlayers(); o ++ ) {
if(!IsPlayerConnected(o)) continue;
if(IsAnyBodyInVehicle(i)) continue;
SetVehicleToRespawn(i);
}
}
return 1;
}
stock IsAnyBodyInVehicle(vid) {
for(new i = 0; i < GetMaxPlayers(); i ++ ) {
if(IsPlayerInVehicle(i, vid)) return 1;
}
return 0;
}