From 14d00a407add8af2225664f2ab3e3be93a62227b Mon Sep 17 00:00:00 2001 From: bitscuit Date: Sat, 13 Mar 2021 20:10:51 +0100 Subject: [PATCH] Added code so players can't vote for their own submissions --- html/index.html | 25 +++++++++++++++++++++++-- main.js | 8 ++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/html/index.html b/html/index.html index 8b86528..7d3a786 100644 --- a/html/index.html +++ b/html/index.html @@ -188,6 +188,7 @@ socket.on("PICK", function(data){ page += "
"; page += "

Select the line you prefer.

"; + page += ""; for(y=0; y { // PICK socket.on("PICK", (id) => { // When received pick form player + + // Check if not my entry + if(userWrite[userSockets.indexOf(socket)] == submissions[id]){ + socket.emit("PICK_REPLY", {error:"You can't vote for your own submission!"}); + return; + } + + // Add to list userPick[userSockets.indexOf(socket)] = id; // Perform ok