Checking for close name

Сообщения
278
Реакции
137
Hello, I have a problem about nicknames. People loves trolling people, so they do kind of jokes.
I want to block it.

1)
My nickname: PP | PurposeLess
User's nickname: PP | PurposeLess.

2)
User's nickname: Terminator1
Other user's nickname: Terminatorr2

How can I check their nicknames if there is close nickname?
I wanted to check containi(blabla but it didnt' work
because we use prefix like PP |.

+ I kind of messed up. Hope you understand.
 
Последнее редактирование:
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
А зачем, если троллинг уже произошел.
 
Сообщения
278
Реакции
137
Они всегда троллинг. Я хочу, чтобы они не делали себе псевдоним близко к другому игроку.
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Сообщения
278
Реакции
137
fl0wer,
Sometimes i may not be playing in the server and they make their nicknames almost same people's nicknames.
I'd like to fix this problem. Can't I check their nickname if they have almost same nicknames or not?
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Сообщения
278
Реакции
137
According to me, if it would be called while connecting (client_connectex) just 1 times, it may not discrease performance, may it?
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Сообщения
278
Реакции
137
Actually i won't change their nicknames.
I will kick them if they are.
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Сообщения
584
Реакции
1,006
Помог
18 раз(а)
PurposeLess, try to make plugin with it.
Код:
#include <amxmodx>

public plugin_init()
{       
    register_concmd("test", "test");
}

public test()
{
    server_print("test #1 %d", LevenshteinDistance("Mistrick", "M1st       rick"));
    server_print("test #2 %d", LevenshteinDistance("Mistrick", "SuperNick"));
    server_print("test #3 %d", LevenshteinDistance("Mistrick", "Mistrick"));
    server_print("test #5 %d", LevenshteinDistance("PP | PurposeLess", "PP | PurposeLess."));
    server_print("test #6 %d", LevenshteinDistance("Terminator1", "Terminatorr2"));
}

stock LevenshteinDistance(source[], target[])
{
    remove_symbols(source, " ;,.[]`'^"");
    remove_symbols(target, " ;,.[]`'^"");
    
    new min_size, max_size;
    min_size = strlen(source);
    max_size = strlen(target);

    if (min_size > max_size) {
        return LevenshteinDistance(target, source);
    }

    // size (min_size + 1)
    new lev_dist[512];

    for (new i = 0; i <= min_size; ++i) {
        lev_dist[i] = i;
    }

    for (new j = 1; j <= max_size; ++j) {
        new previous_diagonal = lev_dist[0], previous_diagonal_save;
        ++lev_dist[0];

        for (new i = 1; i <= min_size; ++i) {
            previous_diagonal_save = lev_dist[i];
            if (source[i - 1] == target[j - 1]) {
                lev_dist[i] = previous_diagonal;
            } else {
                lev_dist[i] = min(min(lev_dist[i - 1], lev_dist[i]), previous_diagonal) + 1;
            }
            previous_diagonal = previous_diagonal_save;
        }
    }

    return lev_dist[min_size];
}

stock remove_symbols(string[], symbols[])
{
    new len = 0;
    new slen = strlen(symbols);
    for (new i; string[i] != EOS; i++) {
        // remove repetitions
        if(i && string[i] == string[i - 1]) {
            continue;
        }
        
        new stop = false;
        for(new j; j < slen; j++) {
            if(string[i] == symbols[j]) {
                stop = true;
                break;
            }
        }
        if(stop) {
            continue;
        }
        
        string[len++] = string[i];
    }
    string[len] = EOS;
}
Output
Код:
test
test #1 1
test #2 5
test #3 0
test #5 0
test #6 1
 
Сообщения
213
Реакции
71
Помог
2 раз(а)
I don't know how helpful will be this, just a guess !!
Try blocking nicks as Setinfo Pass + Clan Tags (ab).

"PP |" "setinfopass" "b" "ab" ;
"Terminator" "setinfopass" "b" "ab" ;
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу