Vrael Posted October 21, 2019 Posted October 21, 2019 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(true, true); mp.events.add('loginInformationToServer', (username, password) => { mp.events.callRemote('OnPlayerLoginAttempt', username, password); }); now i try to catch the username and password wich was send to the server by trying this: Spoiler mp.events.add("OnPlayerLoginAttempt", username, password => { 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?
Xabi Posted October 22, 2019 Posted October 22, 2019 You are missing the parenthesis on server params (username, password)
Vrael Posted October 25, 2019 Author Posted October 25, 2019 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?
MrPancakers Posted October 25, 2019 Posted October 25, 2019 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) => {
Vrael Posted October 25, 2019 Author Posted October 25, 2019 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.
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