Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

add mute?

Comments in 'Plugin Development' started by CaptainKenji17, Nov 10, 2015.

  1. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    PHP:
      public function onChat(PlayerChatEvent $ev){
        
    $p $ev->getPlayer();
        
    $badwords = array("fys");
        
    $msg explode(" ",$ev->getMessage());
        foreach(
    $msg as $word){
        foreach(
    $badwords as $m){
        if(
    strtolower($word) === $m){
        
    $p->getServer()->broadcastMessage("§e-§cStop that swearing§a ".$p->getName());
            }
    if player player says $badwords again, the plugin will mute him for 5 minutes.
    how do you do that? Im bad at timing code
  2. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    idk?neven u tell me learn php idek im learning by looking code so can you copy the code up there and paste and recode it with 5 min mute and ill do the other maybe?
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I think using time() is better, since you are checking whether something has expired when something hapepns.
    Gamecrafter likes this.
  4. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    can you copy the code above and recode it with time()? i wanna see how it works, I cant learn looking pm docs or that php.net I can learn by looking examples, well yeah some site that teaches php do examples but its different to PM so idek
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    date()? date() is for formatting timestamps. How does that have anything to do with muting?

Share This Page

Advertisement