1. Welcome to Game Makers Forums

    Whether you are a new, amateur or professional developer, you will find your place here.

    Register to Download Sample Code or Advertise your Project.

    Register also gives you the ability to be helped or help others:

    Dismiss Notice

Chat ban & mute

Discussion in 'DWM News' started by a_bertrand, May 22, 2017.

  1. a_bertrand

    a_bertrand Administrator

    Joined:
    Oct 28, 2014
    Messages:
    1,264
    Likes Received:
    562
    Trophy Points:
    113
    Gender:
    Male
    Implemented chat ban and mute API commands. You should implement a chat bot to intercept some commands allowing you to ban annoying players:

    The ban command (trigger: /ban)
    Code (Text):
    1. function Answer(line)
    2. {
    3.     if(!(Player.hasRole("moderator") || Player.hasRole("admin")))
    4.         return "";
    5.       var words=Chat.SplitLine(line);
    6.     if(Array.Count(words) != 3)
    7.     {
    8.        return "!Syntax /ban <username> <days>";
    9.     }
    10.  
    11.     Chat.Ban(words[1], words[2]);
    12.     return "/"+words[1]+" has been banned for "+words[2]+" day(s).";
    13. }
    The mute command: (trigger: /mute)
    Code (Text):
    1.  
    2. function Answer(line)
    3. {
    4.     if(!(Player.hasRole("moderator") || Player.hasRole("admin")))
    5.         return "";
    6.       var words=Chat.SplitLine(line);
    7.     if(Array.Count(words) != 3)
    8.     {
    9.        return "!Syntax /mute <username> <minutes>";
    10.     }
    11.  
    12.     Chat.Mute(words[1], words[2]);
    13.     return "/"+words[1]+" has been muted for "+words[2]+" minute(s).";
    14. }
    For those super lazy one, I attached an extension creating those for you.
     

    Attached Files:

Share This Page