SHARE
TWEET

Untitled

a guest Jun 24th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. socket.on('JoinLobby',function(data) {
  2.     var foundLobby = false;
  3.     console.log(socket.id);
  4.     for (var i in LOBBY_LIST) {
  5.       if (LOBBY_LIST[i].id == data.id) {
  6.         if (LOBBY_LIST[i].pass == data.pass) {
  7.           foundLobby = true;
  8.           for (var j in PLAYER_LIST) {
  9.             if (PLAYER_LIST[j].lobby == i) {
  10.               PLAYER_LIST[socket.id].username = data.user;
  11.               SOCKET_LIST[j].emit('PlayerJoined',{lobbydata:LOBBY_LIST[i],name:PLAYER_LIST[socket.id].username,id:socket.id});
  12.               PLAYER_LIST[socket.id].lobby = i;
  13.             }
  14.           }
  15.           console.log(socket.id);
  16.         }
  17.       }
  18.     }
  19.     console.log(foundLobby);
  20.     if (foundLobby) {
  21.       SOCKET_LIST[socket.id].emit('JoinLobbyJoin');
  22.     }
  23.   });
  24.      
  25. if (foundLobby) {
  26.    SOCKET_LIST[socket.id].emit('JoinLobbyJoin');
  27. }
  28.      
  29. socket.on('JoinLobbyJoin',function() {
  30.   console.log('Joined');
  31.   //ServerData = data.lobbydata;
  32.   document.getElementById("LobbyDiv").style = "";
  33.   hideElement("JoinLobbyDiv");
  34.   hideElement("Navbars");
  35. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top