#include <a_samp>
#include <zcmd>
public OnFilterScriptInit() return SetTimer(\"AutoFix\", 1000, true), 1;
CMD:autorepair(playerid, params[]) {
if(!GetPVarInt(playerid, \"AutoRepair\")) {
SetPVarInt(playerid, \"AutoRepair\", 1);
} else {
SetPVarInt(playerid, \"AutoRepair\", 0);
}
SendClientMessage(playerid, -1, GetPVarInt(playerid, \"AutoRepair\")?(\"AutoRepair On\"):(\"AutoRepair Off\"));
return 1;
}
forward AutoFix();
public AutoFix() {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(!IsPlayerConnected(i)) continue;
if(!IsPlayerInAnyVehicle(i)) continue;
if(!GetPVarInt(i, \"AutoRepair\")) continue;
RepairVehicle(GetPlayerVehicleID(i));
}
return 1;
}