не все сообщения пишуться в чат

makcumoc

Пользователь
Регистрация
10 Июл 2017
Сообщения
117
Симпатии
21
Пол
Мужской
OS
Linux
Amx Mod X
ReAMXX 1.8.3
Билд
Exe version 1.1.2.7/Stdio (cstrike) ReHLDS version: 3.4.0-dev+m Build date: 15:08:41 Oct 22 2018 (1654)
ReGamedll
ReGameDLL version: 5.7.0.312-dev
Metamod
Metamod v1.21p37 2013/05/30 (5:13)
Meta модули
Код:
[ 1] SafeNameAndChat RUN - safenameandchat. v1.0 ini ANY
[ 2] VoiceTranscoder RUN - vtc.so v2017RC3 ini ANY
[ 3] ReSemiclip RUN - resemiclip.so v2.3.9 ini ANY
[ 4] Rechecker RUN - rechecker.so v2.5 ini ANY
[ 5] Reunion RUN - reunion.so v0.1.75 ini Start Never
[ 6] WHBlocker RUN - whblocker_mm_i38 v1.5.695 ini ANY
[ 7] ReAuthCheck RUN - reauthcheck.so v0.1.6 ini Start Never
[ 8] AMX Mod X RUN - amxmodx.so v1.9.0.5 ini ANY
[ 9] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0.5 pl8 ANY
[10] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl8 ANY
[11] MySQL RUN - mysql_amxx_i386. v1.9.0.5 pl8 ANY
[12] ReAPI RUN - reapi_amxx_i386. v5.6.0.1 pl8 ANY Never
[13] CSX RUN - csx_amxx_i386.so v1.9.0.5 pl8 ANY
[14] Engine RUN - engine_amxx_i386 v1.9.0.5 pl8 ANY
[15] CStrike RUN - cstrike_amxx_i38 v1.9.0.5 pl8 ANY
[16] Fun RUN - fun_amxx_i386.so v1.9.0.5 pl8 ANY
[17] ReAimDetector RUN - reaimdetector_am v0.2.2 pl8 ANY Never
Плагины
Код:
1] Trial Access 10.04.18 mx?! trial_access.am running
[ 2] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am running
[ 3] Admin Loader 3.5 neygomon admin_loader_fo running
[ 4] FreshBans 1.3.9b kanagava fresh_bans.amxx running
[ 5] Ultimate Chats Control 4.6 neygomon ucc.amxx running
[ 6] Stats Configuration 1.9.0.5235 AMXX Dev Team statscfg.amxx running
[ 7] Micro Army Rank System 1.29Hz_p1 Ge3eR MARS_1.29Hz.amx running
[ 8] Menus Front-End 1.5 neugomon menufront_end.a running
[ 9] Players Menu 1.7 neugomon players_menu.am running
[ 10] resetscore(ReAPI) 1.0 Phantom resetscore.amxx running
[ 11] Aliases checker 0.8.2 kanagava alias_checker.a running
[ 12] Auto Demo Recorder 2.2.1 F@nt0M auto_demo_recor running
[ 13] Mode 2x2 2.5re s1lent mode_2x2.amxx running
[ 14] Screen Fade [True Flas 1.0 Leo_[BH] screen_fade_fla running
[ 15] [ReAPI] Random Weapons 2.4.9 neugomon/h1k3 random_weapons_ running
[ 16] Advanced MapChooser 1.1.1 neygomon map_chooser.amx running
[ 17] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 18] Admin Votes 1.9.0.5235 AMXX Dev Team adminvote.amxx running
[ 19] Radio Hudmsg Block 1.0 AcE radio_hudmsg_bl running
[ 20] OciXCrom's Admin Chat 3.1 OciXCrom adminchat.amxx running
[ 21] Chat Manager 1.1.1-11 Mistrick chatmanager.amx running
[ 22] Chat Manager: Addon 0.0.4-70 Mistrick chatmanager_add running
[ 23] fb_forwards 0.1.4 Kanagava & Realu fb_forwards.amx running
[ 24] Admin Free Look 2.0 Jim admin_free_look running
[ 25] Team Balance Control 1.3.9 gyxoBka TeamBalanceCont running
[ 26] Plugins Controller 1.0 neygomon plugins_control stopped
[ 27] V.I.P Custom Weapons 1.0.0 Vaqtincha vip_custom.amxx running
[ 28] Lite VoteBan 1.4 neygomon lite_voteban.am running
[ 29] Afk Control 0.5.1 neygomon afk_control.amx running
[ 30] Lite Admin ESP 1.0 neygomon admin_esp.amxx running
[ 31] Win Messages Sounds 1.1 OciXCrom win_messages_so running
[ 32] Adverts 1.0 pUzzlik adverts_message running
[ 33] Grenade Kill 1.0 Sho0ter he.amxx running
[ 34] Block All Adverts 1.3 neygomon block_all_adver running
[ 35] kill sound 1.0 LorGenom kill_sound.amxx running
[ 36] Restrict Weapons 1.8.3-Re AMXX Dev Team restmenu.amxx running
[ 37] hl_weapon_physics 0.6 Turanga_Leela hl_weapon_physi running
[ 38] Say me and Say hp 1.4 neygomon sayme_reapi.amx running
[ 39] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 40] [ReAPI] No Team Flash 0.0.2 Vaqtincha no_team_flash.a running
[ 41] Parachute for ALL [ReA 3.0 Leo_[BH] parachute_for_a running
[ 42] [ReAPI] AWPoff 1.4.1 PAffAEJIkA :3 awp_off_t.amxx running
[ 43] Weapon Skin System 0.6.0-50 Mistrick weapon_skin_sys running
[ 44] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
[ 45] Models Replacement 0.0.2 ConnorMcLeod | V models_replacem running
[ 46] Steam Bonus 1.12 neygomon bonus_steam.amx running
[ 47] BhopHack Detector 0.1 Mistrick bhophack_detect running
[ 48] Auto-Give Privileges 1.0 SerGrib night_vips.amxx running
[ 49] Custom Smoke 1.05 bionext custom_smoke.am running
[ 50] Recoil Control 1.5 OT recoil_control. running
[ 51] AES: StatsX 0.5 Vega serfreeman1337 aes_statsx.amxx running
[ 52] C4 Timer on roundtime 0.3.3a neygomon c4timer.amxx running
[ 53] Anticheat 3.1.6 ctr52 anticheat.amxx running
[ 54] Block Pickup Gold 0.1 Vaqtincha BlockPickupGold running
[ 55] unknown unknown unknown statsx.amxx bad load
[ 56] V.I.P Custom KNIFE 1.0.0 Vaqtincha custom_knife.am debug
[ 57] V.I.P Custom DEAGLE 1.0.0 Vaqtincha custom_deagle.a debug
[ 58] V.I.P Custom M4A1 1.0.0 Vaqtincha custom_m4a1.amx debug
[ 59] V.I.P Custom AK-47 1.0.0 Vaqtincha custom_ak47.amx debug
[ 60] V.I.P Custom AWP 1.0.0 Vaqtincha custom_awp.amxx debug
( 55) Load fails: Plugin file open error (plugin "")
Amxx Модули
Код:
[ 1] nVault 1.9.0.5235 AMX Mod X Dev Team running
[ 2] FakeMeta 1.9.0.5235 AMX Mod X Dev Team running
[ 3] Ham Sandwich 1.9.0.5235 AMX Mod X Dev Team running
[ 4] MySQL 1.9.0.5235 AMX Mod X Dev Team running
[ 5] ReAPI 5.6.0.160- Asmodai & s1lent running
[ 6] CSX 1.9.0.5219 AMX Mod X Dev Team running
[ 7] Engine 1.9.0.5235 AMX Mod X Dev Team running
[ 8] CStrike 1.9.0.5219 AMX Mod X Dev Team running
[ 9] Fun 1.9.0.5235 AMX Mod X Dev Team running
[10] ReAimDetector 0.2.2 ReHLDS Team running
[11] RegEx 1.9.0.5235 AMX Mod X Dev Team running
11 modules, 11 correct
Ошибка
Код:
нет ошибок
Исходник
Код:
Код:
/**
* Credits: Subb98.
*/
#include <amxmodx>
#include <regex>

#define PLUGIN "Chat Manager: Addon"
#define VERSION "0.0.4-70"
#define AUTHOR "Mistrick"

#pragma semicolon 1

enum
{
    MESSAGE_IGNORED,
    MESSAGE_CHANGED,
    MESSAGE_BLOCKED
};

forward cm_player_send_message(id, message[], team_chat);
native cm_set_player_message(message[]);

//#define FUNCTION_BLACK_LIST
#define FUNCTION_BLOCK_IDENTICAL_MSG
#define FUNCTION_BLOCK_ADVERTISING
//#define FUNCTION_BLOCK_CAPS

// TODO: Remove this func from main plugin
//#define FUNCTION_LOG_MESSAGES

#define MAX_IDENTICAL_MESSAGES 3
#define MIN_MESSAGE_DELAY 0.1 // seconds
#define MAX_WARNINGS_TO_BLOCK_CHAT 5
#define BLOCK_CHAT_TIME 15.0 // seconds
#define MAX_CAPS_PERCENT 90

#define IP_LEN 22
#define DOMAIN_LEN 32

new Float:g_fLastMsgTime[33];
new g_iWarnings[33];
new Float:g_fBlockTime[33];

#if defined FUNCTION_BLACK_LIST
new const FILE_BLACK_LIST[] = "chatmanager_blacklist.ini";
new Array:g_aBlackList;
new g_iBlackListSize;
#endif // FUNCTION_BLACK_LIST

#if defined FUNCTION_BLOCK_IDENTICAL_MSG
new g_sLastMessage[33][128];
new g_iRepeatWarn[33];
#endif // FUNCTION_BLOCK_IDENTICAL_MSG

#if defined FUNCTION_BLOCK_ADVERTISING
new const FILE_WHITE_LIST[] = "chatmanager_whitelist.ini";
new Array:g_aWhiteListIp;
new Array:g_aWhiteListDomain;
new g_iWhiteListIpSize;
new g_iWhiteListDomainSize;
new Regex:g_rIpPattern;
new Regex:g_rDomainPattern;
#endif // FUNCTION_BLOCK_ADVERTISING

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
}

