getNextPlayerTable and when to call it [SOLVED]
Posted: 14 March 2021, 00:42
Hello everyone.
I am facing a problem when calling "getNextPlayerTable" on a 2 players game.
I want to retreive the ID for both players.
During the "setupNewGame" function, right before "$this->activeNextPlayer();" I am doing this :
Unfortunately I get an error :
But can I know when exactly ?
I have checked some other code and the function is called at the same time, except that they don't call the next player, only the first player.
I hope my question is clear
NB : I can do without knowing the 2nd player ID as retreiving the 1st is working
I am facing a problem when calling "getNextPlayerTable" on a 2 players game.
I want to retreive the ID for both players.
During the "setupNewGame" function, right before "$this->activeNextPlayer();" I am doing this :
Code: Select all
/************ Start the game initialization *****/
$players_turn = $this->getNextPlayerTable();
$this->setGameStateInitialValue( "player1id", $players_turn["0"] );
$this->setGameStateInitialValue( "player2id", $players_turn["1"] );
$this->activeNextPlayer();A few topics mention this function has to be called after initialization.Unexpected error: Wrong formatted data from BGA gameserver 1 (method: createGame): JSON_ERROR_SYNTAX
Notice: Undefined offset: 1 in /var/tournoi/release/games/badguizmotestun/999999-9999/badguizmotestun.game.php on line 120
{"status":1,"data":true}
Unexpected error: Invalid player number for this game: 1
But can I know when exactly ?
I have checked some other code and the function is called at the same time, except that they don't call the next player, only the first player.
I hope my question is clear
NB : I can do without knowing the 2nd player ID as retreiving the 1st is working