Events::Event

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

Shared
Function

Js.png JavaScript


OOP constructor of Events' add function

JavaScript Syntax
Jslogo.png

Syntax

let ev = new mp.Event(name, functionHandler);

Required arguments

  • name: String
  • functionHandler: Void

Returned value

  • Event Handler

Example

let ev = new mp.Event("playerDeath", (player, reason, killer) =>
{
    mp.players.broadcast('First blood!');
    ev.destroy(); // this event handler will be not called anymore since it's destroyed
});
ev.destroy(); // due to this line the event is never going to be executed if we call this before it


See Also