ScriptingExamples/BasicEvent: Difference between revisions
Jump to navigation
Jump to search
(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...") |
(No difference)
|
Latest revision as of 22:14, 3 February 2019
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.