Usage: gms_login_set_password ( pass )


Sets the password to login with. When calling this function with an empty password, the login will try to login to an account with an empty password. To log in as a guest (when gms_login_player_has_account returns false), simply don't call this function.

If you are developing a game using GameMaker Server, you are to never store or transmit user passwords (or hashes, or encoded variations). Not remotely, nor locally. Any violation of this will get your game banned.

Replies (22)

Last message on 15 Jun 2016

sneakyblobfish on 13 Jun 2016, 02:20:46
When I don't call this function to make them login as a guest, it shows an error.

Error: Needs password to login.
Size43 (Administrator) on 15 Jun 2016, 10:32:08
You cannot login to a registered account without a password. You should prepend the username with something like (Guest_) in order to make sure the user does not exist.
puzzle on 14 Jun 2016, 16:04:37
To login as guest, you must perform the following functions.
Size43 (Administrator) on 15 Jun 2016, 10:32:22
The default is true, so this should not be necessary.
Forgeio on 19 Aug 2015, 21:26:46
Im so sorry about having so many problems with my games, but Im really new to servers and all of this.

username = obj_textbox_1.txt
password = obj_textbox_2.txt


that does not work, I have it in the left pressed event on a button in my custom login room. It never returns the user defined 15 when I set up this, so it never goes to the next room and does the normal login stuff. please help soon, I have a bit of a deadline with all of this :P
Size43 (Administrator) on 20 Aug 2015, 21:47:57
You'll also need to call gms_login_execute(...). The user events are only called when you use the default login/window system. You can give the name of a script (without quotes) to gms_login_execute, and that script will be called in a similar way as the user event 15.
Forgeio on 23 Aug 2015, 02:38:46
what script do I call in gms_login_execue(...)
Size43 (Administrator) on 6 Sep 2015, 20:57:58
You need to write your own script. There's an example in gms_login_execute.
Forgeio on 8 Sep 2015, 04:19:44
can you give a little bit of a better example please? I'm so sorry I'm accident prone xD
Size43 (Administrator) on 8 Sep 2015, 12:08:06
What part isn't clear? You literally need to put everything above the //scr_login after setting the username and password, and add a script named scr_login in which you put everything after the //scr_login.
Forgeio on 15 Sep 2015, 04:01:36
username = obj_textbox_1.txt
password = obj_textbox_2.txt
thats in the left pressed event in the button for logging in.

case e_ok:
show_message("Login OK!");
case e_already_logged_in:
show_message("You're already logged in!");
thats in the script that it calls.
Size43 (Administrator) on 25 Sep 2015, 14:33:12
That code looks fine. Are you seeing an error message or something like that?
Forgeio on 25 Sep 2015, 21:39:57
no it just doesnt go to the next room it just sits there, nothing happens.
Size43 (Administrator) on 26 Sep 2015, 14:00:03
Do you see the show_message at all? You don't have a room_goto_next() in your script, so it won't go to the next room.
Forgeio on 28 Sep 2015, 02:46:17
ohhhh I was putting the room_goto_next() inside the user defined 15 event. I got it working, thanks :)
one problem though, it lets me login even if my password/username is wrong. whys that happening?
Size43 (Administrator) on 2 Oct 2015, 13:24:03
Where in the script did you put room_goto_next()? It should only be under the "case e_ok:" part.
Forgeio on 3 Oct 2015, 04:12:30
yeah it is.
Size43 (Administrator) on 3 Oct 2015, 19:14:53
Do you see the correct error message when you enter the wrong password, or do you see "Login OK" anyway?
Forgeio on 5 Oct 2015, 01:24:52
neither, all it does is go to the next room. I replaced the "login OK" with "room_goto_next();"
Size43 (Administrator) on 9 Oct 2015, 14:42:34
As far as I'm aware, it's not possible to login without having the correct credentials. I suspect you're either being logged in under another account, or not logged in at all.

What does gms_info_isloggedin return after going to the next room? Also, please check whether gms_self_name() return the correct name, or does it have "Guest_" in front of it?
Forgeio on 10 Oct 2015, 19:19:40
ok I got it working, I accidentally put the username in the password and the password in the username. Sorry for the trouble!
Size43 (Administrator) on 12 Oct 2015, 11:55:50
No problem, glad to hear it works!