About vehicle damage - 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: About vehicle damage (
/showthread.php?tid=400425)
About vehicle damage -
Dusan01 - 18.12.2012
Hy guys, i wonna to make for my RP server vhen two vehicles get crashed to vehicles engine stop working...So what i need to add if wehicle take damage about 50 hp to engine stop working...
Re: About vehicle damage -
Mike_Peterson - 18.12.2012
This is what i found after 20 second of googling
Use a timer that repeats by the way,
pawn Код:
forward carhealthcheck();
public carhealthcheck()
{
new Float:vhp;
for(new vehicleid; vehicleid<MAX_VEHICLES;vehicleid++)
{
if(GetVehicleModel(vehicleid)==0)continue;
GetVehicleHealth(vehicleid,vhp);
if(vhp<500.0)
{
SetVehicleHealth(vehicleid,350)
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
}
}
}
Re: About vehicle damage -
mineralo - 18.12.2012
use this
https://sampwiki.blast.hk/wiki/OnVehicleDamageStatusUpdate
and check, GetVehicleHealth if its less then 500 then switch off engine, the max vehicle hp is 1000 but not 100 like player's one
Re: About vehicle damage -
Dusan01 - 18.12.2012
Quote:
Originally Posted by Mike_Peterson
This is what i found after 20 second of googling
Use a timer that repeats by the way,
pawn Код:
forward carhealthcheck(); public carhealthcheck() { new Float:vhp; for(new vehicleid; vehicleid<MAX_VEHICLES;vehicleid++) { if(GetVehicleModel(vehicleid)==0)continue; GetVehicleHealth(vehicleid,vhp); if(vhp<500.0) { SetVehicleHealth(vehicleid,350) new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective); } } }
|
Recommended timer? cuz i setted 20 and not working :/
Re: About vehicle damage -
Mike_Peterson - 18.12.2012
Just set the interval to whatever you like, i would start with 500.
and set vehiclehealth to 251.
then test again.