public plugin_cfg()
{
    #if defined FUNCTION_BLACK_LIST
    LoadBlackList();
    #endif // FUNCTION_BLACK_LIST

    #if defined FUNCTION_BLOCK_ADVERTISING
    new error[2], ret;
    g_rIpPattern = regex_compile("(?:\s*\d+\s*\.){3}", ret, error, charsmax(error));
    g_rDomainPattern = regex_compile("(?:[A-z]){2,}\.(?:[A-z]){2,}", ret, error, charsmax(error));
    LoadWhiteList();
    #endif // FUNCTION_BLOCK_ADVERTISING
}

#if defined FUNCTION_BLACK_LIST
LoadBlackList()
{
    g_aBlackList = ArrayCreate(64, 1);

    new file_path[128]; get_localinfo("amxx_configsdir", file_path, charsmax(file_path));
    format(file_path, charsmax(file_path), "%s/%s", file_path, FILE_BLACK_LIST);

    new file = fopen(file_path, "rt");

    if(file)
    {
        new buffer[64], wchar[64];
        while(!feof(file))
        {
            fgets(file, buffer, charsmax(buffer));
            trim(buffer); remove_quotes(buffer);

            if(!buffer[0] || buffer[0] == ';' || strlen(buffer) < 3) continue;

            normalize_string(buffer);
            multibyte_to_wchar(buffer, wchar);
            wchar_tolower_rus(wchar);
            wchar_to_multibyte(wchar, buffer);

            ArrayPushString(g_aBlackList, buffer);
            g_iBlackListSize++;
        }
        fclose(file);
    }
}
#endif // FUNCTION_BLACK_LIST

