1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Help!!!

Discussion in 'Development' started by ExplodingSquad, Nov 20, 2017.

  1. ExplodingSquad

    ExplodingSquad Spider

    Messages:
    13
    GitHub:
    CreeperAsGaming
    How can do I if a player is tapped they get a op ban etc commands
     
  2. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Your title says “Help!!!” and you ask a question like that ;-;
    Any previous attempts?
    Rename your title to something more descriptive
     
  3. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    If you’re trying to give the player OP when he/she gets hit by another player, try this code:

    PHP:
    use pocketmine\event\entity\EntityDamageByEntityEvent// don’t forget to add the event’s class (and register the Listener)

    public function onEntityDamage(EntityDamageByEntityEvent $event) {
        
    $damager $event->getDamager();
        
    $entity $event->getEntity();
        if(
    $damager instanceof Player && $entity instanceof Player) { // if damager and hit entity are players
            
    $entity->setOp(); // gives the hit player OP
        
    }
    }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.