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

[ERROR] help with getid()

Comments in 'Plugin Development' started by jerlegoman, Jun 15, 2014.

  1. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    public function __destruct(){ }
    is still not working o_O
  2. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    i know its not needed. but i thought it well solve the problem and it did i think
  3. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    github is also very good for coding on the go
  4. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    dude
    ublic function __destruct(){ }
    }
  5. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    it is } at the end
  6. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    yeah I have that too
  7. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    okay let me fix it and try it
    jerlegoman likes this.
  8. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    here is my entire code:
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=TOspawn
    version=1.0
    apiversion=12
    author=Jerlegoman
    class=spaplus
    */
    class spaplus implements Plugin {
    private 
    $api;
    public function 
    __construct(ServerAPI $api,$server false) {
    $this->api $api;
    }
    public function 
    init() {
    $this->api->addHandler("player.action", array($this"eventHandle"), 50);
    }
    public function 
    eventHandle($data$event) {
    switch (
    $event) {
    case 
    "player.action":
    $player $data["player"];
    $item $player->getSlot($player->slot);
    if(
    $item->getid()==345){
    $data->sendChat("** Have Fun and BE CARE FULL!");
    }
    }
    public function 
    __destruct(){}
    }
    }
    ?>
  9. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=TOspawn
    version=1.0
    apiversion=12
    author=Jerlegoman
    class=spaplus
    */
    class spaplus implements Plugin {
    private 
    $api;
    public function 
    __construct(ServerAPI $api,$server false) {
    $this->api $api;
    }
    public function 
    init() {
    $this->api->addHandler("player.action", array($this"eventHandle"), 50);
    }
    public function 
    eventHandle($data$event) {
    switch (
    $event) {
    case 
    "player.action":
    $player $data["player"];
    $item $player->getSlot($player->slot);
    if(
    $item->getid()==345){
    $data->sendChat("** Have Fun and BE CARE FULL!");
    }
    }
    }
    public function 
    __destruct(){}
    }
    ?>
    jerlegoman and swagboy47 like this.
  10. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    i know it. but you were faster then me :)
  11. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    oohhhh now I seeo_O
  12. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    here

    Attached Files:

  13. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    Learn something new everyday!:)
    swagboy47 likes this.
  14. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    I have been having trouble with the end of the code where there is a lot of the { and } it is very confusing
    :rolleyes:
  15. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    make sure that every { have to be closed or the console well say WTF is that
    jerlegoman likes this.
  16. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    LOL and thanks for the heads up;)
  17. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    Thank you my code works perfectly I couldn't have done it with out you guys!
  18. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    no problem ;)
  19. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    do you need help?

Share This Page

Advertisement