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

Join UI

Discussion in 'Development' started by IchHackeNet, Jun 20, 2020.

  1. IchHackeNet

    IchHackeNet Creeper

    Messages:
    5
    GitHub:
    IchHackeNetDEV
    i how can i make a UI plugin that automatically appears when users joining
     
  2. Secretsilver313

    Secretsilver313 Silverfish

    Messages:
    18
    GitHub:
    secretsilver
    Use the function onPlayerJoinEvent. Make it open the UI when a player joins.
     
  3. Emirhan Akpınar

    Emirhan Akpınar Slime

    Messages:
    90
    You must add delay with task. If you send form when player join the game without delay, it is not showing up to player. You must use least 1 second delay.
     
    Seeker and Levi like this.
  4. nexTRushh

    nexTRushh Creeper

    Messages:
    3
    GitHub:
    itzahmaddev
    You could send it in First movement and save in a config if it shows and if the Player leaves it would save again in a config
     
  5. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    Hello, you should use this in use's (under name space in your Main.php):
    PHP:
    use pocketmine\Player//if you didin't use it befor... its for getting player.
    use pocketmine\event\player\PlayerJoinEvent//and its for join event
    use jojoe77777\FormAPI//its for creating ui forms.
    so now you need use this code to Create Form :
    PHP:
    public function JoinMenuUiForm(Player $player)
    {
        
    $form $this->getServer()->getPluginManager()->getPlugin("FormAPI")->createSimpleForm(function (Player $playerint $data null) {
            if (
    $data === null) {
                return;
            }
            switch (
    $data) {
                case 
    "1":
                    
    //do some thing stuff
                    
    break;
                case 
    "2":
                    
    //do some thing stuff .
                    
    break;
            }
        });
        
    $form->addTitle("§aHello Player");
        
    $form->setContent("Welcome to BrokenEnchant Server, Please Dont use badwords on server.");
        
    $form->addButton("§aOk, Lets Play.");
        
    $form->addButton("§cBack");
        
    $form->sendToPlayer($player);
        return 
    $form;
    }
    and then you should use JoinEvent Like this code:
    PHP:
    public function GodWeedZao(PlayerJoinEvent $event) {
        if (
    $event->getPlayer() instanceof Player) {
            
    $this->JoinMenuUiForm($event->getPlayer());
            
    //Every thing is Done!
        
    }
    }
    Enjoy The Plugin, Lol :p;)
     
  6. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    if you have any question, just tag me :)
     
  7. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    oh, sorry i didnt say, befor create plugin you should install FormAPI (by jojoe77777).
    also dont forget to register events.
     
  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.