OnVehicleDamageStatusUpdate

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 23:18, 12 May 2015
MP2 (Talk | contribs)

← Previous diff
Revision as of 23:20, 12 May 2015
MP2 (Talk | contribs)

Next diff →
Line 29: Line 29:
} }
</pawn> </pawn>
 +
 +{{Tip|For some useful functions for working with vehicle damage values, see [[DamageStatus|here]].}}
{{RelatedFunctionsCallback}} {{RelatedFunctionsCallback}}

Revision as of 23:20, 12 May 2015



OnVehicleDamageStatusUpdate was added in SA-MP 0.3a This callback was added in SA-MP 0.3a and will not work in earlier versions!


Description:

This callback is called when a vehicle element such as doors, tires, panels, or lights get damaged.


Image:32px-Ambox_warning_orange.png

Note

This does not include vehicle health changes


Parameters:
(vehicleid, playerid)
vehicleidThe ID of the vehicle that was damaged.
playeridThe ID of the player who synced the damage (who had the car damaged).


Return Values:

This callback does not handle returns.


Example Usage: Prevent tire popping

public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{	
    // Get the damage status of all the components
    new panels, doors, lights, tires;	
    GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
 
    // Set the tires to 0, which means none are popped
    tires = 0;
 
    // Update the vehicle's damage status with unpopped tires
    UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
    return 1;	
}
Tip

Image:Light_bulb_icon.png

For some useful functions for working with vehicle damage values, see here.


Related Functions

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

In other languages