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

PreProcessCommand

Discussion in 'Development' started by Levi, Jun 30, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    how do u check if the command sent is /op
    PHP:
    i tried
    $player 
    $event->getPlayer();
    $message $event->getMessage();
    if (!
    strpos($message"/op")) {
                    
    $player->sendMessage("ok");

                }else{
                    
    $player->sendMessage("kick");
                }
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Use PlayerCommandPreprocessEvent (what a long event name :oops:) and check if

    explode(" ", $message, 2)[0] equals "/op".
     
  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.