Can someone help me to fix the betting, I can't bet on other game match_id once I bet on a match

This is the full smart contract:

This is betting contract, when betting on id_1, the same address can't bet on id_2. I'm using Game storage

function bet(uint _gameId, uint8 _teamSelected) public payable {
  Game storage game = gameInfo[_gameId];
  require(game.state == State.Created,"Game has not been created");
  //The first require is used to check if the player already exist
  //The second one is used to see if the value sended by the player is
  //Higher than the minimum value
  require(msg.value >= minimumBet);

  //We set the player informations : amount of the bet and selected team
  playerInfo[msg.sender].amountBet = msg.value;
  playerInfo[msg.sender].teamSelected = _teamSelected;

  //then we add the address of the player to the players array

  //at the end, we increment the stakes of the team selected with the player bet
  if ( _teamSelected == 1){
      totalBetsOne += msg.value;
      totalBetsTwo += msg.value;

I am not sure wha problem did you encounter.
I just deployed the contract, and did as following:

  • call newGame()
  • call beginVotingPeriod()
  • call bet(ID=0) with 1 ETH
  • call newGame() again
  • call bet(ID=1) with 1 ETH failed, cause user did not meet the requirements: require(!checkPlayerExists(msg.sender));

So what do you expect?