- Ошибка
-
Выдает такую ошибку в консоле
Error: Unknown MySQL server host 'ip' (2) 2005
В логах такая ошибка:
L 02/28/2022 - 11:42:51: [AMXX] Plugin ("chatmanager_prefixes_sql.amxx") is setting itself as failed.
L 02/28/2022 - 11:42:51: [AMXX] Plugin says: Unknown MySQL server host 'ip' (2) 2005
L 02/28/2022 - 11:42:51: [AMXX] Run time error 1 (plugin "chatmanager_prefixes_sql.amxx") - forced exit
- ОС
- Linux
- Amx Mod X
-
Amx Mod X 1.9.0
- Билд
-
48/1.1.2.7/Stdio 2753
- ReGamedll
-
ReGameDLL version: 5.21.0.546-dev
- Версия Metamod
-
etamod-r v1.3.0.128, API (5:13)
- Список метамодулей
-
[ 1] Reunion RUN - reunion.so v0.1.92d ini Start Never
[ 2] VoiceTranscoder RUN - vtc.so v2017RC5 ini ANY
[ 3] Rechecker RUN - rechecker.so v2.5 ini ANY
[ 4] AMX Mod X RUN - amxmodx.so v1.9.0.5263 ini Start ANY
[ 5] ReSemiclip RUN - resemiclip.so v2.3.9 ini ANY
[ 6] WHBlocker RUN - whblocker.so v1.5.696 ini ANY
[ 7] ReSRDetector RUN - resrdetector.so v0.1.0 ini ANY
[ 8] SafeNameAndChat RUN - safenameandchat.so v1.1 ini ANY
[ 9] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl4 ANY
[10] SQLite RUN - sqlite_amxx_i386.so v1.9.0.5263 pl4 ANY ANY
[11] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl4 ANY ANY
[12] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl4 ANY ANY
[13] CSX RUN - csx_amxx_i386.so v1.9.0.5263 pl4 ANY ANY
[14] ReAPI RUN - reapi_amxx_i386.so v5.21.0.252-dev pl4 ANY Never
[15] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl4 ANY ANY
[16] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl4 ANY Never
[17] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl4 ANY ANY
[18] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl4 ANY ANY
- Список плагинов
-
[ 1] Ultimate Chats Control v5.2(c) neygomon ultimate_chats_ running
[ 2] AMXBans: Core vGm 1.6 Larte Team amxbans_core.am running
[ 3] AMXBans: Flagged vGm 1.6 Larte Team amxbans_flagged running
[ 4] AMXBans: Freeze vGm 1.6 Larte Team amxbans_freeze. running
[ 5] AMXBans: Main vGm 1.6 Larte Team amxbans_main.am running
[ 6] AMXBans: Screens vGm 1.6 Larte Team amxbans_ssban.a running
[ 7] FreshBans v1.4.6b kanagava fresh_bans.amxx running
[ 8] CSStatsX SQL v0.7.4+2 serfreeman1337 aes_csstatsx_sq running
[ 9] ReAimDetector API v0.2.2 ReHLDS Team reaimdetector.a running
[ 10] [ReAPI] Block Fire in v3.1.0 F@nt0M reapi_block_fir running
[ 11] Map Spawns Editor v1.0.16 iG_os map_spawns_edit running
[ 12] Ping Checker v26.0.1 RC1 h1k3 ping_checker.am running
[ 13] Lite VoteBan v1.4fix neygomon lite_voteban.am running
[ 14] Lite Admin ESP v1.0 neygomon lite_admin_esp. running
[ 15] Players Menu v1.7 neugomon players_menu.am running
[ 16] Maps Menu v1.8.2 AMXX Dev Team maps_menu.amxx running
[ 17] Lite Vampire v1.2 neygomon lite_vampire.am running
[ 18] Lite Kill Assist v1.17 neygomon lite_kill_assis running
[ 19] Auto Team Balance Adva v1.5.1 Radius auto_team_balan running
[ 20] AMXMODMENU NEW v1.0 Nisko amxmodmenu_new. running
[ 21] AFK Control v1.4.1 [Rnd neygomon afk_control.amx running
[ 22] Autoresponder/Advertis v0.5 MaximusBrood reklama_in_chat running
[ 23] Replace Info Message v2.3 maeStro aka 9iky replace_info_me running
[ 24] SF Bets v0.1.5 serfreeman1337 sf_bets.amxx running
[ 25] unknown vunknown unknown reset_score_nam running
[ 26] Admin Commands v1.9.0.5235 AMXX Dev Team admincmd.amxx running
[ 27] [ReAPI] No Team Flash v0.0.3 Vaqtincha no_team_flash_l running
[ 28] NextMap v1.9.0.5235 AMXX Dev Team nextmap.amxx running
[ 29] Mode 2x2 v2.5re s1lent mode_2x2.amxx running
[ 30] [ReApi] Random Map Wea v0.0.1 Vaqtincha random_map_weap stopped
[ 31] say /me and /hp v0.3 neygomon say_me_and_hp.a running
[ 32] Parachute for ALL [ReA v3.0 Leo_[BH] parachute_for_a running
[ 33] Stats Configuration v1.9.0.5235 AMXX Dev Team statscfg.amxx running
[ 34] Multi-Lingual System v1.9.0.5235 AMXX Dev Team multilingual.am running
[ 35] IDEAL VIP v3.9.0 Ba/lePa | Radius ideal_vip.amxx running
[ 36] Advanced MapChooser v1.4 neygomon advanced_mapcho running
[ 37] ReAPI Kill Streak v1.1 AcE, Vagtincha, reapi_kill_stre running
[ 38] [ReAPI] Hint blocker v0.1.0 F@tn0M reapi_hint_bloc running
[ 39] Block Radio Commands v1.0 d3m37r4 block_radio_com running
[ 40] Chat Manager v1.1.2-16 Mistrick chatmanager.amx running
[ 41] Chat Manager: Prefixes 0.3b Denzer chatmanager_pre error
[ 42] Advanced Experience Sy v0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 43] AES: StatsX v0.5.9 [REA serfreeman1337/s aes_statsx.amxx running
[ 44] AES: CStrike Addon v0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 45] AES: Informer v0.5 Vega serfreeman1337 aes_informer.am running
[ 46] AES: Admin Tools v0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 47] AES: Bonus System v0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 48] AES: Bonus CSTRIKE v0.5.9.1 [R serfreeman1337/s aes_bonus_cstri running
[ 49] UCC Addon: VoteGAG v1.2 neygomon ucc_votegag.amx running
- Автор плагина
- Denzer
- Версия плагина
- 0.3b
- Исходный код
-
#include <amxmodx>
#include <sqlx>
#include <chatmanager>
#pragma semicolon 1
#define PLUGIN_NAME "Chat Manager: Prefixes MySQL"
#define PLUGIN_VERSION "0.3b"
#define PLUGIN_AUTHOR "Denzer"
enum _:CVARS
{
HOST[32],
USER[16],
PASS[32],
DB[16],
TABLE[32],
ACCESS[6]
};
enum _:SQL
{
SQL_TABLE,
SQL_CLEAR,
SQL_LOAD,
SQL_INSERT,
SQL_DELETE
};
enum _:FIELDS
{
FIELD_ID,
FIELD_PLAYER_NAME,
FIELD_PLAYER_STEAMID,
FIELD_PREFIX,
FIELD_EXPIRED
};
new g_Cvars[CVARS], g_sPrefix[MAX_PLAYERS + 1][32];
new Handle:g_hSqlTuple, Handle:g_hSqlConnection;
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
InitCvars();
InitCmds();
InitSQL();
}
public client_putinserver(id)
{
SQL_Load(id);
}
public plugin_end()
{
SQL_FreeHandle(g_hSqlTuple);
if(g_hSqlConnection) SQL_FreeHandle(g_hSqlConnection);
}
public InitCvars()
{
new pCvar;
pCvar = create_cvar("cm_host", "ip", FCVAR_PROTECTED, "Host");
bind_pcvar_string(pCvar, g_Cvars[HOST], charsmax(g_Cvars[HOST]));
pCvar = create_cvar("cm_user", "name", FCVAR_PROTECTED, "User");
bind_pcvar_string(pCvar, g_Cvars[USER], charsmax(g_Cvars[USER]));
pCvar = create_cvar("cm_pass", "pass", FCVAR_PROTECTED, "Pass");
bind_pcvar_string(pCvar, g_Cvars[PASS], charsmax(g_Cvars[PASS]));
pCvar = create_cvar("cm_db", "name_db", FCVAR_PROTECTED, "DB");
bind_pcvar_string(pCvar, g_Cvars[DB], charsmax(g_Cvars[DB]));
pCvar = create_cvar("cm_table", "cm_prefixes", FCVAR_PROTECTED, "Table");
bind_pcvar_string(pCvar, g_Cvars[TABLE], charsmax(g_Cvars[TABLE]));
pCvar = create_cvar("cm_access", "a", FCVAR_PROTECTED, "Access");
bind_pcvar_string(pCvar, g_Cvars[ACCESS], charsmax(g_Cvars[ACCESS]));
AutoExecConfig();
}
public InitCmds()
{
// "player_name" "player_steamid" "prefix" "days"
register_concmd("cm_set_prefix_sql", "CmdSetPrefix");
// "player_steamid"
register_concmd("cm_reset_prefix_sql", "CmdResetPrefix");
register_concmd("cm_refresh_prefix", "SQL_Load"); //добавлена кмд для обновления
}
public CmdSetPrefix(id)
{
if(!(get_user_flags(id) & read_flags(g_Cvars[ACCESS])))
return PLUGIN_HANDLED;
new szArgs[256], szName[MAX_NAME_LENGTH], szAuth[24], szPrefix[32], szDays[6];
read_args(szArgs, charsmax(szArgs));
remove_quotes(szArgs);
trim(szArgs);
parse(szArgs,
szName, charsmax(szName),
szAuth, charsmax(szAuth),
szPrefix, charsmax(szPrefix),
szDays, charsmax(szDays));
new iDays = str_to_num(szDays);
if(!szAuth[0] || !szPrefix[0])
{
console_print(id, "[%s] Error. Syntax: cm_set_prefix_sql ^"player_name^" ^"player_steamid^" ^"prefix^" ^"days^"", PLUGIN_NAME);
return PLUGIN_HANDLED;
}
new pTarget = find_player_ex(FindPlayer_MatchAuthId,szAuth);
SQL_Delete(szAuth); //удаляем старую запись если есть
SQL_Insert(szName, szAuth, szPrefix, iDays);
SQL_Load(pTarget); //обновляем преф
console_print(id, "[%s] Prefix set: %s | %s | %s | %d day(s)", PLUGIN_NAME, szName, szAuth, szPrefix, iDays);
return PLUGIN_HANDLED;
}
public CmdResetPrefix(id)
{
if(!(get_user_flags(id) & read_flags(g_Cvars[ACCESS])))
return PLUGIN_HANDLED;
new szAuth[24];
read_args(szAuth, charsmax(szAuth));
remove_quotes(szAuth);
trim(szAuth);
if(!szAuth[0])
{
console_print(id, "[%s] Error. Syntax: cm_reset_prefix_sql ^"player_steamid^"", PLUGIN_NAME);
return PLUGIN_HANDLED;
}
new pTarget = find_player_ex(FindPlayer_MatchAuthId,szAuth);
SQL_Delete(szAuth);
g_sPrefix[pTarget] = "";
cm_set_prefix(pTarget, g_sPrefix[pTarget]); //обнуляем преф
console_print(id, "[%s] Data is deleted: %s", PLUGIN_NAME, szAuth);
return PLUGIN_HANDLED;
}
public InitSQL()
{
g_hSqlTuple = SQL_MakeDbTuple(g_Cvars[HOST], g_Cvars[USER], g_Cvars[PASS], g_Cvars[DB]);
SQL_SetCharset(g_hSqlTuple, "utf8");
new iError, szError[128];
g_hSqlConnection = SQL_Connect(g_hSqlTuple, iError, szError, charsmax(szError));
if(g_hSqlConnection == Empty_Handle)
set_fail_state("%s %d", szError, iError);
server_print("[%s] SQL connection was successfully established with the server.", PLUGIN_NAME);
new szQuery[512];
new cData[1]; cData[0] = SQL_TABLE;
formatex(szQuery, charsmax(szQuery), "\
CREATE TABLE IF NOT EXISTS `%s` \
( \
`id` INT(11) NOT NULL auto_increment PRIMARY KEY, \
`player_name` VARCHAR(32) DEFAULT 'N/A', \
`player_steamid` VARCHAR(24) DEFAULT 'N/A', \
`prefix` VARCHAR(32) DEFAULT 'N/A', \
`expired` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP \
);", g_Cvars[TABLE]);
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQuery, cData, sizeof(cData));
SQL_Clear();
}
public QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, cData[], iSize, Float:fQueueTime)
{
if(iFailState != TQUERY_SUCCESS)
{
log_amx("SQL Error #%d - %s", iErrnum, szError);
return;
}
switch(cData[0])
{
case SQL_TABLE, SQL_CLEAR, SQL_INSERT, SQL_DELETE: {}
case SQL_LOAD:
{
new id = cData[1];
if(!is_user_connected(id))
return;
if(SQL_NumResults(hQuery))
{
SQL_ReadResult(hQuery, FIELD_PREFIX, g_sPrefix[id], charsmax(g_sPrefix[]));
replace_color_tag(g_sPrefix[id]);
cm_set_prefix(id, g_sPrefix[id]);
}
else
g_sPrefix[id] = "";
}
}
}
public SQL_Clear()
{
new szQuery[256];
new cData[1]; cData[0] = SQL_CLEAR;
formatex(szQuery, charsmax(szQuery), "\
DELETE \
FROM `%s` \
WHERE `expired` <= now()", g_Cvars[TABLE]);
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQuery, cData, sizeof(cData));
}
public SQL_Load(id)
{
new szQuery[256];
new cData[2]; cData[0] = SQL_LOAD, cData[1] = id;
new szAuth[24]; get_user_authid(id, szAuth, charsmax(szAuth));
formatex(szQuery, charsmax(szQuery), "\
SELECT * \
FROM `%s` \
WHERE `player_steamid` = '%s'", g_Cvars[TABLE], szAuth);
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQuery, cData, sizeof(cData));
}
SQL_Insert(szName[] = "", szAuth[], szPrefix[], iDays)
{
new szQuery[512], szDays[32];
new cData[1]; cData[0] = SQL_INSERT;
if(iDays)
formatex(szDays, charsmax(szDays), "now() + interval %d day", iDays);
formatex(szQuery, charsmax(szQuery), "\
INSERT INTO `%s` \
( \
`player_name`, \
`player_steamid`, \
`prefix`, \
`expired` \
) \
VALUES \
( \
'%s', \
'%s', \
'%s', \
%s \
)", g_Cvars[TABLE], szName, szAuth, szPrefix, !iDays ? "NULL" : szDays);
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQuery, cData, sizeof(cData));
}
public SQL_Delete(szAuth[])
{
new szQuery[256];
new cData[1]; cData[0] = SQL_DELETE;
formatex(szQuery, charsmax(szQuery), "\
DELETE \
FROM `%s` \
WHERE `player_steamid` = '%s'", g_Cvars[TABLE], szAuth);
SQL_ThreadQuery(g_hSqlTuple, "QueryHandler", szQuery, cData, sizeof(cData));
}
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;
}
Ни как не подключается к базе, перепробовал все настройки, ни чего не помогло, в исходнике прописывал данные бд, вместо IP хоста начал выдавать IP сервера, помогите исправить ошибку.
В этой теме было размещено решение! Перейти к решению.