13.07.2010, 04:44
you want an auto repair??
That an auto repair, when the car health is down to 400 then it repairs and it flips the car automatically after 4-6 repairs
pawn Код:
//at top
forward AutoRepair();
forward AutoFlipReset();
//OnGameModeInIt or OnFilterScriptInIt
SetTimer("AutoRepair", 1001, true);
SetTimer("AutoFlipReset", 6000, true);
//OnPlayerConnect
AutoRepairUsed[playerid] = 0;
//At Bottom and where you want
public AutoRepair()
{
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
if (IsPlayerInAnyVehicle(playerid))
{
if (AutoRepairUsed[playerid] == 3)
{
SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
AutoRepairUsed[playerid] = 0;
}
new Float:CarHP;
GetVehicleHealth(GetPlayerVehicleID(playerid), CarHP);
if (CarHP < 400)
{
new Float:X, Float:Y, Float:Z;
RepairVehicle(GetPlayerVehicleID(playerid));
GameTextForPlayer(playerid, "~y~Vehicle ~r~Auto ~y~Repaired!",2000,5);
PlayerPlaySound(playerid, 1133, X, Y, Z);
AutoRepairUsed[playerid] = AutoRepairUsed[playerid] +1;
}
}
}
return 1;
}
public AutoFlipReset()
{
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
AutoRepairUsed[playerid] = 0;
}
return 1;
}