Auto Repair
#1

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
Reply
#2

If you want to repair it visually, use RepairVehicle
Reply
#3

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;

Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)