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

PlayerChatEvent

Discussion in 'Development' started by CocoonBuilder, Nov 4, 2018.

  1. CocoonBuilder

    CocoonBuilder Spider Jockey

    Messages:
    43
    GitHub:
    chimneychuckles
    is it possible to make player type in chat using code?
     
  2. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Make a command named /send and add that
    PHP:
    $commandToRun array_shift($args);
    if(
    $commandToRun === "message"){
        
    $event = new pocketmine\event\player\PlayerChatEvent($senderimplode(" "$args));
        
    $this->getServer()->getPluginManager()->callEvent($event);
    }
    so if you do /send message This is a test
    You will say "This is a test"
     
  3. CocoonBuilder

    CocoonBuilder Spider Jockey

    Messages:
    43
    GitHub:
    chimneychuckles
    but what if i want to make myself say something after i say something. For example if i say hi in chat then i will say bye after
     
  4. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    I told you how to do it with the command. The code is still same.
    PHP:
        $event = new pocketmine\event\player\PlayerChatEvent($player"bye");
        
    $this->getServer()->getPluginManager()->callEvent($event);
     
    NutXzG likes this.
  5. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Uhm?
    PHP:
    $player->chat("hi");
     
  6. CocoonBuilder

    CocoonBuilder Spider Jockey

    Messages:
    43
    GitHub:
    chimneychuckles
    that simple?
     
    Muqsit likes this.
  7. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Omg, pocketmine is so simple...
     
    Muqsit likes this.
  8. RoccoYT

    RoccoYT Spider

    Messages:
    14
    GitHub:
    RoccoTheDev
  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.