Saving damaged vehicles - 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: Saving damaged vehicles (
/showthread.php?tid=615514)
Saving damaged vehicles -
martoivanov - 23.08.2016
Hello,
Is there a way to spawn a vehicle which is damaged like this:
http://prikachi.com/images/735/8885735f.png and when I respawn the vehicles to be again damaged?
Thanks!
Re: Saving damaged vehicles -
Shinja - 23.08.2016
I't would be something like
PHP код:
new engine[MAX_VEHICLES], lights[MAX_VEHICLES], alarm[MAX_VEHICLES], doors[MAX_VEHICLES], bonnet[MAX_VEHICLES], boot[MAX_VEHICLES], objective[MAX_VEHICLES];
PHP код:
public OnVehicleSpawn(vehicleid)
{
SetVehicleParamsEx(vehicleid, engine[vehicleid], lights[vehicleid], alarm[vehicleid], doors[vehiceid], bonnet[vehicleid], boot[vehicleid], objective[vehicleid]);
}
Re: Saving damaged vehicles -
Abagail - 23.08.2016
Quote:
Originally Posted by Shinja
Код:
SetVehicleParamsEx(vehicleid, engine[vehicleid], lights[vehicleid], alarm[vehicleid], doors[vehiceid], bonnet[vehicleid], boot[vehicleid], objective[vehicleid]);
|
SetVehicleParamsEx doesn't really control damage, it controls the open/closed state of the vehicle(ex: if the doors are locked, doors will be 1). You should use GetVehicleDamageStatus, along with UpdateVehicleDamageStatus to get and control vehicle damage.
Refer to:
https://sampwiki.blast.hk/wiki/GetVehicleDamageStatus
https://sampwiki.blast.hk/wiki/UpdateVehicleDamageStatus