Page 2 of 33 FirstFirst 123412 ... LastLast
Results 11 to 20 of 326

Thread: Vote Ban

  1. #11
    and yes thanks for the effort in making this plugin.. look forward to the future changes!

  2. #12
    Plugin Developer
    Join Date
    Oct 2010
    Location
    California
    Posts
    785
    Updated!

    0.7.5 (01/13/2012)
    • added the ability to enable Vote Kick
    • added an algorithm to suggest a player name upon the misspelling of a player's name while attempting a !voteban or !votekick
    • added the Hack Cry Responder feature

  3. #13
    Great plugin and works good! Thanks!
    Last edited by Gamertclan.nl; 13-01-2012 at 10:57.

  4. #14
    Plugin Developer
    Join Date
    Oct 2010
    Location
    California
    Posts
    785
    Quote Originally Posted by Gamertclan.nl View Post
    Great plugin and works good! Thanks!
    Great to hear! Thanks!

  5. #15
    great i am using it now instead of an old votekick plugin.

    wishlist :
    create a log file with (playername,server name,time,date,etc..) for either votekick or voteban.
    Last edited by HexaCanon; 13-01-2012 at 11:48.
    Feeding is my job.

  6. #16
    TimSad can I suggest another algorithm for finding the correct player name that's been found to be more convenient when used in-game with ProconRulz:
    E.g. to ban player "Bambam_ofc"

    1) Aggrieved player types: "!voteban bam"

    2) Plugin scans the list of names of ALL in-game players, looking for the string LOWERCASE("bam") ANYWHERE in each LOWERCASE(playername).

    3) if the plugin finds a SINGLE match, e.g. with playername "Bambam_ofc" then that playername is accepted and plugin proceeds with the vote without needing confirmation, giving the usual message "Voteban Bambam_ofc? Type !yes or !no"

    4) if the plugin finds NO matches, it says "No playername found matching "bam" for Voteban"

    5) if the plugin finds MULTIPLE matches, it only needs to keep one (e.g. the first) and says "Did you mean bamzleworzle?" etc

    This means you do not have to type the full player name to kick some hacker with an intentionally convoluted name, in your example event "!votekick ai" would work, and the code is not much more complicated than the code you have already.
    --------------------------------------------------------------
    For the ProconRulz Procon Plugin, always read the first post in the ProconRulz thread. See also the ONLINE DOCUMENTATION for information regarding writing your own rulz.

  7. #17
    Plugin Developer
    Join Date
    Oct 2010
    Location
    California
    Posts
    785
    bambam, I'll definitely look into that. Thanks!

  8. #18
    Member
    Join Date
    Sep 2011
    Location
    Germany
    Posts
    69
    Thanks for the great Job!

    I like it

    BamBam Great Idea

  9. #19
    Here is another suggestion for finding the best match for an input name, within a list of names.

    This is what I use Insane Limits for getting the best match for player names, and weapon names. It's similar to the algorithm used in spell-checker suggestions in word processing software (e.g Microsoft Word).

    http://en.wikipedia.org/wiki/Levenshtein_distance

    It uses a modified Levenshtein Distance algorithm where insertions and deletions are counted with 0 cost.

    You pass it a string, and a list of candidates to match.

    Code:
          String input = "Tommmmy";
          List<String> names = new List<String>(new String[] { "Timsad", "Milhouse", "Thomas", "etc" });
    
          int edit_distance = 0;
    
          String match = best_match(input, names, out edit_distance);
    The result match is the word from the list of names that best matches your input string. The edit_distance is the number of edit operations that need to be done in order to transform, the input string, into the matched string ... edit distance of 0 means is a perfect match ... the larger the edit distance, the less perfect the match is.

    Code:
    public string best_match(String name, List<String> names, out int best_distance)
    {
        best_distance = int.MaxValue;
    
        //do the obvious check first
        if (names.Contains(name))
        {
            best_distance = 0;
            return name;
        }
    
        //name is not in the list, find the best match
        String best_match = null;
    
        // first try to see if any of the names contains target name as substring, so we can reduce the search
        Dictionary<String, String> sub_names = new Dictionary<string, string>();
    
        String name_lower = name.ToLower();
    
        for (int i = 0; i < names.Count; i++)
        {
            String cname = names[i].ToLower();
            if (cname.Equals(name_lower))
                return names[i];
            else if (cname.Contains(name_lower) && !sub_names.ContainsKey(cname))
                sub_names.Add(cname, names[i]);
        }
    
        if (sub_names.Count > 0)
            names = new List<string>(sub_names.Keys);
    
        if (sub_names.Count == 1)
        {
            // we can optimize, and exit early
            best_match = sub_names[names[0]];
            best_distance = Math.Abs(best_match.Length - name.Length);
            return best_match;
        }
    
    
        // find the best/fuzzy match using modified Leveshtein algorithm              
        foreach (String cname in names)
        {
            int distance = LevenshteinDistance(name, cname);
            if (distance < best_distance)
            {
                best_distance = distance;
                best_match = cname;
            }
        }
    
    
        if (best_match == null)
            return null;
    
        best_distance += Math.Abs(name.Length - best_match.Length);
    
        // if we searched through sub-names, get the actual match
        if (sub_names.Count > 0 && sub_names.ContainsKey(best_match))
            best_match = sub_names[best_match];
    
        return best_match;
    }
    
    // modified algorithm to ignore insertions, and case
    
    public static int LevenshteinDistance(string s, string t)
    {
        s = s.ToLower();
        t = t.ToLower();
    
        int n = s.Length;
        int m = t.Length;
    
        int[,] d = new int[n + 1, m + 1];
    
        if (n == 0)
            return m;
    
        if (m == 0)
            return n;
    
        for (int i = 0; i <= n; d[i, 0] = i++) ;
        for (int j = 0; j <= m; d[0, j] = j++) ;
    
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= m; j++)
                d[i, j] = Math.Min(Math.Min(d[i - 1, j] + 1, d[i, j - 1] + 0), d[i - 1, j - 1] + ((t[j - 1] == s[i - 1]) ? 0 : 1));
    
        return d[n, m];
    }
    Last edited by micovery; 13-01-2012 at 22:09.

  10. #20
    Plugin Developer
    Join Date
    Oct 2010
    Location
    California
    Posts
    785
    Thanks for sharing, micovery! I think I'll try implementing that algorithm into my plugin for the next release. It's genius and makes lot of sense to me...

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •