17.01.2014, 05:40
pawn Код:
SetTimer("checkVehicleHealth", 1000, 1); //va OnGameModeInit o OnFilterScriptInit
forward checkVehicleHealth();
public checkVehicleHealth()
{
static iPlayer, iVehicleID, Float:fVehicleHealth;
iPlayer = 0;
#if defined _FOREACH_LOCAL_VERSION
foreach(iPlayer:Player)
#else
for(;iPlayer<MAX_PLAYERS;iPlayer++) if(IsPlayerConnected(iPlayer))
#endif
{
iVehicleID = GetPlayerVehicleID(iPlayer);
GetVehicleHealth(iVehicleID, fVehicleHealth);
if(fVehicleHealth < 250.0)
{
RepairVehicle(iVehicleID);
}
}
}