#if defined FUNCTION_BLOCK_ADVERTISING
LoadWhiteList()
{
    g_aWhiteListIp = ArrayCreate(IP_LEN, 1);
    g_aWhiteListDomain = ArrayCreate(DOMAIN_LEN, 1);

    new file_path[128]; get_localinfo("amxx_configsdir", file_path, charsmax(file_path));
    format(file_path, charsmax(file_path), "%s/%s", file_path, FILE_WHITE_LIST);

    new file = fopen(file_path, "rt");

    enum
    {
        READ_NON,
        READ_DOMAIN,
        READ_IP
    };

    if(file)
    {
        new buffer[64], type = READ_NON;
        while(!feof(file))
        {
            fgets(file, buffer, charsmax(buffer));
            trim(buffer); remove_quotes(buffer);

            if(!buffer[0] || buffer[0] == ';') continue;

            if(contain(buffer, "[ips]") > -1)
            {
                type = READ_IP;
                continue;
            }
            if(contain(buffer, "[domains]") > -1)
            {
                type = READ_DOMAIN;
                continue;
            }

            if(type)
            {
                ArrayPushString(type == READ_IP ? g_aWhiteListIp : g_aWhiteListDomain, buffer);
            }
        }
        fclose(file);

        g_iWhiteListIpSize = ArraySize(g_aWhiteListIp);
        g_iWhiteListDomainSize = ArraySize(g_aWhiteListDomain);
    }
}
#endif // FUNCTION_BLOCK_ADVERTISING


