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

[Solved] Hide and Unhide players

Discussion in 'Requests' started by AndroidBuilder, Apr 26, 2017.

Thread Status:
Not open for further replies.
  1. AndroidBuilder

    AndroidBuilder Spider

    Messages:
    6
    Hello Im new!!!!!!:). And I would like a plugin that when a player joins the server they will be given a clock. This item can hide and unhide players. When the player tap the ground by holding the clock all players will be hidden and when the player tap the ground with the clock again all players will be unhidden:):).
     
  2. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    add the item :
    PHP:
    use pocketmine item\Item;
    use 
    pocketmine\event\player\PlayerJoinEvent;

    public function 
    onJoin(PlayerJoinEvent $event){
     
    $event->getPlayer()->getInventory()->addItem(Item::get(347,0,1));
    }
    Then on Interact:
    1) Hide the Player
    PHP:
    if($event->getPlayer()->getInventory()->getItemInHand()->getId()=== 347){
                foreach(
    $this->getServer()->getOnlinePlayers() as $players){
                    
    $player->hidePlayer($players);
                }
            }
    2) Show The Player
    PHP:
    if($event->getPlayer()->getInventory()->getItemInHand()->getId()=== 347){
                foreach(
    $this->getServer()->getOnlinePlayers() as $players){
                    
    $player->showPlayer($players);
                }
            }
     
  3. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    Oohhhh no :facepalm:, i thought it was in the Developpement section :facepalm:
     
  4. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    AndroidBuilder likes this.
  5. AndroidBuilder

    AndroidBuilder Spider

    Messages:
    6
  6. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    Stop manipulating IDs directly. Use a BlockIds constant.
     
    Lewis Brindley likes this.
  7. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    BlockIds -> ItemIds :)
     
  8. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    ??? I meant to use \pocketmine\item\Item::CLOCK
     
  9. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    What's the point of this discussion? Who's talking about inheritance? I corrected myself
    or

    \pocketmine\block\Block::CLOCK -> \pocketmine\item\Item::CLOCK

    That's all...
     
Thread Status:
Not open for further replies.
  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.