SA-MP Forums Archive
Auto Repair - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Auto Repair (/showthread.php?tid=593086)



Auto Repair - AwokenNeoX - 01.11.2015

This is my Script for Autorepair:

Код:
public AutoRepair(){
for(new i=0; i<GetMaxPlayers(); i++)
{
  if(IsPlayerConnected(i)) if(IsPlayerInAnyVehicle(i)){
	new Float:fVehicleHealth;
	GetVehicleHealth(GetPlayerVehicleID(i),fVehicleHealth);
  	if(fVehicleHealth < 900) SetVehicleHealth(GetPlayerVehicleID(i),1000.0);
  }
}
}
So if the VehicleHealth is under 900 my Vehicle has again 1000 but it is not repaired.
I want to add this in the Script : RepairVehicle


Re: Auto Repair - prineside - 01.11.2015

If you want to repair it visually, use RepairVehicle


Re: Auto Repair - YouServ - 01.11.2015

I have re-indented your code & add a return value
PHP код:
public AutoRepair()
{
    for(new 
i=0i<GetMaxPlayers(); i++)
    {
        if(
IsPlayerConnected(i)) if(IsPlayerInAnyVehicle(i))
        {
            new 
Float:fVehicleHealth;
            
GetVehicleHealth(GetPlayerVehicleID(i),fVehicleHealth);
            if(
fVehicleHealth 900SetVehicleHealth(GetPlayerVehicleID(i),1000.0), RepairVehicle(GetPlayerVehicleID(i));
        }
    }
        return 
1;




AW: Auto Repair - AwokenNeoX - 01.11.2015

That's what I mean ! Thank you [REP+]