Created
April 13, 2015 03:25
-
-
Save truelinux/fdfef3f2b3be99df83f1 to your computer and use it in GitHub Desktop.
TPA SYSTEM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ((strtolower ( $command->getName () ) == "tpa")) { | |
if(isset($this->parkour[$name]) || isset($this->pvp[$name])) { | |
$sender->sendMessage(TextFormat::RED."> Nice try..."); | |
return true; | |
} | |
if(isset($args[0])) { | |
$to = $this->getServer()->getPlayer($args[0]); | |
$pname = $to->getName(); | |
unset($this->tpa[$pname]); | |
$this->tpa[$pname] = $name; | |
$sender->sendMessage(TextFormat::GOLD."> Request Sent.."); | |
$to->sendMessage(TextFormat::GOLD."> '$name' wants to tp to you.\n/tpaccept 'or' /tpdeny"); | |
return true; | |
} | |
} | |
if ((strtolower ( $command->getName () ) == "tpaccept")) { | |
if(isset($this->parkour[$name]) || isset($this->pvp[$name])) { | |
$sender->sendMessage(TextFormat::RED."> Nice try..."); | |
return true; | |
} | |
if(!$this->hasRequest($name)) { | |
$sender->sendMessage(TextFormat::RED."> You have no requests!"); | |
return true; | |
} | |
$data = $this->getRequestData($name); | |
$tpsender = $this->getServer()->getPlayer($data); | |
$tpsender->teleport($sender->getPosition(), $sender->getYaw(), $sender->getPitch()); | |
$sender->sendMessage(TextFormat::GOLD."> Request accepted"); | |
$tpsender->sendMessage(TextFormat::GOLD."> '$name' accepted your request"); | |
$this->removeTpRequest($name); | |
return true; | |
} | |
public function clearTP() { | |
foreach($this->tpa as $tp) { | |
unset($this->tpa[$tp]); | |
} | |
return true; | |
} | |
public function removeTpRequest($p1) { | |
unset($this->tpa[$p1]); | |
return true; | |
} | |
public function hasRequest($name) { | |
if(isset($this->tpa[$name])) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
public function getRequestData($name) { | |
$data = $this->tpa[$name]; | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment