Hi, I want to add kills of player in SkyWars by svile. How to make this? I need to get the players kills here: PHP: $p->sendPopup("Players:{$slot}, Kills: {HELP ME}, Time: ". date('i:s', ($this->maxtime - $this->time))); Full code: PHP: public function tick() { if ($this->GAME_STATE == 0 && count($this->players) < ($this->pg->configs['needed.players.to.run.countdown'] + 0)) return; $this->time++; //START and STOP if ($this->GAME_STATE == 0 && $this->pg->configs['start.when.full'] && $this->slot <= count($this->players)) { $this->start(); return; } if ($this->GAME_STATE > 0 && 2 > count($this->players)) { $this->stop(); return; } if ($this->GAME_STATE == 0 && $this->time >= $this->countdown) { $this->start(); return; } if ($this->GAME_STATE > 0 && $this->time >= $this->maxtime) { $this->stop(); return; } //Chest refill if ($this->GAME_STATE > 0 && $this->pg->configs['chest.refill'] && ($this->time % $this->pg->configs['chest.refill.rate']) == 0) { $this->refillChests(); foreach ($this->pg->getServer()->getLevelByName($this->world)->getPlayers() as $p) { $p->sendMessage($this->pg->lang['game.chest.refill']); } return; } if ($this->GAME_STATE == 1) { foreach ($this->pg->getServer()->getLevelByName($this->world)->getPlayers() as $p) { $slot = $this->getSlot(true); $p->sendPopup("Players:{$slot}, Kills: {HELP ME}, Time: ". date('i:s', ($this->maxtime - $this->time))); } return; } //PvP - updates if ($this->GAME_STATE == 2) { if ($this->time <= $this->pg->configs['no.pvp.countdown']) foreach ($this->pg->getServer()->getLevelByName($this->world)->getPlayers() as $p) $p->sendPopup(str_replace('{COUNT}', $this->pg->configs['no.pvp.countdown'] - $this->time + 1, $this->pg->lang['no.pvp.countdown'])); else $this->GAME_STATE = 1; return; } //Chat and Popup messanges if ($this->GAME_STATE == 0 && $this->time % 30 == 0) { foreach ($this->pg->getServer()->getLevelByName($this->world)->getPlayers() as $p) { } } if ($this->GAME_STATE == 0) { foreach ($this->pg->getServer()->getLevelByName($this->world)->getPlayers() as $p) { $p->sendPopup(str_replace('{N}', date('i:s', ($this->countdown - $this->time)), $this->pg->lang['popup.countdown'])); if (($this->countdown - $this->time) <= 45) $p->getLevel()->addSound((new \pocketmine\level\sound\ButtonClickSound($p)), [$p]); } } }
PHP: public function sendTopKill($player, $mapname){ arsort($this->kills[$mapname]); $names = array_keys($this->kills[$mapname]); $kills = array_values($this->kills[$mapname]); $player->sendMessage("§l§a» §r§eTop kills :"); for($i = 0; $i < 3; $i++){ $place = $i+1; $player->sendMessage("§a#".$place." §e".$names[$i]. " - ".$kills[$i]." kill(s)"); } } I use that for a mini game plugin, you only have to adapt it x).
You will translate what I said because in English I do not speak well enough , Sorry: Copier Coller un code n'est vraiment pas mon genre, de plus il n'y a pas beaucoup de façon de faire ça...Si tu en as une autre dis le moi...
You can use the off-topic section. There are many good french developers in this community to assist you. You can also use google translate - it will generate broken English (but it's still English and we can figure out what you meant).
I help the person who created this post, and I had trouble expressing myself correctly(sorry it's google translate)