Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Sign Help.

Comments in 'Plugin Development' started by NIM, Jan 9, 2014.

  1. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
     private 
    $api$server;
     public function 
    __construct(ServerAPI $api$server false){
     
    $this->api $api;
     
    $this->server ServerAPI::request();
     }

     public function 
    init(){
     
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
     }

     public function 
    eventHandler($data$event){
     switch (
    $event) {
     case 
    "tile.update":
     
    $playercount $this->api->dhandle('pc.get.count'false);
     if (
    $data->class === TILE_SIGN) {
     if (
    $data->data['Text1'] != "[Server]")
     return;
     
    $data->setText("Player Count: $playercount "$data->data['Text2']);
     }
     }
     }
     }
     Break;
     public function 
    __destruct(){
     }
     }
    Try this, if not
    This
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
     private 
    $api$server;
     public function 
    __construct(ServerAPI $api$server false){
     
    $this->api $api;
     
    $this->server ServerAPI::request();
     }

     public function 
    init(){
     
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
     }

     public function 
    eventHandler($data$event){
     switch (
    $event) {
     case 
    "tile.update":
     
    $playercount $this->api->dhandle('pc.get.count'false);
     if (
    $data->class === TILE_SIGN) {
     if (
    $data->data['Text1'] != "[Server]")
     return;
     
    $data->setText("Player Count: $playercount "$data->data['Text2']);
     }
     }
     }
     }
     public function 
    __destruct(){
     }
     }
  2. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    1-10-2014 10-19-15 11PM.png 1-10-2014 10-20-00 11PM.png
    both dont work
  3. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    I love this late night nerd stuff
  4. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    Maybe this
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
     private 
    $api$server;
     public function 
    __construct(ServerAPI $api$server false){
     
    $this->api $api;
     
    $this->server ServerAPI::request();
     }

     public function 
    init(){
     
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
     }

     public function 
    eventHandler($data$event){
     switch (
    $event) {
     case 
    "tile.update":
     
    $playercount $this->api->dhandle('pc.get.count'false);
     if (
    $data->class === TILE_SIGN) {
     if (
    $data->data['Text1'] != "[Server]")
     return;
     
    $data->setText("Player Count: $playercount "$data->data['Text2']);
     }
     }
     }
     Break;
     public function 
    __destruct(){
     }
     }
  5. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    Not "nerd stuff" just "smarter than the usual" :D
    Mason Gareis likes this.
  6. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    1-10-2014 10-49-14 11PM.png
  7. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    I think this:
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
     private 
    $api$server;
     public function 
    __construct(ServerAPI $api$server false){
     
    $this->api $api;
     
    $this->server ServerAPI::request();
     }

     public function 
    init(){
     
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
     }

     public function 
    eventHandler($data$event){
     switch (
    $event) {
     case 
    "tile.update":
     
    $playercount $this->api->dhandle('pc.get.count'false);
     if (
    $data->class === TILE_SIGN) {
     if (
    $data->data['Text1'] != "[Server]")
     return;
     
    $data->setText("Player Count: $playercount "$data->data['Text2']);
     }
     }
     }
     public function 
    __destruct(){
     }
     }
  8. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    so it works partially
  9. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE



    Probably wont all fit on one line
  10. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    Got to go to bed. I am really tired, and hopefully you can fix this by the morning. ttyl.
  11. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    This. But I gtg so bye
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                
    $playercount $this->api->dhandle('pc.get.count'false);
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "[Server]")
                      return;
                              
    $data->setText(".count($this->api->player->getAll())."/".$this->server->maxClients));
                                }
                            }
                        }
                     }
              }
                       public function __destruct(){
        }
        }
  12. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    will try
  13. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    PHP:
    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                
    $playercount $this->api->dhandle('pc.get.count'false);
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "[Server]")
                      return;
                              
    $data->setText(count($this->api->player->getAll())."/".$this->server->maxClients);
                                }
                            }
                        }
                     }
             
                       public function 
    __destruct(){
        }


    I got an error at first, so i edited some code and now i'm getting this error


    1-11-2014 9-18-01 AM.png
    xpyctum likes this.
  14. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    PHP:
    <?php

    /* 
    __PocketMine Plugin__ 
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "[Server]")
                      return;
                              
    $data->setText(".count($this->api->player->getAll())."/".$this->server->maxClients));
                                }
                            }
                        }
                       public function __destruct(){
        }
        }
    Here!
  15. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    PHP:
    /*
    __PocketMine Plugin__
    name=SignPro
    description= Live Signs at its best!
    version=1.0
    author=NIM
    class=Sign
    apiversion=11
    */

    class Sign implements Plugin{
        private 
    $api$server;
        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
            
    $this->server ServerAPI::request();
        }

        public function 
    init(){
            
    $this->api->addHandler("tile.update", array($this"eventHandler"), 10);
        }

        public function 
    eventHandler($data$event){
            switch (
    $event) {
                case 
    "tile.update":
                    if (
    $data->class === TILE_SIGN) {
                        if (
    $data->data['Text1'] != "[Server]")
                      return;
                              
    $data->setText(count($this->api->player->getAll())."/".$this->server->maxClients);
                                }
                            }
                        }
                      public function 
    __destruct(){
        }
        }
    ?>
    I fixed some issues, But i got it to work. Here is the final code. I reccomend that you upload this to the public plugin directory.
  16. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    Can you take a video of it working?
  17. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    Pocketmine doesn't need the ?> to close it :D
  18. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
    ok
    will do
  19. Mason Gareis
    Offline

    Mason Gareis Active Member

    Joined:
    Jan 8, 2014
    Posts:
    52
    Minecraft User:
    MasonLovesMCPE
  20. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    Thanks for everything! I will delete this thread and Upload the plugin! Enjoy! more coming soon! :)

Share This Page

Advertisement