Sign in to follow this  
Vrael

Login script

Recommended Posts

Hello,

i found a tutorial here for a login script and im trying to get it working.

Client-side:

Spoiler
var loginBrowser = mp.browsers.new('package://Login/Login.html');
mp.gui.cursor.show(truetrue);
 
mp.events.add('loginInformationToServer', (usernamepassword=> {
    mp.events.callRemote('OnPlayerLoginAttempt'usernamepassword);
});

 

now i try to catch the username and password wich was send to the server by trying this:

Spoiler
mp.events.add("OnPlayerLoginAttempt"usernamepassword => {
 
console.log("Username: " + username"Passwort: " + password );
 
});

 

the first problem is, when i start the server i do get this errors:

Spoiler

Error: ReferenceError: username is not defined
    at Object.<anonymous> (C:\RAGEMP\server-files\packages\****\events\OnPlayerLogin.js:1:102)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\RAGEMP\server-files\packages\****\index.js:8:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)

 

why do i always get these kind of "is not defined" errors?

 

 

Share this post


Link to post
Share on other sites

You are missing the parenthesis on server params (username, password)

Share this post


Link to post
Share on other sites
Am 22.10.2019 um 07:48 schrieb Xabi:

You are missing the parenthesis on server params (username, password)

what do u exactly mean?

and how do i need to do it?

Share this post


Link to post
Share on other sites
2 minutes ago, Vrael said:

what do u exactly mean?

and how do i need to do it?

He wrote how to do it, needs to be (username, password) and not just username, password

mp.events.add("OnPlayerLoginAttempt", (username, password) => {

Share this post


Link to post
Share on other sites
vor 18 Stunden schrieb MrPancakers:

He wrote how to do it, needs to be (username, password) and not just username, password

mp.events.add("OnPlayerLoginAttempt", (username, password) => {

Oh now i get it.

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.