RAGE.Events.Add: Difference between revisions

From RAGE Multiplayer Wiki
Line 4: Line 4:
*'''args:''': Object Array
*'''args:''': Object Array


{{Example}}
{{Add Custom Events}}
<syntaxhighlight lang="C#">
<syntaxhighlight lang="C#">



Revision as of 00:55, 27 March 2019

Example

C# Syntax

Parameters

  • args:: Object Array

Template:Add Custom Events

//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

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