OnVehicleDeath
From SA-MP Wiki
OnVehicleDeath
This callback is called when a vehicle dies/explodes.
(vehicleid)
| vehicleid | ID of the vehicle which exploded. |
| killerid | ID of the player who made it explode, 255 if unknown. |
This function does not return a specific value, it's best to simply ignore it.
This is a example code to execute in callback OnVehicleDeath. It will prevent the underwater crash bug with players being in the vehicle.
public OnVehicleDeath(vehicleid, killerid) { new string[128]; format(string, sizeof(string), "Vehicle %i was destroyed by ID %i", vehicleid, killerid); if(killerid == 255) format(string, sizeof(string), "Vehicle %i was destroyed.", vehicleid); SendClientMessageToAll(0xA9A9A9AA, string); return 1; }
Related Callbacks
The following callbacks might be useful as well, as they're related to this callback in one way or another.
- OnVehicleSpawn: Called when a vehicle spawns.
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- SetVehicleHealth: Set the health of a vehicle.
