Floriian Posted May 5, 2020 Posted May 5, 2020 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!"); });
Division Posted May 6, 2020 Posted May 6, 2020 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!");
Floriian Posted May 6, 2020 Author Posted May 6, 2020 I think, is better way, to show my problem in video...
Division Posted May 6, 2020 Posted May 6, 2020 (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 May 6, 2020 by Division
Floriian Posted May 6, 2020 Author Posted May 6, 2020 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");
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now