Jump to content
RAGE Multiplayer Community

C# TriggerEvent is not working


Recommended Posts

Hello,

My problem is the C# TriggerEvent is not working. It's not calling the "showLoginBrowser" event. Here is the code:

        [ServerEvent(Event.PlayerConnected)]
        public void OnPlayerConnected(Client player)
        {
            Log_Server($"{player.Name} csatlakozott.");
            player.TriggerEvent("showLoginBrowser");
        }
mp.events.add('showLoginBrowser', () => {
    console.log("Browser");
    mp.gui.chat.push("a");
    var loginBrowser = mp.browsers.new('package://Login/Login.html');
    console.log("Browser created!");
});

 

Link to post
Share on other sites

If the player is connecting, you dont need any events because your client files is loading first time.

I think, that Player.Connected on server-side triggered the event before it even was loaded completly on the client.

Just put this lines out of any event and it will trigger when the client-side script is loaded

    console.log("Browser");
    mp.gui.chat.push("a");
    var loginBrowser = mp.browsers.new('package://Login/Login.html');
    console.log("Browser created!");

 

Link to post
Share on other sites
Posted (edited)

with your input you are sending result != 1 so try just for testing purposes & see if loginBrowser closes afterwards

loginBrowser.destroy(); also in else { .. here .. }

 

Edited by Division
Link to post
Share on other sites

Okay, so I run CEF debug, and I get this:

main.js:1 Uncaught TypeError: Cannot read property 'new' of undefined
    at main.js:1

main.js:1

let loginBrowser = mp.browsers.new("package://login/Login.html");

 

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...