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 Hipster, Aug 31, 2017.

  1. Hipster

    Hipster Zombie

    Messages:
    214
    I am cancelling preprocess event and making my own /help messages but when i type an $args[1] it says 'Invalid Command Syntax' can't find the problem
     
  2. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    If you need help, write here your code.
     
  3. Hipster

    Hipster Zombie

    Messages:
    214
    PHP:
    $command explode(" "strtolower($event->getMessage()));
    if(
    strtolower($command[0]) === "/help" or strtolower($command[0]) === "/?") {
              
    $event->setCancelled();
    if(isset(
    $command[1])) {
     if(
    strtolower($command[1]) === "hero") {
      
    $page_s_messages $this->pl->help->get("page_32");
      
    $player->sendMessage(Color::YELLOW.$page_s_messages["message_1"]);
    }
    }
     
  4. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    Try use only two instead of three =, and $event->setCancelled move to the end of the code.
     
    Last edited: Aug 31, 2017
  5. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    There is no problem with the three ===
     
    Kyd, Teamblocket, SOFe and 1 other person like this.
  6. Rysieku

    Rysieku Spider Jockey

    Messages:
    34
    GitHub:
    rysieku
    PHP:
    $command explode(" "strtolower($event->getMessage()));
    if(
    strtolower($command[0]) === "/help" or strtolower($command[0]) === "/?") {
              
    $event->setCancelled();
    if(isset(
    $command[1])) {
     if(
    strtolower($command[1]) === "hero") {
      
    $page_s_messages $this->pl->help->get("page_32");
      
    $player->sendMessage(Color::YELLOW.$page_s_messages["message_1"]);
    }
    }
    }
    If this will not work then send more code.
     
  7. Hipster

    Hipster Zombie

    Messages:
    214
    i think it has something to do with mcpe v1.1 because it used to work in earlier versions of mcpe
     
  8. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    $cmd = strtolower(explode(' ', $event->getMessage())[0]);
    $test = explode(' ', $event->getMessage());
    $data = str_replace($cmd, "", $test);
    $args = $data;
    now you do the code
     
  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.