Notice: Failed to invoke Pygments: [Called from MediaWiki\SyntaxHighlight\SyntaxHighlight::highlightInner in /home/pi/www/gtac/wiki/wiki/extensions/SyntaxHighlight_GeSHi/includes/SyntaxHighlight.php at line 334] in /home/pi/www/gtac/wiki/wiki/includes/debug/MWDebug.php on line 507
Basic Event - GTA Connected

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.