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

Send message to level

Discussion in 'Facepalm' started by rektpixel, Aug 26, 2017.

  1. rektpixel

    rektpixel Baby Zombie

    Messages:
    186
    Hello I was wondering how do I send a message to the level which $entity is in
    thanks :3
    ?????????:
    PHP:
                $level $entity->getLevel()->getPlayersInLevel();
                
    $level->sendMessage($entity->getNameTag() . " §ewas killed by " $damager->getNameTag());
    This gives me error:
    Code:
    [18:11:02] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\entity\EntityDamageByEntityEvent' to 'DeathView v0.0.2': Call to undefined method pocketmine\level\Level::getPlayersInLevel() on TheDiamondYT\DeathView\Loader
    [18:11:02] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\level\Level::getPlayersInLevel()" (EXCEPTION) in "/plugins/DeathView-master/src/TheDiamondYT/DeathView/Loader" at line 67
    
     
    Last edited: Aug 26, 2017
  2. Enes5519

    Enes5519 Spider Jockey

    Messages:
    28
    GitHub:
    Enes5519
    PHP:
    foreach($entity->getLevel()->getEntities() as $ent){
        if(
    $ent instanceof Player){
            
    $ent->sendMessage("write");
        }
    }
     
  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.