SA-MP Forums Archive
vehicle health - 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: vehicle health (/showthread.php?tid=555156)



vehicle health - cyberlord - 06.01.2015

Hello can some1 help my with this i made timer for 1 sec that count vehicle health but it still not working properly and i dont thing i could do something about it , so now i have this code :

Код:
public carcheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
           new vehicle, Float:health;
           vehicle = GetPlayerVehicleID(i);
           GetVehicleHealth(vehicle, health);
           if(health <= 250)
           {
           		RemovePlayerFromVehicle(i);
           		health += 75;
                SetVehicleHealth(vehicle, health);
   
           }
     }
     return 1;
}
its a timer everything on this code , the prolem is like i cant get right value of health to add cuz is blows even with +80 and sometimes with +75 not its depend on how hard u hit and lose health so , i need some alternative code that helps my to increase vehicle burning time


Re: vehicle health - Rufio - 06.01.2015

Hello there!

The problem is, vehicle already blows once it reaches like ~350 health, I am not so sure about that, you might want to increase the minimum health.

Edit: Do it something like this;

pawn Код:
public carcheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
           new vehicle, Float:health;
           vehicle = GetPlayerVehicleID(i);
           GetVehicleHealth(vehicle, health);
           if(health <= 480)
           {
                RemovePlayerFromVehicle(i);
                health += 75;
                SetVehicleHealth(vehicle, health);
   
           }
     }
     return 1;
}
Edit 2; About your second question regarding increasing burning time, it isn't possible as far as I know, so I can't help about that.


Re: vehicle health - cyberlord - 06.01.2015

you know car starts burning at 250 or less if i set 450 its goes just smoke


Re: vehicle health - Rufio - 06.01.2015

Then make it lower for your needs, but 250 burns it, even 350 does.


Re: vehicle health - cyberlord - 06.01.2015

will try to use flame object instead and just set a new timer that will bow a car after some time


Re: vehicle health - Dignity - 06.01.2015

Quote:
Originally Posted by Rufio
Посмотреть сообщение
but 250 burns it, even 350 does.
Not true. A vehicle is only put on fire when it's health is lower than 250.


Re: vehicle health - Rufio - 06.01.2015

Quote:
Originally Posted by Rufio
Посмотреть сообщение
Hello there!

The problem is, vehicle already blows once it reaches like ~350 health, I am not so sure about that, you might want to increase the minimum health.

Edit: Do it something like this;

pawn Код:
public carcheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
           new vehicle, Float:health;
           vehicle = GetPlayerVehicleID(i);
           GetVehicleHealth(vehicle, health);
           if(health <= 480)
           {
                RemovePlayerFromVehicle(i);
                health += 75;
                SetVehicleHealth(vehicle, health);
   
           }
     }
     return 1;
}
Edit 2; About your second question regarding increasing burning time, it isn't possible as far as I know, so I can't help about that.
Thanks for warning, tho'.


Re: vehicle health - cyberlord - 06.01.2015

yes its get on fire only if its less 250 https://sampwiki.blast.hk/wiki/VehicleHealth