Vrael 0 Posted Thursday at 12:40 AM (edited) Hello everyone. I'm facing a issue wich i can't solve, thats why I'm asking you if anyone could help me. I'm trying to write a login/register script Client: Spoiler mp.events.add('loginInformationToServer', (username, password) => { mp.events.callRemote('OnPlayerLoginAttempt', username, password); }); mp.events.add('registerInformationToServer', (username, password) => { mp.events.callRemote('OnPlayerRegisterAttempt', username, password); }); Server Spoiler mp.events.add("OnPlayerLoginAttempt", (username, password) => { console.log("0" + username); var spielerTitel = String(username); console.log("1" + spielerTitel); var spielerName = JSON.stringify(username); console.log("2" + spielerName); console.log("Username: " + spielerName , "Passwort: " + password); }); no matter what i do, the output is always like this: as u can see, i tryed to use the String option aswell as JSON.stringify Edited Thursday at 12:40 AM by Vrael Share this post Link to post Share on other sites
mDenis16 1 Posted Thursday at 03:05 PM (edited) you dont need to stringfy strings or cast string just send your login information from html page to clientside => mp.trigger("OnPlayerLoginAttempt", username, password); //username and password are strings =>> and from clientside to server And try to don't paste. Write code by your hand to understand it Edited Thursday at 03:05 PM by mDenis16 Share this post Link to post Share on other sites
Vrael 0 Posted Thursday at 04:42 PM (edited) vor 1 Stunde schrieb mDenis16: you dont need to stringfy strings or cast string just send your login information from html page to clientside => mp.trigger("OnPlayerLoginAttempt", username, password); //username and password are strings =>> and from clientside to server And try to don't paste. Write code by your hand to understand it i already send the login information from html to clientside $('#loginButton').click(() => { $('.alert').remove(); //Remove any alerts when we attempt to login/register mp.trigger('loginInformationToServer', $('#loginUsernameText').val(), $('#loginPasswordText').val()); }); and yes you're right, I should write every code myself but this login script is good to understand how I can send things from html to client then to server and back to client. I understand most of it but there are still some things like this wich i dont get. Edited Thursday at 04:44 PM by Vrael Share this post Link to post Share on other sites
mDenis16 1 Posted Thursday at 07:13 PM mp.events.add("OnPlayerLoginAttempt", (username, password) => { console.log(`Username: ${username} and password: ${password}`); }); serverside mp.events.add('loginInformationToServer', (username, password) => { mp.events.callRemote('OnPlayerLoginAttempt', username, password); }); clientside js html $('#loginButton').click(() => { $('.alert').remove(); mp.trigger('loginInformationToServer', $('#loginUsernameText').val(), $('#loginPasswordText').val()); }); thats should work Share this post Link to post Share on other sites
MrPancakers 110 Posted yesterday at 01:21 AM (edited) It doesn’t make sense your username is an object, isn’t the first parameter of the event supposed to be a player object, so it’d be “OnPlayerLoginAttempt” (player, username, password) [I barely looked over the code sonce I’m at work, it might be your other event idk] pretty sure you’ve had it right, you just didn’t consider the first parameter being a player object. If stringifying the object gives you {} then most likely its a ragemp object (aka the player) Edited yesterday at 01:23 AM by MrPancakers 1 Share this post Link to post Share on other sites
Doom 5 Posted yesterday at 08:21 AM MrPancakers is correct, you're referring to the player object in the first parameter. The password param is giving you the username in your case and that's crystal clear in your console output tests. Share this post Link to post Share on other sites