RAGE.Events.Add: Difference between revisions

From RAGE Multiplayer Wiki
Line 6: Line 6:
{{Example}}
{{Example}}
<syntaxhighlight lang="C#">
<syntaxhighlight lang="C#">
//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!");
}
</syntaxhighlight>
}}
==CEF Example==
{{CSharpContainer|
{{Parameters}}
*'''args:''': Object Array
{{Talking from CEF to Clientside}}
<syntaxhighlight lang="C#">
//In jQuery file
$(document).ready(function()
{
    $("#cbutton").click(() =>
    {
        mp.trigger("sendhelloworld", args);
    });
});


//Constructor
//Constructor

Revision as of 00:53, 27 March 2019

Example

C# Syntax

Parameters

  • args:: Object Array

Example

//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!");
}


CEF Example

C# Syntax

Parameters

  • args:: Object Array

Template:Talking from CEF to Clientside

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


//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!");
}