This commit is contained in:
Killian Marty 2023-12-06 09:21:43 +01:00
parent b2a7486fa6
commit 82720d5a33

View file

@ -108,6 +108,10 @@ wss.on('connection', (socket, req) => {
socket.on('close', () => {
for (var i = players.length - 1; i >= 0; i--) {
broadcast(JSON.stringify({
type: "removePlayer",
data: {id = socket.id}
}));
if(players[i].id==socket.id){
players.splice(i, 1);
}