- Ошибка
-
----------------------------------------------
CRASH: Thu Jul 27 10:26:13 MSK 2023
Start Line: ./hlds_linux -debug -game cstrike -master -noipx -pingboost 3 -sys_ticrate 1200 -secure +ip 93.191.11.211 +port 27027 +map surf_ski_2 -maxplayers 20 +rcon_password +sv_password -pidfile hlds.27163.pid
[New LWP 27170]
[New LWP 27232]
[New LWP 27231]
[New LWP 27238]
[New LWP 27239]
[New LWP 27237]
[New LWP 8890]
[New LWP 27305]
[New LWP 27240]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./hlds_linux -debug -game cstrike -master -noipx -pingboost 3 -sys_ticrate 1200'.
Program terminated with signal SIGABRT, Aborted.
#0 0xf77bdc89 in __kernel_vsyscall ()
[Current thread is 1 (Thread 0xf7498940 (LWP 27170))]
#0 0xf77bdc89 in __kernel_vsyscall ()
#1 0xf752fdd0 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xf7531297 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0xf756b38f in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0xf7571fc7 in ?? () from /lib/i386-linux-gnu/libc.so.6
#5 0xf7572806 in ?? () from /lib/i386-linux-gnu/libc.so.6
#6 0xf776c9d9 in operator delete (ptr=0xb1c0500) at /valve/build/targets/src/gcc-4.6.1/libstdc++-v3/libsupc++/del_op.cc:47
#7 0xf776ca23 in operator delete[] (ptr=0xb1c0500) at /valve/build/targets/src/gcc-4.6.1/libstdc++-v3/libsupc++/del_opv.cc:32
#8 0xf249faf1 in ke::AString::operator=(char const*) () from cstrike/addons/amxmodx/modules/mysql_amxx_i386.so
#9 0x0b2b86a8 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
No symbol table info available.
From To Syms Read Shared Object Library
0xf772c914 0xf7772c78 Yes ./libstdc++.so.6
0xf76d9a30 0xf76da921 Yes (*) /lib/i386-linux-gnu/libdl.so.2
0xf76c08c0 0xf76cdf01 Yes (*) /lib/i386-linux-gnu/libpthread.so.0
0xf751b800 0xf764901f Yes (*) /lib/i386-linux-gnu/libc.so.6
0xf74b36e0 0xf74eafcb Yes (*) /lib/i386-linux-gnu/libm.so.6
0xf77bf860 0xf77d8f1d Yes (*) /lib/ld-linux.so.2
0xf749be04 0xf74ab490 Yes ./libgcc_s.so.1
0xf6dba820 0xf6eabfb0 Yes (*) /home/srv780656/engine_i486.so
0xf6d7e840 0xf6d81dfc Yes (*) /lib/i386-linux-gnu/librt.so.1
0xf6d6c5c0 0xf6d76d74 Yes (*) ./libsteam_api.so
0xf6d52a00 0xf6d5f1b8 Yes /home/srv780656/filesystem_stdio.so
0xf5e49e80 0xf6931040 Yes (*) /rep/cs/6153/steamclient.so
0xf5cc4670 0xf5d3a020 Yes (*) /rep/cs/6153/crashhandler.so
0xf345e3a0 0xf34a1a90 Yes (*) /home/srv780656/./cstrike/addons/metamod/dlls/metamod.so
0xf32076a0 0xf339eb90 Yes (*) /home/srv780656/cstrike/dlls/cs.so
0xf3089850 0xf30ad550 Yes (*) /home/srv780656/cstrike/addons/reunion/dlls/reunion.so
0xf2eb0a20 0xf2f13db7 Yes (*) /home/srv780656/cstrike/addons/amxmodx/dlls/amxmodx.so
0xf2e82d50 0xf2e92460 Yes (*) cstrike/addons/amxmodx/modules/cstrike_amxx_i386.so
0xf2e6d8b0 0xf2e6e1d8 Yes (*) cstrike/addons/amxmodx/modules/csx_amxx_i386.so
0xf2dfd020 0xf2e46180 Yes (*) cstrike/addons/amxmodx/modules/reapi_amxx_i386.so
0xf2c8bf70 0xf2d90030 Yes (*) /home/srv780656/cstrike/addons/revoice/dlls/revoice.so
0xf2b14b60 0xf2b5c624 Yes (*) cstrike/addons/amxmodx/modules/hamsandwich_amxx_i386.so
0xf2ac19d0 0xf2aedd6c Yes (*) cstrike/addons/amxmodx/modules/fakemeta_amxx_i386.so
0xf249c790 0xf2534fc5 Yes (*) cstrike/addons/amxmodx/modules/mysql_amxx_i386.so
0xf2910660 0xf2914f84 Yes (*) cstrike/addons/amxmodx/modules/fun_amxx_i386.so
0xf28f5290 0xf290180c Yes (*) cstrike/addons/amxmodx/modules/engine_amxx_i386.so
0xf2927a80 0xf292d8f0 Yes (*) /lib/i386-linux-gnu/libnss_files.so.2
0xef7d4200 0xf066d3c4 Yes (*) ./steamclient.so
0xf1ef6670 0xf1f6c020 Yes (*) ./crashhandler.so
0xf2939b50 0xf293c7d6 Yes (*) /lib/i386-linux-gnu/libnss_dns.so.2
0xf28d3690 0xf28dfba4 Yes (*) /lib/i386-linux-gnu/libresolv.so.2
(*): Shared library is missing debugging information.
Stack level 0, frame at 0xffd41230:
eip = 0xf77bdc89 in __kernel_vsyscall; saved eip = 0xf752fdd0
called by frame at 0xffd41350
Arglist at 0xffd41228, args:
Locals at 0xffd41228, Previous frame's sp is 0xffd41230
Saved registers:
ecx at 0xffd41228, edx at 0xffd41224, ebp at 0xffd41220, eip at 0xffd4122c
End of crash report
----------------------------------------------
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5294 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Dec 3 2021 15:54:56
Built from: https://github.com/alliedmodders/amxmodx/commit/363871a
Build ID: 5294:363871a
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.12.0.780-dev
Build date: 16:20:56 Sep 19 2022 (3082)
Build from: https://github.com/dreamstalker/rehlds/commit/d6ebe82
- ReGamedll
-
ReGameDLL version: 5.21.0.556-dev
Build date: 08:50:42 Jul 22 2022
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/1081301
- Версия Metamod
-
Metamod-r v1.3.0.131, API (5:13)
Metamod-r build: 18:51:02 Jul 11 2022
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/adc9414
- Список метамодулей
-
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion.so v0.1.0.137 ini Start Never
[ 2] AMX Mod X RUN - amxmodx.so v1.9.0.5294 ini Start ANY
[ 3] Revoice RUN - revoice.so v0.1.0.34 ini Start Never
[ 4] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5294 pl2 ANY
[ 5] ReAPI RUN - reapi_amxx_i386.so v5.22.0.254-dev pl2 ANY Never
[ 6] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5294 pl2 ANY
[ 7] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5294 pl2 ANY
[ 8] MySQL RUN - mysql_amxx_i386.so v1.9.0.5294 pl2 ANY
[ 9] Fun RUN - fun_amxx_i386.so v1.9.0.5294 pl2 ANY
[10] Engine RUN - engine_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
10 plugins, 10 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] CSStatsX SQL 0.7.4+2 serfreeman1337 aes_csstatsx_sq running
[ 2] Admin Loader 3.5 neygomon admin_loader.am running
[ 3] FreshBans 1.4.8b kanagava fresh_bans.amxx running
[ 4] Admin Chat 1.9.0.5294 AMXX Dev Team adminchat.amxx running
[ 5] Admin Commands 1.9.0.5249 AMXX Dev Team admincmd.amxx running
[ 6] Anti Flood 1.9.0.5294 AMXX Dev Team antiflood.amxx running
[ 7] Commands Menu 1.9.0.5294 AMXX Dev Team cmdmenu.amxx running
[ 8] Info. Messages 1.9.0.5294 AMXX Dev Team imessage.amxx running
[ 9] Menus Front-End 1.9.0.5249 AMXX Dev Team menufront.amxx running
[ 10] Maps Menu 1.9.0.5249 AMXX Dev Team mapsmenu.amxx running
[ 11] Players Menu 1.9.0.5249 AMXX Dev Team plmenu.amxx running
[ 12] Plugin Menu 1.9.0.5294 AMXX Dev Team pluginmenu.amxx running
[ 13] Restrict Weapons 1.9.0.5294 AMXX Dev Team restmenu.amxx running
[ 14] Scrolling Message 1.9.0.5294 AMXX Dev Team scrollmsg.amxx running
[ 15] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 16] CS Misc. Stats 1.9.0.5294 AMXX Dev Team miscstats.amxx running
[ 17] CS Stats Logging 1.9.0.5294 AMXX Dev Team stats_logging.a running
[ 18] Map Manager 2.5.61 Mistrick mapmanager.amxx running
[ 19] Map Manager: Sub Plugi 0.1 Mistrick mapmanager_subp running
[ 20] MG Grab 1.0 Nickron & Juvini new_grab.amxx running
[ 21] [JPHOOK] Hook 1.0 th3psssy JP_HOOK.amxx running
[ 22] WalkGuard 1.3.3 mogel no_kill_zones_r running
[ 23] Remove Entity 1.0 6u3oH remove_entity.a running
[ 24] Chat Manager 1.1.1-11 Mistrick chat_manager.am debug
[ 25] Duels 1.0 Psycrow & Juvini duels_surf.amxx running
[ 26] Stats Configuration 1.9.0.5235 AMXX Dev Team statscfg.amxx running
[ 27] [RS] Round Sound 1.0S VCL rs_round_sound. debug
[ 28] surf_ski_2 Jail remove 1.0 xPaw jailremover.amx running
[ 29] ChatAdditions: Core v1.9.1 Sergey Shorokhov ChatAdditions_C debug
[ 30] ChatAdditions: CSBans v1.9.1 Sergey Shorokhov CA_Storage_CSBa debug
[ 31] CA: Mute v1.9.1 Sergey Shorokhov CA_Mute.amxx debug
[ 32] CA Addon: Request UnGA v1.9.1 steelzzz CA_Addon_Reques debug
[ 33] CA: Gag v1.9.1 Sergey Shorokhov CA_Gag.amxx debug
[ 34] Advanced Experience Sy 0.5 Vega serfreeman1337 aes_main.amxx running
[ 35] AES: StatsX 0.5+1 serfreeman1337 aes_statsx.amxx running
[ 36] AES: CStrike Addon 0.5 Vega serfreeman1337 aes_exp_cstrike running
[ 37] AES: Informer 0.5 Vega serfreeman1337 aes_informer.am debug
[ 38] AES: Admin Tools 0.5 Vega serfreeman1337 aes_exp_editor. running
[ 39] AES: Bonus System 0.5 Vega serfreeman1337 aes_bonus_syste running
[ 40] AES: Bonus CSTRIKE 0.5 Vega serfreeman1337 aes_bonus_cstri running
Крашит сервер после того как неоднократно меняю карту (до 10 раз хватает). В ТП хоста предлагали повыключать плагины и понять какой крашит.
Вроде как проблема пропадает как только выключаю чат менеджер, но какая в нём проблема?
Вроде как проблема пропадает как только выключаю чат менеджер, но какая в нём проблема?
Код:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <sqlx>
#define PLUGIN "Chat Manager"
#define VERSION "1.1.1-11"
#define AUTHOR "Mistrick"
#pragma semicolon 1
#define ADMIN_FLAG ADMIN_CHAT
//Colors: DEFAULT, TEAM, GREEN
#define PRETEXT_COLOR DEFAULT
#define PLAYER_CHAT_COLOR DEFAULT
#define ADMIN_CHAT_COLOR GREEN
#define PLAYER_NAME_COLOR TEAM
#define ADMIN_NAME_COLOR TEAM
#define FUNCTION_ALL_CHAT
#if defined FUNCTION_ALL_CHAT
//Flags: ALIVE_SEE_DEAD, DEAD_SEE_ALIVE, TEAM_SEE_TEAM
#define PLAYER_CHAT_FLAGS (ALIVE_SEE_DEAD|DEAD_SEE_ALIVE)
#define ADMIN_CHAT_FLAGS (ALIVE_SEE_DEAD|DEAD_SEE_ALIVE|TEAM_SEE_TEAM)
#endif
#define FUNCTION_PLAYER_PREFIX
//#define FUNCTION_ADD_TIME_CODE
#define FUNCTION_LOG_MESSAGES
#define FUNCTION_HIDE_SLASH
#define FUNCTION_TRANSLITE
#define FUNCTION_AES_TAGS
#define FUNCTION_BETA_SUPPORT
//#define FUNCTION_ADD_STEAM_PREFIX
#if defined FUNCTION_ADD_STEAM_PREFIX
new const STEAM_PREFIX[] = "^1[^4Steam^1] ";
#endif
#define PREFIX_MAX_LENGTH 32
#define AES_MAX_LENGTH 32
//DONT CHANGE!!!
#define COLOR_BUFFER 6
#define TEXT_LENGTH 128
#define MESSAGE_LENGTH 189
#if defined FUNCTION_AES_TAGS
native aes_get_player_stats(id,data[4]);
native aes_get_level_name(lvlnum,level[],len,idLang = 0);
new const AES_TAG_FORMAT[] = "^1[^4%s^1] ";
#endif
// SQL
new
Handle:s_SqlTuple,
szSqlError[512],
ErrorCode;
new admin_chat_color[33];
const ALIVE_SEE_DEAD = (1 << 0);
const DEAD_SEE_ALIVE = (1 << 1);
const TEAM_SEE_TEAM = (1 << 2);
enum
{
DEFAULT = 1,
TEAM = 3,
GREEN = 4
};
enum _:FLAG_PREFIX_INFO
{
m_Flag,
m_Prefix[PREFIX_MAX_LENGTH]
};
new const g_TextChannels[][] =
{
"#Cstrike_Chat_All",
"#Cstrike_Chat_AllDead",
"#Cstrike_Chat_T",
"#Cstrike_Chat_T_Dead",
"#Cstrike_Chat_CT",
"#Cstrike_Chat_CT_Dead",
"#Cstrike_Chat_Spec",
"#Cstrike_Chat_AllSpec"
};
new g_SayText;
new g_sMessage[MESSAGE_LENGTH];
#if defined FUNCTION_PLAYER_PREFIX
new const FILE_PREFIXES[] = "chatmanager_prefixes.ini";
new g_sGangPrefix[33][PREFIX_MAX_LENGTH];
new g_bCustomPrefix[33], g_sPlayerPrefix[33][PREFIX_MAX_LENGTH];
new Trie:g_tSteamPrefixes, g_iTrieSteamSize;
new Trie:g_tNamePrefixes, g_iTrieNameSize;
new Array:g_aFlagPrefixes, g_iArrayFlagSize;
#endif
#if defined FUNCTION_LOG_MESSAGES
new g_szLogFile[128];
#endif
#if defined FUNCTION_TRANSLITE
new g_bTranslite[33];
#endif
#if defined FUNCTION_ADD_STEAM_PREFIX
new g_bSteamPlayer[33];
#endif
enum Forwards
{
SEND_MESSAGE
};
enum _:MessageReturn
{
MESSAGE_IGNORED,
MESSAGE_CHANGED,
MESSAGE_BLOCKED
};
new g_iForwards[Forwards];
new g_sNewMessage[MESSAGE_LENGTH];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
#if defined FUNCTION_PLAYER_PREFIX
register_concmd("cm_set_prefix", "Command_SetPrefix", ADMIN_RCON, "<name or #userid> <prefix>");
#endif
register_concmd("cmd_check_chat_color", "check_chat_color", ADMIN_IMMUNITY);
register_concmd("cmd_check_gang_prefix", "check_gang_prefix");
#if defined FUNCTION_TRANSLITE
register_clcmd("say /rus", "Command_LangChange");
register_clcmd("say /eng", "Command_LangChange");
#endif
register_clcmd("say", "Command_SayHandler");
register_clcmd("say_team", "Command_SayHandler");
register_message((g_SayText = get_user_msgid("SayText")), "Message_SayText");
// cm_player_send_message(id, message[], team_chat);
g_iForwards[SEND_MESSAGE] = CreateMultiForward("cm_player_send_message", ET_STOP, FP_CELL, FP_STRING, FP_CELL);
for(new id = 0; id <= get_maxplayers(); id++)
{
admin_chat_color[id] = false;
}
}
public plugin_cfg()
{
#if defined FUNCTION_LOG_MESSAGES
new szDir[] = "addons/amxmodx/logs/chatmanager";
if(!dir_exists(szDir))
{
mkdir(szDir);
}
new szDate[16]; get_time("%Y%m%d", szDate, charsmax(szDate));
formatex(g_szLogFile, charsmax(g_szLogFile), "%s/chatlog_%s.html", szDir, szDate);
if(!file_exists(g_szLogFile))
{
write_file(g_szLogFile, "<meta charset=utf-8><title>ChatManager Log</title>");
}
#endif
#if defined FUNCTION_PLAYER_PREFIX
LoadPlayersPrefixes();
#endif
#if defined FUNCTION_AES_TAGS
register_dictionary("aes.txt");
#endif
}
#if defined FUNCTION_PLAYER_PREFIX
LoadPlayersPrefixes()
{
new szDir[128]; get_localinfo("amxx_configsdir", szDir, charsmax(szDir));
new szFile[128]; formatex(szFile, charsmax(szFile), "%s/%s", szDir, FILE_PREFIXES);
if(!file_exists(szFile))
{
log_amx("Prefixes file doesn't exist!");
return;
}
g_tSteamPrefixes = TrieCreate();
g_tNamePrefixes = TrieCreate();
g_aFlagPrefixes = ArrayCreate(FLAG_PREFIX_INFO);
new file = fopen(szFile, "rt");
if(file)
{
new szText[128], szType[6], szAuth[32], szPrefix[PREFIX_MAX_LENGTH + COLOR_BUFFER], eFlagPrefix[FLAG_PREFIX_INFO];
while(!feof(file))
{
fgets(file, szText, charsmax(szText));
parse(szText, szType, charsmax(szType), szAuth, charsmax(szAuth), szPrefix, charsmax(szPrefix));
if(!szType[0] || szType[0] == ';' || !szAuth[0] || !szPrefix[0]) continue;
replace_color_tag(szPrefix);
switch(szType[0])
{
case 's'://steam
{
TrieSetString(g_tSteamPrefixes, szAuth, szPrefix);
g_iTrieSteamSize++;
}
case 'n'://name
{
TrieSetString(g_tNamePrefixes, szAuth, szPrefix);
g_iTrieNameSize++;
}
case 'f'://flag
{
eFlagPrefix[m_Flag] = read_flags(szAuth);
copy(eFlagPrefix[m_Prefix], charsmax(eFlagPrefix[m_Prefix]), szPrefix);
ArrayPushArray(g_aFlagPrefixes, eFlagPrefix);
g_iArrayFlagSize++;
}
}
}
fclose(file);
}
}
#endif
public plugin_natives()
{
register_native("cm_set_player_message", "native_set_player_message");
}
public native_set_player_message(plugin, params)
{
enum { arg_new_message = 1 };
get_string(arg_new_message, g_sNewMessage, charsmax(g_sNewMessage));
}
public client_putinserver(id)
{
#if defined FUNCTION_TRANSLITE
g_bTranslite[id] = false;
#endif
g_sGangPrefix[id] = "";
set_task(1.0, "check_gang_prefix", id);
#if defined FUNCTION_PLAYER_PREFIX
g_sPlayerPrefix[id] = "";
g_bCustomPrefix[id] = false;
new szSteam[32]; get_user_authid(id, szSteam, charsmax(szSteam));
if(g_iTrieSteamSize && TrieKeyExists(g_tSteamPrefixes, szSteam))
{
g_bCustomPrefix[id] = true;
TrieGetString(g_tSteamPrefixes, szSteam, g_sPlayerPrefix[id], charsmax(g_sPlayerPrefix[]));
}
#endif
#if defined FUNCTION_ADD_STEAM_PREFIX
g_bSteamPlayer[id] = is_user_steam(id);
#endif
if(get_user_flags(id) & ADMIN_IMMUNITY)
{
set_task(1.0, "check_chat_color", id);
}
}
public check_gang_prefix(id)
{
new Handle: SqlConnection = SQL_Connect(s_SqlTuple, ErrorCode, szSqlError, charsmax(szSqlError));
new szSteamID[32]; get_user_authid(id, szSteamID, charsmax(szSteamID));
new Handle: Query = SQL_PrepareQuery(SqlConnection, "SELECT GangID FROM surf_gang_members WHERE SteamID = '%s';", szSteamID);
SQL_Execute(Query);
if(SQL_NumResults(Query) == 0)
{
g_sGangPrefix[id] = "";
return PLUGIN_HANDLED;
}
new gID = SQL_ReadResult(Query, 0);
Query = SQL_PrepareQuery(SqlConnection, "SELECT GChatPrefix FROM surf_gangs WHERE ID = '%d';", gID);
SQL_Execute(Query);
new query_result[5];
SQL_ReadResult(Query, 0, query_result, 4);
if(!equal(query_result, "none"))
{
format(g_sGangPrefix[id], 11, "^1[^3%s^1] ", query_result);
}
else
{
g_sGangPrefix[id] = "";
}
SQL_FreeHandle(Query);
SQL_FreeHandle(SqlConnection);
return PLUGIN_HANDLED;
}
public check_chat_color(id)
{
if(get_user_flags(id) & ADMIN_IMMUNITY)
{
new szSteamID[32]; get_user_authid(id, szSteamID, charsmax(szSteamID));
new Handle: SqlConnection = SQL_Connect(s_SqlTuple, ErrorCode, szSqlError, charsmax(szSqlError));
new Handle: Query = SQL_PrepareQuery(SqlConnection, "SELECT chat_color FROM surf_bd WHERE steamid = '%s';", szSteamID);
SQL_Execute(Query);
if(SQL_NumResults(Query) > 0)
{
new name[32];
get_user_name(id, name, 31);
new sql_chat_color[33];
SQL_ReadResult(Query, 0, sql_chat_color, 32);
if(equal(sql_chat_color, "green"))
{
admin_chat_color[id] = true;
}
else
{
admin_chat_color[id] = false;
}
}
else
{
admin_chat_color[id] = true;
}
SQL_FreeHandle(Query);
SQL_FreeHandle(SqlConnection);
}
}
#if defined FUNCTION_PLAYER_PREFIX
public Command_SetPrefix(id, level, cid)
{
if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED;
new szArg[32]; read_argv(1, szArg, charsmax(szArg));
new player = cmd_target(id, szArg, CMDTARGET_ALLOW_SELF);
if(!player) return PLUGIN_HANDLED;
new szPrefix[PREFIX_MAX_LENGTH + COLOR_BUFFER]; read_argv(2, szPrefix, charsmax(szPrefix));
replace_color_tag(szPrefix);
console_print(id, "You changed player prefix from %s to %s.", g_sPlayerPrefix[player], szPrefix);
copy(g_sPlayerPrefix[player], charsmax(g_sPlayerPrefix[]), szPrefix);
g_bCustomPrefix[player] = true;
return PLUGIN_HANDLED;
}
#endif
#if defined FUNCTION_TRANSLITE
public Command_LangChange(id)
{
g_bTranslite[id] = !g_bTranslite[id];
color_print(id, "^1[^4Реактивный полёт^1] Ты сменил язык чата на ^3%s^1.", g_bTranslite[id] ? "русский" : "английский");
return PLUGIN_HANDLED;
}
#endif
// SQL
// подключение
public fbans_sql_connected(Handle:sqlTuple)
{
if( s_SqlTuple == Empty_Handle )
{
Sql_Connect(sqlTuple);
}
}
public Sql_Connect(Handle:sqlTuple)
{
s_SqlTuple = sqlTuple;
}
// подключение
public Command_SayHandler(id)
{
if (!is_user_connected(id)) return PLUGIN_HANDLED;
new message[TEXT_LENGTH];
read_argv(0, message, charsmax(message));
new is_team_msg = (message[3] == '_');
read_args(message, charsmax(message));
remove_quotes(message);
replace_wrong_simbols(message);
trim(message);
if(!message[0]) return PLUGIN_HANDLED;
#if defined FUNCTION_HIDE_SLASH
if(message[0] == '/') return PLUGIN_HANDLED_MAIN;
#endif
new flags = get_user_flags(id);
new name[32]; get_user_name(id, name, charsmax(name));
#if defined FUNCTION_PLAYER_PREFIX
if(!g_bCustomPrefix[id])
{
if(g_iTrieNameSize && TrieKeyExists(g_tNamePrefixes, name))
{
TrieGetString(g_tNamePrefixes, name, g_sPlayerPrefix[id], charsmax(g_sPlayerPrefix[]));
}
else if(g_iArrayFlagSize)
{
new eFlagPrefix[FLAG_PREFIX_INFO], bFoundPrefix = false;
for(new i; i < g_iArrayFlagSize; i++)
{
ArrayGetArray(g_aFlagPrefixes, i, eFlagPrefix);
if(check_flags(flags, eFlagPrefix[m_Flag]))
{
bFoundPrefix = true;
copy(g_sPlayerPrefix[id], charsmax(g_sPlayerPrefix[]), eFlagPrefix[m_Prefix]);
break;
}
}
if(!bFoundPrefix)
{
g_sPlayerPrefix[id] = "";
}
}
}
#endif
#if defined FUNCTION_TRANSLITE
if(g_bTranslite[id])
{
if(message[0] == '/')
{
copy(message, charsmax(message), message[1]);
}
else
{
new szTranslitedText[TEXT_LENGTH];
translite_string(szTranslitedText, charsmax(szTranslitedText), message);
copy(message, charsmax(message), szTranslitedText);
}
}
#endif
new ret; ExecuteForward(g_iForwards[SEND_MESSAGE], ret, id, message, is_team_msg);
if(ret)
{
if(ret == MESSAGE_BLOCKED)
{
return PLUGIN_HANDLED;
}
copy(message, charsmax(message), g_sNewMessage);
}
if(!message[0])
{
return PLUGIN_HANDLED;
}
new name_color = flags & ADMIN_FLAG ? ADMIN_NAME_COLOR : PLAYER_NAME_COLOR;
new chat_color = flags & ADMIN_IMMUNITY ? admin_chat_color[id] ? ADMIN_CHAT_COLOR : PLAYER_CHAT_COLOR : flags & ADMIN_FLAG ? ADMIN_CHAT_COLOR : PLAYER_CHAT_COLOR; //= flags & ADMIN_FLAG ? ADMIN_CHAT_COLOR : PLAYER_CHAT_COLOR;
new time_code[16]; get_time("[%H:%M:%S] ", time_code, charsmax(time_code));
new is_sender_alive = is_user_alive(id);
new CsTeams:sender_team = cs_get_user_team(id);
new channel = get_user_text_channel(is_sender_alive, is_team_msg, sender_team);
FormatMessage(id, sender_team, channel, name_color, chat_color, time_code, message);
#if defined FUNCTION_ALL_CHAT
new players[32], players_num; get_players(players, players_num, "ch");
new player, is_player_alive, CsTeams:player_team, player_flags;
for(new i; i < players_num; i++)
{
player = players[i];
if(player == id) continue;
is_player_alive = is_user_alive(player);
player_team = cs_get_user_team(player);
player_flags = get_user_flags(player) & ADMIN_FLAG ? ADMIN_CHAT_FLAGS : PLAYER_CHAT_FLAGS;
if(player_flags & ALIVE_SEE_DEAD && !is_sender_alive && is_player_alive && (!is_team_msg || is_team_msg && sender_team == player_team) //flag ALIVE_SEE_DEAD
|| player_flags & DEAD_SEE_ALIVE && is_sender_alive && !is_player_alive && (!is_team_msg || is_team_msg && sender_team == player_team) //flag DEAD_SEE_ALIVE
|| player_flags & TEAM_SEE_TEAM && is_team_msg && sender_team != player_team) //flag TEAM_SEE_TEAM
{
emessage_begin(MSG_ONE, g_SayText, _, player);
ewrite_byte(id);
ewrite_string(g_TextChannels[channel]);
ewrite_string("");
ewrite_string("");
emessage_end();
}
}
#endif
#if defined FUNCTION_LOG_MESSAGES
static const szTeamColor[CsTeams][] = {"gray", "red", "blue", "gray"};
new szLogMessage[256];
formatex(szLogMessage, charsmax(szLogMessage), "<br><font color=black>%s %s %s <font color=%s><b>%s</b> </font>:</font><font color=%s> %s </font>", time_code, is_sender_alive ? "" : (_:sender_team == 1 || _:sender_team == 2 ? "*Мёртв*" : "*Наблюдатель*"), is_team_msg ? "(Командный)" : "", szTeamColor[sender_team], name, chat_color == GREEN ? "green" : "#FFB41E", message);
write_file(g_szLogFile, szLogMessage);
#endif
return PLUGIN_CONTINUE;
}
public FormatMessage(sender, CsTeams:sender_team, channel, name_color, chat_color, time_code[], message[])
{
static const szTeamNames[CsTeams][] = {"(Наблюдатели)", "(Террористы)", "(Контр-Терористы)", "(Наблюдатели)"};
new szText[MESSAGE_LENGTH], len = 1;
szText[0] = PRETEXT_COLOR;
if(channel % 2)
{
len += formatex(szText[len], charsmax(szText) - len, "%s", channel != 7 ? "*Мёртв*" : "*Наблюдатель*");
}
if(channel > 1 && channel < 7)
{
len += formatex(szText[len], charsmax(szText) - len, "%s ", szTeamNames[sender_team]);
}
else if(channel)
{
len += formatex(szText[len], charsmax(szText) - len, " ");
}
#if defined FUNCTION_ADD_TIME_CODE
len += formatex(szText[len], charsmax(szText) - len, "%s", time_code);
#endif
len += formatex(szText[len], charsmax(szText) - len, "%s", g_sGangPrefix[sender]);
/*#if defined FUNCTION_ADD_STEAM_PREFIX
if(g_bSteamPlayer[sender])
{
len += formatex(szText[len], charsmax(szText) - len, "%s", STEAM_PREFIX);
}
#endif*/
#if defined FUNCTION_AES_TAGS
new data[4], szAesTag[AES_MAX_LENGTH]; aes_get_player_stats(sender, data); aes_get_level_name(data[1], szAesTag, charsmax(szAesTag));
len += formatex(szText[len], charsmax(szText) - len, AES_TAG_FORMAT, szAesTag);
#endif
#if defined FUNCTION_PLAYER_PREFIX
len += formatex(szText[len], charsmax(szText) - len, "%s", g_sPlayerPrefix[sender]);
#endif
#if defined FUNCTION_BETA_SUPPORT
new name[32]; get_user_name(sender, name, charsmax(name));
len += formatex(szText[len], charsmax(szText) - len, "%c%s^1 :%c %s", name_color, name, chat_color, message);
#else
len += formatex(szText[len], charsmax(szText) - len, "%c%%s1^1 :%c %s", name_color, chat_color, message);
#endif
copy(g_sMessage, charsmax(g_sMessage), szText);
}
public Message_SayText(msgid, dest, receiver)
{
if(get_msg_args() != 4) return PLUGIN_CONTINUE;
new str2[22]; get_msg_arg_string(2, str2, charsmax(str2));
new channel = get_msg_channel(str2);
if(!channel) return PLUGIN_CONTINUE;
new str3[2]; get_msg_arg_string(3, str3, charsmax(str3));
if(str3[0]) return PLUGIN_CONTINUE;
set_msg_arg_string(2, g_sMessage);
set_msg_arg_string(4, "");
return PLUGIN_CONTINUE;
}
get_msg_channel(str[])
{
for(new i; i < sizeof(g_TextChannels); i++)
{
if(equal(str, g_TextChannels[i]))
{
return i + 1;
}
}
return 0;
}
stock get_user_text_channel(is_sender_alive, is_team_msg, CsTeams:sender_team)
{
if (is_team_msg)
{
switch(sender_team)
{
case CS_TEAM_T:
{
return is_sender_alive ? 2 : 3;
}
case CS_TEAM_CT:
{
return is_sender_alive ? 4 : 5;
}
default:
{
return 6;
}
}
}
return is_sender_alive ? 0 : (sender_team == CS_TEAM_SPECTATOR ? 7 : 1);
}
stock replace_wrong_simbols(string[])
{
new len = 0;
for(new i; string[i] != EOS; i++)
{
if(string[i] == '%' || string[i] == '#' || 0x01 <= string[i] <= 0x04) continue;
string[len++] = string[i];
}
string[len] = EOS;
}
#if defined FUNCTION_PLAYER_PREFIX
replace_color_tag(string[])
{
new len = 0;
for (new i; string[i] != EOS; i++)
{
if (string[i] == '!')
{
switch (string[++i])
{
case 'd': string[len++] = 0x01;
case 't': string[len++] = 0x03;
case 'g': string[len++] = 0x04;
case EOS: break;
default: string[len++] = string[i];
}
}
else
{
string[len++] = string[i];
}
}
string[len] = EOS;
}
#endif
stock translite_string(string[], size, source[])
{
static const table[][] =
{
"Э", "#", ";", "%", "?", "э", "(", ")", "*", "+", "б", "-", "ю", ".", "0", "1", "2", "3", "4",
"5", "6", "7", "8", "9", "Ж", "ж", "Б", "=", "Ю", ",", "^"", "Ф", "И", "С", "В", "У", "А", "П",
"Р", "Ш", "О", "Л", "Д", "Ь", "Т", "Щ", "З", "Й", "К", "Ы", "Е", "Г", "М", "Ц", "Ч", "Н", "Я",
"х", "\", "ъ", ":", "_", "ё", "ф", "и", "с", "в", "у", "а", "п", "р", "ш", "о", "л", "д", "ь",
"т", "щ", "з", "й", "к", "ы", "е", "г", "м", "ц", "ч", "н", "я", "Х", "/", "Ъ", "Ё"
};
new len = 0;
for (new i = 0; source[i] != EOS && len < size; i++)
{
new ch = source[i];
if ('"' <= ch <= '~')
{
ch -= '"';
string[len++] = table[ch][0];
if (table[ch][1] != EOS)
{
string[len++] = table[ch][1];
}
}
else
{
string[len++] = ch;
}
}
string[len] = EOS;
return len;
}
stock color_print(id, text[], any:...)
{
new formated[190]; vformat(formated, charsmax(formated), text, 3);
message_begin(id ? MSG_ONE : MSG_ALL, g_SayText, _, id);
write_byte(id);
write_string(formated);
message_end();
}
stock check_flags(flags, need_flags)
{
return ((flags & need_flags) == need_flags) ? 1 : 0;
}
stock is_user_steam(id)
{
static dp_pointer;
if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
{
server_cmd("dp_clientinfo %d", id); server_exec();
return (get_pcvar_num(dp_pointer) == 2) ? true : false;
}
return false;
}
Вложения
-
18.8 KB Просмотры: 68