RAGE.Events.Add: Difference between revisions

From RAGE Multiplayer Wiki
Line 1: Line 1:
==Syntax==
==Syntax==
{{Shared}}
{{Client-Side}}
<syntaxhighlight lang="C#">
<syntaxhighlight lang="C#">
RAGE.Events.Add(string eventname, object[] args)
RAGE.Events.Add(string eventname, object[] args)
</syntaxhighlight>
</syntaxhighlight>


==Add Custom Events==
{{CSharpContainer|
{{Parameters}}
*'''args:''': Object Array
{{Example}}
<syntaxhighlight lang="C#">
//Constructor
public main()
{
  //Call the custom event
  RAGE.Events.Add("sendhelloworld", SendHelloWorld);
}
//Method for the custom event
public void SendHelloWorld(object[] args)
{
    Chat.Output("HELLO WORLD!");
}
</syntaxhighlight>
}}


==Add Custom Events==
==Add Custom Events==

Revision as of 01:00, 27 March 2019

Syntax

Template:Client-Side

RAGE.Events.Add(string eventname, object[] args)


Add Custom Events

C# Syntax

Parameters

  • args:: Object Array

Example

//Constructor
public main()
{
   //Call the custom event
   RAGE.Events.Add("sendhelloworld", SendHelloWorld);
}

//Method for the custom event
public void SendHelloWorld(object[] args)
{
    Chat.Output("HELLO WORLD!");
}


Add Custom Events

C# Syntax

Parameters

  • args:: Object Array

Example

//Constructor
public main()
{
   //Call the custom event
   RAGE.Events.Add("sendhelloworld", SendHelloWorld);
}

//Method for the custom event
public void SendHelloWorld(object[] args)
{
    Chat.Output("HELLO WORLD!");
}


CEF Example

C# Syntax

Parameters

  • args:: Object Array

Example

//In jQuery file linked to your CEF.
$(document).ready(function()
{
    $("#cbutton").click(() =>
    {
        mp.trigger("sendhelloworld", args);
    });
});

//In C# Client Side File
//Constructor
public main()
{
   //Once this custom event has been added you can also call it from CEF(Chromium Embedded Framework)
   RAGE.Events.Add("sendhelloworld", SendHelloWorld);
}

public void SendHelloWorld(object[] args)
{
    Chat.Output("HELLO WORLD!");
}