22.08.2011, 16:01
pawn Code:
new GodMode[MAX_PLAYERS];
//Under OnGameModeInit
SetTimer("AutoR", 2000, true);
//Under your Command Godmode (ON)
GodMode[playerid] = 1;
//Under your Command Godmode (OFF)
GodMode[playerid] = 0;
forward AutoR(playerid);
public AutoR(playerid)
{
if(IsPlayerInAnyVehicle(playerid) && GodMode[playerid] == 1)
{
new vid = GetPlayerVehicleID(playerid);
RepairVehicle(vid);
}
return 1;
}
pawn Code:
public AutoR(playerid)
{
if(IsPlayerInAnyVehicle(playerid) && GodMode[playerid] == 1)
{
new vid = GetPlayerVehicleID(playerid);
new Float:health;
GetVehicleHealth(vid, health);
if(health <999) // or lower....
{
RepairVehicle(vid);
}
}
}