public client_connect(id)
{
    g_fLastMsgTime[id] = 0.0;
    g_iWarnings[id] = 0;
    g_fBlockTime[id] = 0.0;

    #if defined FUNCTION_BLOCK_IDENTICAL_MSG
    g_iRepeatWarn[id] = 0;
    #endif // FUNCTION_BLOCK_IDENTICAL_MSG
}

public cm_player_send_message(id, message[])
{
    new Float:gametime = get_gametime();

    if(gametime < g_fBlockTime[id])
    {
        return MESSAGE_BLOCKED;
    }

    if(gametime < g_fLastMsgTime[id] + MIN_MESSAGE_DELAY)
    {
        client_print(id, print_chat, "[CMA] Stop spamming!");
        add_warning(id);
        return MESSAGE_BLOCKED;
    }
    g_fLastMsgTime[id] = gametime;

    #if defined FUNCTION_BLOCK_IDENTICAL_MSG
    if(equal(message, g_sLastMessage[id]))
    {
        if(++g_iRepeatWarn[id] >= MAX_IDENTICAL_MESSAGES)
        {
            client_print(id, print_chat, "[CMA] Stop spamming! Identical msg.");
            add_warning(id);
            return MESSAGE_BLOCKED;
        }
    }
    else if(g_iRepeatWarn[id])
    {
        g_iRepeatWarn[id]--;
    }
    copy(g_sLastMessage[id], charsmax(g_sLastMessage[]), message);
    #endif // FUNCTION_BLOCK_IDENTICAL_MSG

    #if defined FUNCTION_BLOCK_CAPS
    static _wchar_msg[128];

    normalize_string(message);
    multibyte_to_wchar(message, _wchar_msg);

    new i, uppercase;
    while(_wchar_msg[i])
    {
        if(wchar_is_uppercase(_wchar_msg[i]))
            uppercase++;
        i++;
    }

    if(uppercase * 100.0 / i >= MAX_CAPS_PERCENT)
    {
        client_print(id, print_chat, "[CMA] Stop using caps!");
        add_warning(id);
        return MESSAGE_BLOCKED;
    }
    #endif // FUNCTION_BLOCK_CAPS

    #if defined FUNCTION_BLOCK_ADVERTISING
    static temp[128];
    new ret;
    // TODO: Add white list
    if(regex_match_c(message, g_rIpPattern, ret))
    {
        copy(temp, charsmax(temp), message);
        for(new i, whiteip[IP_LEN]; i < g_iWhiteListIpSize; i++)
        {
            ArrayGetString(g_aWhiteListIp, i, whiteip, charsmax(whiteip));
            while(replace(temp, charsmax(temp), whiteip, "")){}
        }

        if(regex_match_c(temp, g_rIpPattern, ret))
        {
            client_print(id, print_chat, "[CMA] Founded ip pattern!");
            add_warning(id);
            return MESSAGE_BLOCKED;
        }
    }
    if(regex_match_c(message, g_rDomainPattern, ret))
    {
        copy(temp, charsmax(temp), message);
        for(new i, whitedomain[DOMAIN_LEN]; i < g_iWhiteListDomainSize; i++)
        {
            ArrayGetString(g_aWhiteListDomain, i, whitedomain, charsmax(whitedomain));
            while(replace(temp, charsmax(temp), whitedomain, "")){}
        }

        if(regex_match_c(temp, g_rDomainPattern, ret))
        {
            client_print(id, print_chat, "[CMA] Founded domain pattern!");
            add_warning(id);
            return MESSAGE_BLOCKED;
        }
    }
    #endif // FUNCTION_BLOCK_ADVERTISING

    #if defined FUNCTION_BLACK_LIST
    static new_message[128], wchar_msg[128], low_message[128];

    new changed = false;

    copy(new_message, charsmax(new_message), message);
    copy(low_message, charsmax(low_message), message);

    normalize_string(low_message);
    multibyte_to_wchar(low_message, wchar_msg);
    wchar_tolower_rus(wchar_msg);
    wchar_to_multibyte(wchar_msg, low_message);

    for(new i, len, place, word[64]; i < g_iBlackListSize; i++)
    {
        ArrayGetString(g_aBlackList, i, word, charsmax(word));
        len = strlen(word);
        while((place = containi(low_message, word)) > -1)
        {
            changed = true;
            replace_blocked_word(new_message, strlen(new_message), place, len);
            replace_blocked_word(low_message, strlen(low_message), place, len);
        }
    }

    if(changed)
    {
        cm_set_player_message(new_message);
        return MESSAGE_CHANGED;
    }
    #endif // FUNCTION_BLACK_LIST

    return MESSAGE_IGNORED;
}

