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

how to run command with msg

Comments in 'Plugin Development' started by XWITHERHEROX, Feb 11, 2016.

  1. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
    hello =3



    can you tell me how
    if player say i want op
    summon tnt in hes lacton

    -sorry for my bad english-
  2. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    You give permission in msg?
  3. PolskiTHEPLAYER
    Offline

    PolskiTHEPLAYER New Member

    Joined:
    Apr 1, 2015
    Posts:
    55
    Minecraft User:
    Flsmers
    pocketmine.command.tell
  4. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    In plain english,
    if player says in that, "i want op"
    tnt explodes intheir location
    XWITHERHEROX likes this.
  5. TheMuffinQueen
    Offline

    TheMuffinQueen New Member

    Joined:
    Feb 11, 2016
    Posts:
    14
    Minecraft User:
    TheMuffinQueen
    XDD
  6. XWITHERHEROX
    Offline

    XWITHERHEROX Active Member

    Joined:
    Jun 4, 2015
    Posts:
    57
    Minecraft User:
    ReDaRWiTheR
  7. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    I am pretty sure there are couple of threads about summoning a PrimedTNT Entity.
    What?
  8. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    use PlayerChatEvent
    And Do You Want in player say "i want op" Spawn PrimedTNT
    Look A TNT Plugin
  9. DesPlaysMC
    Offline

    DesPlaysMC New Member

    Joined:
    Jan 19, 2016
    Posts:
    8
    Minecraft User:
    DesPlaysMC
    gr8 idea xD
  10. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    PHP:
    public $optnts = [];

    public function 
    onChat(PlayerChatEvent $event){
    $msg $event->getMessage();
    if(
    strtolower($msg) == "i want op"){
    $player $event->getPlayer();
            
    $nbt =
                 new 
    Compound("",
                                    [
    "Pos" => new Enum("Pos",
                                                            [new 
    Double(""$player->x),
                                                             new 
    Double(""$player->y),
                                                             new 
    Double(""$player->z)]),
                                    
    "Motion" => new Enum("Motion",
                                                                [new 
    Double("",0),
                                                                 new 
    Double("",-1),
                                                                 new 
    Double("",0)]),
                                    
    "Rotation" => new Enum("Rotation",
                                                                    [new 
    Float(""0),
                                                                    new 
    Float(""0)]),
                                    
    "Fuse" => new Byte("Fuse"//time when tnt explodes)]);

            
    $entity Entity::createEntity("PrimedTNT",
                                                    
    $player->getLevel()->getChunk($player->>> 4$player->>> 4),
                                                    
    $nbt);
            
    $entity->spawnToAll();
    array_push($this->optnts$tnt->getId());
    }}

    // code to prevent block breaking
    // not sure if the code down below works, the last time I tried that code it returned me an on null error on $event->getEntity(); I know the entity removes during the explosion but so the function is useless
    public function onExplode(ExplosionPrimeEvent $event){
    if(
    in_array($event->getEntity()->getId(), $this->optnt)){
    $event->setBlockBreaking(false);
    unset(
    $this->optnt[$tnt->getId()]);
    }}
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Maybe try to format your code better next time.

Share This Page

Advertisement