gms_script_set_login

Usage: gms_script_set_login ( script_id )

Description

Sets the script that should be executed when a new player logs in.

The script should take 1 argument:
argument0: The 'other player' object.

When the simple mode is disabled, or no other player object is set, argument0 will be the player_id of the new player.

Example

//Sets the script scr_login to be executed when a new player logs in
gms_script_set_login(scr_login)

Replies (3)

Last message on 9 May 2017

Dublann on 6 May 2017, 11:45:37
Hi Size,
In the scr_login Im having:
switch(argument0)
{
    case e_ok:
       with(obj_login_GMS){alarm[0]=60}//This alarm is to change the room
       global.bien_logueado=1
        break;
    case e_already_logged_in:
        show_message("You're already logged in!");
        room_goto(rm_login)
        break;
    default:
        show_message(gms_login_error_tostring(argument0));
        room_goto(rm_login)
        break;
}


Sometimes, it doesn't go to the next room if case e_ok, but Im not getting any error. One way to solve it, is that I added an object that restart the game after some seconds(currently 5 secs, but I tried more time and nothing) and logout. Most of the times, after restarting, it logs correctly and go to the next room, but some others I need to restart the game 3 times. Why if case is e_ok, sometimes it does not works?

THX!
Size43 (Administrator) on 8 May 2017, 15:23:54
Maybe you're calling gms_login_execute twice, which will return e_ok the first time, but then kick you the second time.
Dublann on 9 May 2017, 19:21:48
Exactly, it was the error. THX