Jump to content
RAGE Multiplayer Community

C# Bridge Trigger .js Client Package?


Bodymenn
 Share

Recommended Posts

Hey guys , is it possible to trigger a Client Package Function with a C# Brdige Command? 
 

C# Bridge

        [Command("command")]
        public void command(Client player, String color)
        {
            //THE CALL TO .js CLIENT PACKAGE?
        }

JS Client Package

function test(test, color) {

}


I hope u guys know what i mean :3

Link to comment
Share on other sites

You should create an event on clientside which triggers your function when you call it. Also, you can call it using "TriggerEvent" on the serverside.

JS Client Side:

mp.events.add("TEST_EVENT", (test, color) => test(test, color));
        [Command("command")]
        public void command(Client player, String test, String color)
        {
            player.TriggerEvent("TEST_EVENT", test, color); //You can use it as an OOP method
        }

If you need more information about these functions, you can check links below:

https://wiki.gtanet.work/index.php?title=TriggerClientEvent

https://wiki.rage.mp/index.php?title=Events::add

Edited by Original
  • Like 1
Link to comment
Share on other sites

i tried , but nothing happend.

 

mp.events.add("TEST", (player, color) => {
        player.outputChatBox("Test");
});
        [Command("test")]
        public void Test(Client player, int color)
        {
            player.TriggerEvent("TEST", player, color);
        }

 

Edited by Bodymenn
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...