Better /kill command, ensures death

This commit is contained in:
Shoghi Cervantes 2013-06-07 12:54:45 +02:00
parent c37c6da42d
commit 35c0c21c8d
2 changed files with 3 additions and 2 deletions

View File

@ -240,7 +240,8 @@ class PlayerAPI{
$player = $this->get($params[0]);
}
if($player instanceof Player){
$this->server->api->entity->harm($player->eid, 20, "console", true);
$player->entity->harm(1000, "console", true);
$player->sendChat("Ouch. That looks like it hurt.\n");
}else{
$output .= "Usage: /$cmd [player]\n";
}

View File

@ -782,7 +782,7 @@ class Entity extends Position{
}
public function harm($dmg, $cause = "generic", $force = false){
return $this->setHealth($this->getHealth() - ((int) $dmg), $cause, $force);
return $this->setHealth(max(-128, $this->getHealth() - ((int) $dmg)), $cause, $force);
}
public function heal($health, $cause = "generic"){