27.01.2010, 10:32
Hi,
With the vehicle auto-repair code below, is it ok to have the timer starting OnGameModeInit and running all the time? I know the timer is stopping at the if statements, i just wonder if there is a better way.
With the vehicle auto-repair code below, is it ok to have the timer starting OnGameModeInit and running all the time? I know the timer is stopping at the if statements, i just wonder if there is a better way.
Код:
public OnGameModeInit() { SetTimer("autorepair", 2000, 1); return 1; } // Function AUTOREPAIR (Includes Bodywork) forward autorepair(); public autorepair() { for(new playerid=0; playerid<MAX_PLAYERS; playerid++) { SendClientMessage(playerid, 0xFFFFFFFF, "Vehicle Repair"); if(GetPlayerState(playerid) == 2) { SendClientMessage(playerid, 0xFFFFFFFF, "Vehicle Repair: Driver In Vehicle"); new Float:health, cid; cid = GetPlayerVehicleID(playerid); GetVehicleHealth(cid, health); if (health < 990) { RepairVehicle(cid); SendClientMessage(playerid, 0xFFFFFFFF, "Vehicle Repair: Vehicle Repaired"); } } } return 1; } // End of AUTOREPAIR (Includes Bodywork)