This commit is contained in:
Shoghi Cervantes Pueyo
2013-01-29 20:53:43 +01:00
parent 2011d1d339
commit 71b12191b2
4 changed files with 42 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ class PlayerAPI{
$this->server->addHandler("player.death", array($this, "handle"), 1);
$this->server->api->console->register("list", "Shows connected player list", array($this, "commandHandler"));
$this->server->api->console->register("kill", "Kills a player", array($this, "commandHandler"));
$this->server->api->console->register("harm", "Harms a player", array($this, "commandHandler"));
$this->server->api->console->register("tppos", "Teleports a player to a position", array($this, "commandHandler"));
$this->server->api->console->register("tp", "Teleports a player to another player", array($this, "commandHandler"));
}
@@ -138,6 +139,15 @@ class PlayerAPI{
console("[INFO] Usage: /kill <player>");
}
break;
case "harm":
$dmg = (int) array_shift($params);
$player = $this->get(implode(" ", $params));
if($player !== false){
$this->server->api->entity->harm($player->eid, $dmg, "console", true);
}else{
console("[INFO] Usage: /harm <damage> <player>");
}
break;
case "list":
console("[INFO] Player list:");
foreach($this->server->clients as $c){