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

2Command controls

Discussion in 'Development' started by SkyArt4, Dec 31, 2016.

  1. SkyArt4

    SkyArt4 Silverfish

    Messages:
    16
    GitHub:
    nadaree
    1 Command control is possible. But 2 Command Controls greater than can not...
    Please tell me.
    (/tell,/whisper is use)
    PHP:
    public function playerCommand(PlayerCommandPreprocessEvent $event) {
    $m $event->getMessage();
    $nan $user->getName();
    $user $event->getPlayer();
    if(
    substr($m05) === "/tell"){
    }
    Incidentally I want make /tell,/whisper to show.
     
  2. eDroid

    eDroid Witch

    Messages:
    59
    GitHub:
    edroiid
    can you describe a bit more? you're trying to make /tell messages to be shown to the public?
     
    applqpak likes this.
  3. SkyArt4

    SkyArt4 Silverfish

    Messages:
    16
    GitHub:
    nadaree
    Op Only to public.
     
  4. eDroid

    eDroid Witch

    Messages:
    59
    GitHub:
    edroiid
    You want a plugin that broadcasts the /tell messages to all ops?
     
    applqpak likes this.
  5. SkyArt4

    SkyArt4 Silverfish

    Messages:
    16
    GitHub:
    nadaree
    ./whisper also message to all ops. Sorry for bad explanation.
     
    Last edited: Dec 31, 2016
  6. applqpak

    applqpak Spider Jockey

    Messages:
    27
    GitHub:
    applqpak
    Why not unregister/register the command, instead of using a hackish way(CommandPreprocess) :)
     
  7. eDroid

    eDroid Witch

    Messages:
    59
    GitHub:
    edroiid
    i think he wants the /tell commands to send the messages to the ops
     
    applqpak likes this.
  8. applqpak

    applqpak Spider Jockey

    Messages:
    27
    GitHub:
    applqpak
    PHP:
    public function playerCommand(PlayerCommandPreprocessEvent $event)
    {
      
    $cmd    explode(' 'strtolower($event->getMessage()));
      
    $player $event->getPlayer();
      if(
    $cmd[0] === '/tell' || $cmd[0] === '/whisper')
      {
        foreach(
    $this->getServer()->getOnlinePlayers() as $p)
        {
          if(
    $p->isOp())
          {
            
    $p->sendMessage($player->getName() . ': ' implode(' '$cmd));
          }
        }
      }
    }
     
    HimbeersaftLP and SkyArt4 like this.
  9. SkyArt4

    SkyArt4 Silverfish

    Messages:
    16
    GitHub:
    nadaree
    I was able. Thank You !
     
    applqpak likes 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.