SA-MP Forums Archive
Detect vehicle explosion and much more stuff - 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: Detect vehicle explosion and much more stuff (/showthread.php?tid=569657)



Detect vehicle explosion and much more stuff - bigboy81 - 01.04.2015

I want to do if the vehicle is destroyed by explosion,when player respawn car using command its car must be created destroyed..


Re: Detect vehicle explosion and much more stuff - Gammix - 01.04.2015

Use this callback: https://sampwiki.blast.hk/wiki/OnVehicleDeath
Make use of per vehicle based vars to detect if was destroyed and do your stuff.
After storing the report, use this: https://sampwiki.blast.hk/wiki/OnVehicleSpawn

pawn Код:
new bool:died[MAX_VEHICLES];

public OnVehicleDeath(vehicleid, killerid)
{
     died[vehicleid] = true;
     return 1;
}

public OnVehicleSpawn(vehicleid)
{
     if(died[vehicleid])
     {
          //Spawn it as locked with low Health
     }
     return 1;
}
* You cant spawn a vehicle as destroyed.


Re: Detect vehicle explosion and much more stuff - CalvinC - 01.04.2015

The problem with OnPlayerDeath, is the fact that it's called when the vehicle is submerged as well.
Quote:
Originally Posted by Wiki
This callback is called when a vehicle is destroyed - either by exploding or becoming submerged in water.



Re: Detect vehicle explosion and much more stuff - BleverCastard - 01.04.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
The problem with OnPlayerDeath, is the fact that it's called when the vehicle is submerged as well.
You mean OnVehicleDeath?


Re: Detect vehicle explosion and much more stuff - CalvinC - 01.04.2015

Quote:
Originally Posted by BleverCastard
Посмотреть сообщение
You mean OnVehicleDeath?
Sorry, yes i meant OnVehicleDeath.