The vehicle can be repaired every 60 seconds. Help!
#4

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));
    }
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)