- Ошибка
-
Ошибок нет
- ОС
- Linux
- Amx Mod X
-
1.9.0
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.697-dev
Build date: 20:42:34 Jul 24 2020 (2295)
Build from: https://github.com/dreamstalker/rehlds/commit/98db467
- ReGamedll
-
ReGameDLL version: 5.18.0.474-dev
Build date: 11:07:34 Jul 16 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/efb06a7
- Версия Metamod
-
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
- Список метамодулей
-
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5271 ini Start ANY
[ 3] Reunion RUN - reunion_mm_i386.so v0.1.0.92c ini Start Never
[ 4] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 5] MySQL RUN - mysql_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[ 6] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[ 7] CSX RUN - csx_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[ 8] Engine RUN - engine_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[ 9] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[10] Fun RUN - fun_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[11] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[12] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5271 pl2 ANY ANY
[13] ReAPI RUN - reapi_amxx_i386.so v5.15.0.197-dev pl2 ANY Never
- Список плагинов
-
[ 7] Commands Menu 1.9.0.5271 AMXX Dev Team cmdmenu.amxx running
[ 8] Maps Menu 1.9.0.5271 AMXX Dev Team mapsmenu.amxx running
[ 9] Plugin Menu 1.9.0.5271 AMXX Dev Team pluginmenu.amxx running
[ 10] Admin Chat 1.9.0.5271 AMXX Dev Team adminchat.amxx running
[ 11] Anti Flood 1.9.0.5271 AMXX Dev Team antiflood.amxx running
[ 12] Scrolling Message 1.9.0.5271 AMXX Dev Team scrollmsg.amxx running
[ 13] Info. Messages 1.9.0.5271 AMXX Dev Team imessage.amxx running
[ 14] Admin Votes 1.9.0.5271 AMXX Dev Team adminvote.amxx running
[ 15] NextMap 1.9.0.5271 AMXX Dev Team nextmap.amxx running
[ 16] Nextmap Chooser 1.9.0.5271 AMXX Dev Team mapchooser.amxx running
[ 17] TimeLeft 1.9.0.5271 AMXX Dev Team timeleft.amxx running
[ 18] Pause Plugins 1.9.0.5271 AMXX Dev Team pausecfg.amxx running
[ 19] Stats Configuration 1.9.0.5271 AMXX Dev Team statscfg.amxx running
[ 20] StatsX 1.9.0.5271 AMXX Dev Team statsx.amxx running
[ 21] New Kick Menu 1.4.2 Radius newkickmenu.amx running
[ 22] Chat Manager 1.1.2-16 Mistrick chatmanager.amx running
[ 23] Chat Manager: Prefixes 0.1b Denzer chatmanager_pre running
[ 24] Chat Manager: Addon 0.0.4-70 Mistrick chatmanager_add running
[ 25] unknown unknown unknown colored_transli bad load
[ 26] Colored Translit Confi 3.0 Sho0ter colored_transli running
[ 27] [JBE] Core 1.0 Sanlerus jbe_core_mod1.a running
[ 28] [JBE_DM] BAW 1.1 BANTYP jbe_dm_baw.amxx running
[ 29] [JBE_DM] Birth Day 1.1 Freedo.m jbe_dm_birthday running
[ 30] [JBE] DOGONYLKI 1.1 BATYP jbe_dm_dogon9lk running
[ 31] [JBE] GALAXY 1.0 arttty7 jbe_dm_galaxy.a running
[ 32] [JBE_DM] Ghosts 1.1 Freedo.m jbe_dm_ghosts.a running
[ 33] [JBE_DM] Hide And Seek 1.1 Freedo.m jbe_dm_hideands running
[ 34] [JBE_DM] Ringolevio 1.1 Freedo.m jbe_dm_ringolev running
[ 35] [JBE] Elite Admin 1.0 SteFFaN jbe_elite_admin running
[ 36] [JBE] hook_new 1.2.1 okeeey jbe_hook_new.am running
[ 37] [JBE_DM] Ghosts 1.1 Freedo.m jbe_shturm.amxx running
[ 38] Players Menu 1.8.2 AMXX Dev Team plmenu.amxx running
[ 39] Grab Modular 1.1.3 w0w grab_modular.am running
[ 40] unknown unknown unknown grab/grab_modul bad load
[ 41] Grab: Notify on Grab 1.0.0 w0w grab/grab_notif running
[ 42] Grab: Rendering 1.0.0 w0w grab/grab_rende running
[ 43] Grab Menu: Core 1.0.3 w0w grab/grab_menu/ running
[ 44] Grab Menu: Kill 1.0.0 w0w grab/grab_menu/ running
[ 45] Grab Menu: Kick 1.0.0 w0w grab/grab_menu/ running
[ 46] Grab Menu: Freeze 1.0.0 w0w grab/grab_menu/ running
- Автор плагина
- Denzer
- Версия плагина
- 0.1b
- Исходный код
-
#include <amxmodx>
#include <sqlx>
#include <chatmanager>
#pragma semicolon 1
#define PLUGIN_NAME "Chat Manager: Prefixes MySQL"
#define PLUGIN_VERSION "0.1b"
#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", "127.0.0.1", FCVAR_PROTECTED, "Host");
bind_pcvar_string(pCvar, g_Cvars[HOST], charsmax(g_Cvars[HOST]));
pCvar = create_cvar("cm_user", "mvxmvl", FCVAR_PROTECTED, "User");
bind_pcvar_string(pCvar, g_Cvars[USER], charsmax(g_Cvars[USER]));
pCvar = create_cvar("cm_pass", "MaxIM17$hmIdt/", FCVAR_PROTECTED, "Pass");
bind_pcvar_string(pCvar, g_Cvars[PASS], charsmax(g_Cvars[PASS]));
pCvar = create_cvar("cm_db", "test_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");
}
public CmdSetPrefix(id)
{
if(id && ~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;
}
SQL_Insert(szName, szAuth, szPrefix, iDays);
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(id && ~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;
}
SQL_Delete(szAuth);
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, "utf-8");
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;
}
Привет. Файл конфигурации не подгружается плагином, хоть и сам и создается. Из-за этого используется default значения для подключения к БД. Залез в .sma, поменял дефолт значения и решил этот вопрос, но, думаю, что нужно починить .cfg файл