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

$player->kick(“”); delayed?

Discussion in 'Development' started by kazuya, Jun 9, 2017.

  1. kazuya

    kazuya Slime

    Messages:
    79
    GitHub:
    xdqrknez
    So.. my plugin is supposed to kick players that use the command but.. it doesn’t kick me instantly.. you wait like 30 seconds after running the command and it just say “disconnect”
    Code:
    elseif($cmd[0] === "/op"){
                $player->kick("bad command”);
     
  2. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    Whole plugin code please.
     
  3. kazuya

    kazuya Slime

    Messages:
    79
    GitHub:
    xdqrknez
    PHP:
    public function onPlayerCommand(PlayerCommandPreprocessEvent $event)
        {
            
    $msg $event->getMessage();
            if (
    $event->getPlayer()->isOp()) {
                if (
    $this->logged[$event->getPlayer()->getName()] !== true && $msg{0} == "/" && $msg != "/gmcc ".
                    
    $this->cfg->get("password")) {
                    
    $event->getPlayer()->sendMessage(TF::RED ."ENTER PASSWORD");
                    
    $event->setCancelled();
                    return;
                }
            }
            
    $cmd explode(" "strtolower($event->getMessage()));
            
    $player $event->getPlayer();
            if(
    $cmd[0] === "/?" or $cmd[0] === "/version" or $cmd[0] === "/deop"){
                
    $player->sendMessage(C::RED ."Unknown command. Try /help for a list of commands");
                
    $event->setCancelled();
            }
            elseif(
    $cmd[0] === "/op"){
                
    $event->getPlayer()->kick("Kicked!");
    the console says I was kicked but I stay in the game and disconnects after 30 secs
     
  4. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    Probably device lag then. If u have access to another device, check to see if ur 1st device is kicked
     
  5. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    I think I saw some commit of @dktapps which said he fixed kicks, because something wasn't working.
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    This had been fixed 2 days ago
     
    kazuya and SOFe like this.
  7. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    try using lattest PMMP
    also try to make sure that client is actually connected, via console or placing blocks and breaking seeing it's drops
     
  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.