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

How to add subcommand player name

Discussion in 'Development' started by Besher, Sep 28, 2020.

  1. Besher

    Besher Witch

    Messages:
    51
    how do i make it so that for example i do
    /test (playername)
    sends to player hi
     
  2. Taco

    Taco Spider Jockey

    Messages:
    41
    GitHub:
    taconoburrito
    Its Really Simple :)

    simply do this
    PHP:
    //this code gets the player from the first argument
    $player $this->getServer()->getPlayer($args[0]);
                if (
    $player == null) {// this code  checks if the player exists or is online
                    
    $sender->sendMessage("That Player Is Not Online");//if not online tell the player sending the command they arent online
                    
    return true;
                }
    $player->sendMessage("hi");//if the player is online, it will send them the message
     
    minijaham and Besher like this.
  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.