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

Gun plugin

Comments in 'Plugin Development' started by mclab, Jan 15, 2015.

  1. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    It's possible to make gun plugin?
    I mean, when you click on sword, then snowball will shoot...
  2. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Right now it's impossible, MCPE doesn't handle air touch (taping the screen where there is no block), so I believe that it will not satisfy your needs :p
  3. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Also, wrong section, you may post things like this on the 'Plugin Requests' Forum, this section (Plugin Development) is just for those who need help with their plugins or while coding :p
    Junhua likes this.
  4. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    hmmm, ok thanks...

    I have one more question.
    It's possible to make explosive snowballs or arrows?

    Some like this?
    PHP:
    public function onProjectileLaunch(ProjectileLaunchEvent $event){
            
    $entity $event->getEntity();
            if(
    $entity instanceof Snowball){
    //what now?
            
    }
        }
  5. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Maybe change from event... That just points when the projectile is launched. I can make the plugin if you want ;)
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, it is possible. Look at the jump function in WorldEditArt.
    hoyinm14mc and Praxthisnovcht like this.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    public function onDamage(EntityDamageEvent $e){
      if(
    $e instanceof EntityDamageByChildEntityEvent){
        
    $child $e->getChild();
        if(
    $child instanceof Arrow){
          
    // explode at $child->getPosition()
        
    }
      }
    }
    Refer to https://github.com/PocketMine/Pocke...f9eca7/src/pocketmine/level/Explosion.php#L57 about the explosion. I am not sure that.
  8. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    Try use things like sugar cane
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    iksaku likes this.
  10. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
  11. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    Btw. how to center nametag?
  12. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Center NameTag? You can edit them, but I believe that hey're automatically rendered for players :/
  13. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
  14. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    I mean, how to center this?

    PHP:
    public function playerJoinInfo(PlayerJoinEvent $PJE) {
            if(
    $this->isInFaction($PJE->getPlayer()->getName()) == true) {
                
    $player $PJE->getPlayer();
                
    $faction $this->getPlayerFaction(strtolower($PJE->getPlayer()->getName()));
                
    $result $this->db->query("SELECT * FROM motd WHERE faction='$faction';");
                
    $array $result->fetchArray(SQLITE3_ASSOC);
                
    $isMultiWorldPermsEnabled $this->plugin->getPPConfig()->getValue("enable-multiworld-perms");
                
    $levelName $isMultiWorldPermsEnabled $player->getLevel()->getName() : null;
                
    $g $this->plugin->getUser($player)->getGroup($levelName)->getName();
                
    $nazwa $player->getName ();
                
    $player->setNameTag "• [$g$nazwa •\n $faction);
            }else{
            
    $player $PJE->getPlayer();
                
    $isMultiWorldPermsEnabled $this->plugin->getPPConfig()->getValue("enable-multiworld-perms");
                
    $levelName $isMultiWorldPermsEnabled $player->getLevel()->getName() : null;
                
    $g $this->plugin->getUser($player)->getGroup($levelName)->getName();
                
    $nazwa $player->getName ();
                
    $player->setNameTag "• [$g$nazwa •");
            }
        }
  15. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Well, in-game they're automatically centered :p so there's nothing we can do actually... I think
  16. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    nope $faction is not centred
  17. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    I do it!

    Here is the code!!!

    PHP:
    if($this->isInFaction($PJE->getPlayer()->getName()) == true) {
                
    $player $PJE->getPlayer();
                
    $faction $this->getPlayerFaction(strtolower($PJE->getPlayer()->getName()));
                
    $result $this->db->query("SELECT * FROM motd WHERE faction='$faction';");
                
    $array $result->fetchArray(SQLITE3_ASSOC);
                
    $isMultiWorldPermsEnabled $this->plugin->getPPConfig()->getValue("enable-multiworld-perms");
                
    $levelName $isMultiWorldPermsEnabled $player->getLevel()->getName() : null;
                
    $g $this->plugin->getUser($player)->getGroup($levelName)->getName();
                
    $nazwa $player->getName ();
                
    $gliczba strlen($g);
                
    $factionliczba strlen($faction);
                
    $nazwaliczba strlen($nazwa);
                
    $liczba $gliczba $nazwaliczba 7;
                
    $liczba1 $liczba 2;
                
    $liczbaf $factionliczba 2;
                
    $liczbakoniec $liczba1 $liczbaf;
                
    $spacja str_repeat(" "$liczbakoniec);
              
                
    $player->setNameTag "• [$g$nazwa •\n$spacja$faction);
    Now... can sameone help me with gun plugin?
    Last edited: Jan 18, 2015
  18. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    Thanks!!!
    Pemapmoder, you are awesome!
    i DONE Gun plugin and it works PERFECTLY!

    Thread can be closed :) Thanks !
    PEMapModder likes this.
  19. Samueljh1
    Offline

    Samueljh1 Active Member Plugin Developer

    Joined:
    Jan 9, 2015
    Posts:
    316
    Plugins:
    5
    Minecraft User:
    Samueljh1_
  20. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No. Read the link, it is PlayerInteractEvent.

Share This Page

Advertisement