add_warning(id)
{
    if(++g_iWarnings[id] >= MAX_WARNINGS_TO_BLOCK_CHAT)
    {
        g_fBlockTime[id] = get_gametime() + BLOCK_CHAT_TIME;
        g_iWarnings[id] = 0;
        client_print(id, print_chat, "[CMA] Your chat has been blocked for %.0f seconds!", BLOCK_CHAT_TIME);
    }
    SendAudio(id, "sound/fvox/beep.wav", PITCH_NORM);
}

#if defined FUNCTION_BLACK_LIST
replace_blocked_word(string[], length, start, word_length)
{

    for(new i = start; i < start + 3; i++)
    {
        string[i] = '*';
    }
    if(length > 3)
    {
        new len = start + word_length;
        new diff = word_length - 3;
        while(len <= length)
        {
            string[len - diff] = string[len];
            len++;
        }
    }
}
#endif // FUNCTION_BLACK_LIST

stock normalize_string(str[])
{
    for (new i; str[i] != EOS; i++)
    {
        str[i] &= 0xFF;
    }
}

stock wchar_tolower_rus(str[])
{
    for (new i; str[i] != EOS; i++)
    {
        if(str[i] == 0x401)
        {
            str[i] = 0x451;
        }
        else if(0x410 <= str[i] <= 0x42F)
        {
            str[i] += 0x20;
        }
    }
}

stock wchar_is_uppercase(ch)
{
    if(0x41 <= ch <= 0x5A || ch == 0x401 || 0x410 <= ch <= 0x42F)
    {
        return true;
    }
    return false;
}

