Hello, I'm trying to fix a counter type in a minigame but I do not know why it does not work, I'm using the '--' operator to decrease counting number but always continues with 20 or 19 and never goes down and also do not know how that work: https://github.com/kaitododoyt/SkyW...rc/KaitoDoDo/SkyWarsTeam/SkyWarsTeam.php#L770 works and mine not, first of all, yes I am using Tasks. I have that code: PHP: //in config is like this: countdown: 20 $counterArena = $config->get($levelArena . "countdown");//and then after all they send a message to the player with variable $counterArena $counterArena--;$player->sendPopup("Game starts in ".$counterArena.".");
The problem is that you update $counterArena variable from config every time you decrease it. You should load $counterArena once and then decrement it.
Yeah, but how can i do that? Because it needs to be in the task file to get that $counterArena, and i can't get whitout update because it's in a task file, mine is similar that, and that works: https://github.com/kaitododoyt/SkyW...rc/KaitoDoDo/SkyWarsTeam/SkyWarsTeam.php#L754
in the constructor of the task have $this->counterArena = $config->get($levelArena . "countdown"); and then access it with $this->counterArena--; in your onRun