GM:S 1.4 LAN Platformer Demo - Disconnect button

Discussion in 'Programming' started by grossik, Oct 9, 2019.

  1. grossik

    grossik Member

    Joined:
    Feb 6, 2017
    Posts:
    28
    Hello I have problem with disconnect button.
    On map I have object which has step code:
    Code:
    if(keyboard_check(ord('O'))){
        with(oServer){       
            network_destroy(server);
            global.haveserver = false;
            buffer_delete(player_buffer);
            buffer_delete(broadcast_buffer);
            ds_map_destroy(Clients)
            ds_list_destroy(socketlist);
            game_restart();
        }
    
        with(oClient){
            network_destroy(client);
            buffer_delete(buff);
            game_restart();
        }
    }
    This code works smart, but if server is disconnect other players have frozen screen, however they click on disconnect button and it is ok.
    But I want to relieve frozen screen. I found that the restart is not working well and the network is running. I have to shut down player (server) game if I disconnect other players. What should I do more so I don't have to shut down the game, but just a restart?

    Sorry for my bad English.
     
  2. Odlaw

    Odlaw Member

    Joined:
    Mar 20, 2018
    Posts:
    12
    I would code the restart manually instead of using game_restart(). Destroy everything and clean it all up and then re-create it all.

    I hope this helps
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice