19.01.2012, 14:28
pawn Код:
public OnGameModeInit() //or OnFilterScriptInit if its a filterscript
{
SetTimer("RepairCars", 60000, true); //We set a timer that will call the function "RepairCars" every 60000ms (~60 sec)
}
forward RepairCars();
public RepairCars() //This is the function that the timer will call
{
for(new i; i < MAX_PLAYERS; i++) //You can also use foreach, its faster and more effective :)
{
if(!IsPlayerConnected(i)) continue; //Ignores players that aren't connected
if(GetPlayerVehicleSeat(i) != 0) continue; //Ignores players that aren't in the driver seat
//Now we can repair the car...
SetVehicleHealth(GetPlayerVehicleID(i), 1000.0);
RepairVehicle(GetPlayerVehicleID(i));
}
}