SA-MP Forums Archive
[help]vehicle health on all cars - 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: [help]vehicle health on all cars (/showthread.php?tid=569747)



[help]vehicle health on all cars - PSYCHOBABYKILLA - 02.04.2015

sorry i dont have a code to post im pretty tired i tried just about every code i seen here and on ****** and nothing seems to work

i want all vehicles to spawn with more health

help please


Re: [help]vehicle health on all cars - CalvinC - 02.04.2015

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    SetVehicleHealth(vehicleid, amount);
    return 1;
}
The default vehicles spawn with is 1000, so you want to give them more than that.

https://sampwiki.blast.hk/wiki/OnVehicleSpawn
https://sampwiki.blast.hk/wiki/SetVehicleHealth


Re: [help]vehicle health on all cars - Konstantinos - 02.04.2015

Except from OnVehicleSpawn callback CalvinC posted (which is whenever a vehicle re-spawns), it'd be better to make your own functions when a vehicle is created or even hook those functions so it'll set the health itself.


Re: [help]vehicle health on all cars - PSYCHOBABYKILLA - 02.04.2015

LAST EDIT: i got it to work with

public OnVehicleStreamIn(vehicleid, forplayerid)
{

SetVehicleHealth(modelid, 5000);
return 1;
}

but i had to run it on a filterscript otherwise it wouldnt work it would compile i tried everything and i tried onvehiclestreamin already but it was my gamemode variables i guess


EDIT: lol just when i thought i got it all figured out walk in and out of a checkpoint and vehicle health is back up to 5000