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

Solved Check player message

Discussion in 'Development' started by Rysieku, Aug 28, 2017.

  1. Rysieku

    Rysieku Spider Jockey

    Messages:
    34
    GitHub:
    rysieku
    Hello.
    I want to check player message and then execute action. Code that i have does not do anything for me and there is no error in console. What is wrong?
    Code i got so far:
    PHP:
    foreach($this->bannedWords->getAll(true) as $bannedword) {
              if(
    stripos($message$bannedword) !== false) {
                if(
    $player->hasPermission("perm1") || $player->hasPermission("perm2") || $player->isOp()){
                  return 
    false;
                }
                else {
                  
    $event->setCancelled(true);
                  if(
    $this->getConfig()->getAll()["bad-words"] == "kick"){
                    
    $player->kick($this->betterColors("&""&c".$bwk));
                  }
                  else {
                    
    $player->sendMessage($this->betterColors("&""&c".$bwmsg));
                    return 
    true;
                  }
                }
     
  2. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    You have given us nothing to work with. Please provide more code.
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Here is a modified main file. If it doesn't work, then look at it and try to understand why. A poor formatting style doesn't help anyone.
     

    Attached Files:

  4. Rysieku

    Rysieku Spider Jockey

    Messages:
    34
    GitHub:
    rysieku
    Thanks, i am still learning how to code that is why i have poor formatting style
     
  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.