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=512168)
Vehicle Health -
Pepino960 - 09.05.2014
Hello Guys,
as u may know the vehicles on sa (in my opinion...) havnt got much hp.
so ive tried to make having about 15000 hp instead of 1000 hp but ist not going to work so, anyhelp be nice?
or even if u found some script u may can post them up?
Heres my code
PHP код:
public OnVehicleSpawn(vehicleid)
{
if(GetVehicleModel(vehicleid) < 611)
{
SetVehicleHealth(vehicleid, 15000.0);
return 1;
}
return 1;
}
Re: Vehicle Health -
arakuta - 09.05.2014
This works. OnVehicleSpawn is called only when a vehicle RE-SPAWN. Not when it gets created with CreateVehicle or AddStaticVehicle.
AW: Vehicle Health -
Pepino960 - 09.05.2014
uhh damn, thanks :/
AW: Vehicle Health -
Pepino960 - 09.05.2014
so OnGameModeInit ye?
Re: Vehicle Health -
Bingo - 09.05.2014
Create vehicle re-spawner using timer.
Then you can but this works too.
Re: AW: Vehicle Health -
arakuta - 09.05.2014
Quote:
Originally Posted by Pepino960
uhh damn, thanks :/
|
You may respawn it right after it gets created, or use SetVehicleHealth.
You can also create a function that automatically Add vehicles, then set their health.
pawn Код:
stock AddReinforcedCar(modelid,Float:spawn_x,Float:spawn_y,Float:spawn_z,Float:angle,color1,color2,respawn_delay = 0,Float:health = 100.0);
{
new carid = AddStaticVehicleEx(modelid,spawn_x,spawn_y,spawn_z,angle,color1,color2,respawn_delay);
SetVehicleHealth(carid,health);
return carid;
}
Now just use:
pawn Код:
AddReinforcedCar(modelid,Float:spawn_x,Float:spawn_y,Float:spawn_z,Float:angle,color1,color2,respawn_delay,Float:health); // Where health are optional.
AW: Vehicle Health -
Pepino960 - 09.05.2014
got it, done by timer
/CLOSE
Re: AW: Vehicle Health -
Bingo - 09.05.2014
Quote:
Originally Posted by Pepino960
got it, done by timer
/CLOSE 
|
Oh yeah

Good.