From b353dda4df7fc7be973e52a2f529360e7bfc8fed Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sat, 24 Jul 2021 18:14:26 +0530 Subject: Added menu to host/join game and protection against cheating --- src/components/MultiplayerGrid.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/components/MultiplayerGrid.js') diff --git a/src/components/MultiplayerGrid.js b/src/components/MultiplayerGrid.js index d26fb31..88a8259 100644 --- a/src/components/MultiplayerGrid.js +++ b/src/components/MultiplayerGrid.js @@ -29,6 +29,9 @@ const MultiplayerGrid = (props) => { const turn = props.turn; const getBoard = (index) => { + // if it's not your turn you can't play + if ((turn === 0) === props.isHost) return; + const newBoard = board.slice(0, index).concat(turn).concat(board.slice(index+1, 9)); socket.emit("update-remote-data", { board: newBoard, -- cgit v1.2.3