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

Deny place tnt?

Comments in 'Plugin Development' started by Meatie, Dec 4, 2013.

  1. Meatie
    Offline

    Meatie New Member

    Joined:
    Dec 3, 2013
    Posts:
    4
    Minecraft User:
    Meatie
    I was reading some posts on this form and was able to make the code below, But how do i check if "$id" is TNT or another block like bedrock?


    PHP:
        public function eventHandler($data$event){
            switch(
    $event){
                case 
    "player.block.place":
                public function 
    playerblockbreak($data){
    $x $data["target"]->x;
    $y $data["target"]->y;
    $z $data["target"]->z;
    $id $data["target"]->getID();

    }
                    break;
            }
            return;
        }
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    That's messed up in other ways, I'm tired right now so I can't explain it all. You can use an if statement to see if it's TNT.
  3. Meatie
    Offline

    Meatie New Member

    Joined:
    Dec 3, 2013
    Posts:
    4
    Minecraft User:
    Meatie
    Sorry, im new to PHP, Ill do some more searching, but if someone could show me the like of code to check if a block is TNT(any block really) that would be awesome :D Thanks tho.
  4. Meatie
    Offline

    Meatie New Member

    Joined:
    Dec 3, 2013
    Posts:
    4
    Minecraft User:
    Meatie
    Last edited: Dec 4, 2013
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    It's player.block.break when setting an event and you also need to use the ,0 when getting a block even if it doesn't have varieties. There are other issues but those stuck out.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Read GlitchMasterPE's tutorial and learn PHP. Since you ask this question you don't know how to use if(true)statement;, right? Go to w3schools.com to learn, although it is for HTML PHP instead of PocketMine's PHP interpreter and its OS.
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    What is this HTML PHP you speak of?
  8. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    I will write a quick plugin to do this later
  9. Xfusionios
    Offline

    Xfusionios Active Member Plugin Developer

    Joined:
    Aug 24, 2013
    Posts:
    67
    Plugins:
    2
    Minecraft User:
    XFusionios
    This would work yes?
    PHP:
    if($data["target"]->getID() == 17){ return false;
    }
    Wasn't sure what block id TNT is...
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    <html><head><script language="php"><?php #blah blah blah?></script></head></html>
    LDX likes this.
  11. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    That's still just PHP but stuck in a weird HTML tag :)
    xktiverz likes this.
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    ($id!==$idOfTnt)?return:blah blah
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    There are echo and etc
    Falk likes this.
  14. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Yes there are also other functions which aren't available in the custom build of PHP but that doesn't mean it's not PHP.
    PEMapModder likes this.
  15. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,196
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    banitem plugin wotks the other way around.
  16. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,429
    Plugins:
    14
    You know, what PHP was developed for. Putting dynamic content in WEBPAGES integrated with HTML. PHP was not made for stuff like this.
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    echo is for changing the parent window in Windows. This is what I saw in PocketMinecraftServer.php at line 100.

Share This Page

Advertisement