Basic Event

From GTA Connected
Revision as of 22:14, 3 February 2019 by Mex (talk | contribs) (Created page with "{{DISPLAYTITLE:Basic Event}} == Description == This code adds a chat message to the chat box when any ped takes damage. == Code == '''JavaScript, Client-Side''' {{JSCode|1=ad...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.