Events::remove

From RAGE Multiplayer Wiki
Revision as of 10:31, 11 November 2019 by Unknown (talk | contribs) (Created page with "{{ServersideJsFunction}} __TOC__ Removes the specified event from events tree. == Syntax == <pre> mp.events.remove("eventName"); // Removes all eventName instances mp.event...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Server-Side
Function

 JavaScript



Removes the specified event from events tree.

Syntax

mp.events.remove("eventName"); // Removes all eventName instances
mp.events.remove("eventName", functionInstance); // Removes specified event instance.
mp.events.remove(["eventName1", "eventName2"]); // Removes all specified events instances.

Example

Server-Side
function onPlayerDeath(player, reason, killer){
  console.log(player.name + " died.");
  mp.events.remove("playerDeath", onPlayerDeath); // Once someone died, remove the event.
}
mp.events.add("playerDeath", onPlayerDeath);

See Also