Basic Event
Description
This code adds a chat message to the chat box when any ped takes damage.
Code
JavaScript, Client-Side
addEventHandler('onPedInflictDamage', function(event,ped,entity,weapon,loss,bodyPart)
{
message('A ped lost '+loss+' HP! Body part ID: '+bodyPart);
});
Notes
The code uses addEventHandler, which is a shared function, shared means that the functionality is available both server-side and client-side.