SA-MP Forums Archive
Setvehiclehealth globally? - 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: Setvehiclehealth globally? (/showthread.php?tid=335642)



Setvehiclehealth globally? - Face9000 - 19.04.2012

Hello,i need to set to ALL vehicles health to 970.

How?


Re: Setvehiclehealth globally? - Cjgogo - 19.04.2012

pawn Code:
for(new i=0;i<MAX_VEHICLES;i++)
{
   SetVehicleHealth(i,970);
}



Re: Setvehiclehealth globally? - Face9000 - 19.04.2012

Thank you,i need to place that on OnVehicleSpawn?


Re: Setvehiclehealth globally? - Cjgogo - 19.04.2012

Yes,and when you respawn all cars,their health will be 970.


Re: Setvehiclehealth globally? - Face9000 - 19.04.2012

Nope,doesn't work,their health is always 1000.


Re: Setvehiclehealth globally? - [WSF]ThA_Devil - 19.04.2012

pawn Code:
public OnVehicleSpawn(vehicleid)
{
    SetVehicleHealth(vehicleid,970);
    return 1;
}
This should work, since every car calls this function atleast once.


Re: Setvehiclehealth globally? - Face9000 - 19.04.2012

Ah now it works,thanks.