// Converts MultiByte (UTF-8) to WideChar (UTF-16, UCS-2)
// Supports only 1-byte, 2-byte and 3-byte UTF-8 (unicode chars from 0x0000 to 0xFFFF), because client can't display 2-byte UTF-16
// charsmax(wcszOutput) should be >= strlen(mbszInput)
stock multibyte_to_wchar(const mbszInput[], wcszOutput[]) {
    new nOutputChars = 0;
    for (new n = 0; mbszInput[n] != EOS; n++) {
        if (mbszInput[n] < 0x80) { // 0... 1-byte ASCII
            wcszOutput[nOutputChars] = mbszInput[n];
        } else if ((mbszInput[n] & 0xE0) == 0xC0) { // 110... 2-byte UTF-8
            wcszOutput[nOutputChars] = (mbszInput[n] & 0x1F) << 6; // Upper 5 bits
           
            if ((mbszInput[n + 1] & 0xC0) == 0x80) { // Is 10... ?
                wcszOutput[nOutputChars] |= mbszInput[++n] & 0x3F; // Lower 6 bits
            } else { // Decode error
                wcszOutput[nOutputChars] = '?';
            }
        } else if ((mbszInput[n] & 0xF0) == 0xE0) { // 1110... 3-byte UTF-8
            wcszOutput[nOutputChars] = (mbszInput[n] & 0xF) << 12; // Upper 4 bits
           
            if ((mbszInput[n + 1] & 0xC0) == 0x80) { // Is 10... ?
                wcszOutput[nOutputChars] |= (mbszInput[++n] & 0x3F) << 6; // Middle 6 bits
               
                if ((mbszInput[n + 1] & 0xC0) == 0x80) { // Is 10... ?
                    wcszOutput[nOutputChars] |= mbszInput[++n] & 0x3F; // Lower 6 bits
                } else { // Decode error
                    wcszOutput[nOutputChars] = '?';
                }
            } else { // Decode error
                wcszOutput[nOutputChars] = '?';
            }
        } else { // Decode error
            wcszOutput[nOutputChars] = '?';
        }
       
        nOutputChars++;
    }
    wcszOutput[nOutputChars] = EOS;
}

// Converts WideChar (UTF-16, UCS-2) to MultiByte (UTF-8)
// Supports only 1-byte UTF-16 (0x0000 to 0xFFFF), because client can't display 2-byte UTF-16
// charsmax(mbszOutput) should be >= wcslen(wcszInput) * 3
stock wchar_to_multibyte(const wcszInput[], mbszOutput[]) {
    new nOutputChars = 0;
    for (new n = 0; wcszInput[n] != EOS; n++) {
        if (wcszInput[n] < 0x80) {
            mbszOutput[nOutputChars++] = wcszInput[n];
        } else if (wcszInput[n] < 0x800) {
            mbszOutput[nOutputChars++] = (wcszInput[n] >> 6) | 0xC0;
            mbszOutput[nOutputChars++] = (wcszInput[n] & 0x3F) | 0x80;
        } else {
            mbszOutput[nOutputChars++] = (wcszInput[n] >> 12) | 0xE0;
            mbszOutput[nOutputChars++] = ((wcszInput[n] >> 6) & 0x3F) | 0x80;
            mbszOutput[nOutputChars++] = (wcszInput[n] & 0x3F) | 0x80;
        }
    }
    mbszOutput[nOutputChars] = EOS;
}

stock SendAudio(id, audio[], pitch)
{
    static msg_send_audio; if(!msg_send_audio) msg_send_audio = get_user_msgid("SendAudio");

    message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msg_send_audio, _, id);
    write_byte(id);
    write_string(audio);
    write_short(pitch);
    message_end();
}
Переделал плагин
Chat Manager 1.1.1
под себя , чтобы не писались префиксы если админ и вип (aes. steam ) и сообщения слали не с первого раза писаться ,кнш грешу на chatmanager_addon , но не уверен , посмотрите знающие где накосячил[DOUBLEPOST=1547590490][/DOUBLEPOST]и да забыл сказать что AmxModX 1.9.0 у меня , просто в заявке такого нет , исправте пжл)
 
K

kapangaIII

А теперь нормально напиши с примерами, какие сообщения не проходят, а какие - проходят.
 

makcumoc

Пользователь
Регистрация
10 Июл 2017
Сообщения
117
Симпатии
21
Пол
Мужской
, да любое сообщение печатаешь нажимаешь ентер и его нет, печатаешь заново такое же один в один и снова нет, печатаешь другое проходит , такое бывает редко ,но бывает и при том не важно на англ. или рус.
 
Сверху Снизу