From a1f858080c7f24fab89ca50a375b2be060ffd09c Mon Sep 17 00:00:00 2001 From: Zuxxied Date: Sun, 20 Oct 2024 14:55:03 -0400 Subject: [PATCH] fix illegal username bug --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0015e86..c839fa1 100644 --- a/index.js +++ b/index.js @@ -62,8 +62,8 @@ app.ws('/', function (ws, req) { } ); j = await j.json(); - if (game.ws.findIndex(x => x.username == j.username) != -1) { - console.log(`Player ${player.you} uses username ${ws.username} illegally`) + if (game.ws.findIndex(x => x.username == j.username && x.health >= 0) != -1) { + console.log(`Player ${player.you} uses username ${x.username} illegally`) return; } ws.username = j.username;