Jump to content

Recommended Posts

Posted (edited)
mp.events.add('authenticate', () => {
  mp.players.local.freezePosition(true)
  // activeBrowser is a global var (global.activeBrowser)
  activeBrowser = mp.browsers.new('package://browser/authentication/index.html')
  mp.events.add('browserDomReady', () => {
    activeBrowser.execute(`setUsername("${mp.players.local.name}");`);

    mp.events.add('loginFormSubmit', (username, password) => {

      mp.events.add('authenticationResponse', (error, jwt, spawn) => {
        if (error !== null) {
          //Handle Error
          activeBrowser.execute(`loginError("${error}")`);
        } else {
          global.jwt = jwt;
          activeBrowser.destroy();

        }
        return true;
      })

      mp.events.callRemote('authenticationRequest', username, password);
      return true;
    });

    return true;
  });
  mp.gui.cursor.show(true, true);
})

Hello together,

 

ive wrote this code. Ive got 2 problems.

The first is the mp.trigger on the browser side is not working well because i cant pass variables through it.

I used it in cef like this => `mp.trigger('EVENT', param1, param2)`

The second problem is that i cant destroy the browser without an error.

Ive got a global var activeBrowser which i use all time in this script. But on activeBrowser.destroy() the error is "expected multiplayer object" 

 

I hope u can help me.

Thanks and have a nice day

Edited by despacito
  • 1 year later...
Posted (edited)

same problem:

user property is my sequalize model class with data binded

player.call("user:register", [player, user]);

trying to call this.

if(user.x && user.y && user.z){
    mp.game.player.startPlayerTeleport(user.x,user.y,user.z, 0.0, true,true,true);
}
Edited by Isigar

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