Why this no work? Plugin doesn't loaded PHP: class beAreaSeller implements Plugin{ private $api; public function __construct(ServerAPI $api, $server = false) { $this->api = $api; } public function init() { $this->api->addHandler("tile.update", array($this, "handler")); $this->api->addHandler("player.block.touch", array($this, "handler")); } public function __destruct() { } public function chatTo($player, $chat) { $player->sendChat("[beAreaSeller]" . $chat); } public function handler($data, $event) { switch( $event ) { case "tile.update": $target = $data; if($target->class == TILE_SIGN) { if( strtolower($target->data["Text1"]) == "beareaseller" ) { if( !$this->api->dhandle("be.monitor.sellspace.exist", array( 'x' => $target->x, 'y' => $target->y, 'z' => $target->z )) ) { $player = $this->api->player->get( $target->data["creator"] ); if($player !== false) { $this->chatTo($player, "Broken Area Seller, Please Remake It."); } return false; } } } break; case "player.block.touch": $player = $data["player"]; $target = $data["target"]; $tile = $this->api->tile->get( new Position($target->x, $target->y, $target->z, $target->level) ); if ($tile === false) { break; } $class = $tile->class; switch ($class) { case TILE_SIGN: if( strtolower($tile->data['Text1']) == "beareaseller" ) { $price = (int) $tile->data['Text2']; $bmoney = $this->api->dhandle("money.player.get", array( 'username' => $player->username ) ); if($bmoney < $price) { $this->chatTo($player, "your money not enough for buy this area"); } else { if( !$this->api->dhandle("be.monitor.sellspace.exist", array( 'x' => $target->x, 'y' => $target->y, 'z' => $target->z ))) { $this->chatTo($player, "Broken Area Seller, Contact to Admin"); } else if( !$this->api->dhandle("money.handle", array( 'username' => $player->username, 'method' => 'grant', 'value' => -$price )) ) { $this->chatTo($player, "Error in Money Handleing"); } else { if( !$this->api->dhandle("be.monitor.sellspace.buy", array( 'x' => $target->x, 'y' => $target->y, 'z' => $target->z, 'buyer' => $player->username ))) { $this->api->dhandle("money.handle", array( 'username' => $player->username, 'method' => 'grant', 'value' => $price )) $this->chatTo($player, "Error in Area Handleing"); } else { $this->chatTo($player, "Area Purchased!"); } } } } break; } break; } } }?>
Yeah, it's a public function near the top of the plugin, it just adds the plugin message prefix to all messages it send to players. I also see the player variable definition now, can you give us the entire error?
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /root/c/src/API/PluginAPI.php(87) : eval()'d code on line 117 01:46:19 [ERROR] Failed loading plugin: evaluation error When i Changed This $this->chatTo($player, "Error in Area Handleing"); To $this->sendChat($player, "Error in Area Handleing");
Not work: Parse error: syntax error, unexpected '$player' (T_VARIABLE) in /root/c/src/API/PluginAPI.php(87) : eval()'d code on line 117 02:12:34 [ERROR] Failed loading plugin: evaluation error :
But on windows: Parse error: syntax error, unexpected '$player' (T_VARIABLE) in /root/c/plugins/TestPlugin.php : eval()'d code on line 117 02:12:34 [ERROR] Failed loading plugin: evaluation error