fix illegal username bug

This commit is contained in:
biglyderv 2024-11-25 14:14:21 -05:00
parent 91c54e8cd4
commit c92ec69523

View file

@ -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;