OnVehicleDeath

From SA-MP Wiki

Jump to: navigation, search

OnVehicleDeath


This callback is called when a vehicle dies/explodes.


Parameters:
(vehicleid)
vehicleidID of the vehicle which exploded.
killeridID 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.


Related Functions

The following functions might be useful, as they're related to this callback in one way or another.