Участник
Пользователь
- Сообщения
- 93
- Реакции
- 12
- Ошибка
-
L 03/16/2021 - 00:31:36: Start of error session.
L 03/16/2021 - 00:31:36: Info (map "cs_pf_dust") (file "addons/amxmodx/logs/error_20210316.log")
L 03/16/2021 - 00:31:36: [MySQL] Invalid handle: 0
L 03/16/2021 - 00:31:36: [AMXX] Displaying debug trace (plugin "CA_Storage_GameCMS.amxx", version "v1.3.0")
L 03/16/2021 - 00:31:36: [AMXX] Run time error 10: native error (native "SQL_FreeHandle")
L 03/16/2021 - 00:31:36: [AMXX] [0] CA_Storage_GameCMS.sma::plugin_end (line 60)
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5271
- Билд
-
ReHLDS version: 3.8.0.711-dev
Build date: 13:13:38 Feb 6 2021 (2492)
- ReGamedll
-
ReGameDLL version: 5.20.0.492-dev
Build date: 15:26:35 Jan 4 2021
- Версия Metamod
-
Metamod v1.21p37 2013/05/30 (5:13)
- Список метамодулей
-
[ 1] Reunion RUN - reunion_mm_i386. v0.1.92d ini Start Never
[ 2] AMX Mod X RUN - amxmodx_mm_i386. v1.9.0.5 ini Start ANY
[ 3] ReSRDetector RUN - resrdetector_mm_ v0.1.0 ini Chlvl ANY
[ 4] ReAuthCheck RUN - reauthcheck_mm_i v0.1.6 ini Start Never
[ 5] Rechecker RUN - rechecker_mm_i38 v2.5 ini Chlvl ANY
[ 6] Revoice RUN - revoice_mm_i386. v0.1.0.3 ini Start Never
[ 7] WHBlocker RUN - whblocker_mm_i38 v1.5.697 ini Chlvl ANY
[ 8] ReSemiclip RUN - resemiclip_mm_i3 v2.3.9 ini Chlvl ANY
[ 9] ReAimDetector RUN - reaimdetector_am v0.2.2 pl2 ANY Never
[10] GeoIP RUN - geoip_amxx_i386. v1.9.0.5 pl2 ANY ANY
[11] MySQL RUN - mysql_amxx_i386. v1.9.0.5 pl2 ANY ANY
[12] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0.5 pl2 ANY ANY
[13] Engine RUN - engine_amxx_i386 v1.9.0.5 pl2 ANY ANY
[14] AuthEmu RUN - authemu_amxx_i38 v5.2.12. pl2 ANY Never
[15] ReAPI RUN - reapi_amxx_i386. v5.19.0. pl2 ANY Never
[16] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl2 ANY ANY
[17] CSX RUN - csx_amxx_i386.so v1.9.0.5 pl2 ANY ANY
[18] CStrike RUN - cstrike_amxx_i38 v1.9.0.5 pl2 ANY ANY
18 plugins, 18 running
- Список плагинов
-
[ 1] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 2] GameCMS_API 5.4.9 zhorzh78 gamecms_api_5.4 running
[ 3] FreshBans 1.4.3b kanagava fresh_bans_143_ running
[ 4] [182] VoteBan L4D 17.10.30 Sanlerus voteban_l4d.amx running
[ 5] [190] Cvar On Map 20.06.06 SKAJIbnEJIb cvar_on_map.amx running
[ 6] [190] Screen Player 20.06.06 SKAJIbnEJIb screen_player.a running
[ 7] Advanced Kill Assists 1.3c Xelson next21_kill_ass running
[ 8] [190] Army Ranks Ultim 20.06.06 SKAJIbnEJIb army_ranks_ulti running
[ 9] [190] CsStats MySQL 20.06.06 SKAJIbnEJIb csstats_mysql.a running
[ 10] AR Double 14.12.02 SKAJIbnEJIb ar_double.amxx running
[ 11] [190] AR Bets 20.06.06 SKAJIbnEJIb ar_bets.amxx running
[ 12] Pause Plugins 1.9.0.5271 AMXX Dev Team pausecfg.amxx running
[ 13] [190] Stats Configurat 20.06.06 SKAJIbnEJIb & AM statscfg_rbs.am running
[ 14] [190] StatsX RBS 20.06.06 SKAJIbnEJIb & AM statsx_rbs.amxx running
[ 15] CS Misc. Stats 1.9.0.5271 AMXX Dev Team miscstats.amxx running
[ 16] CS Stats Logging 1.9.0.5271 AMXX Dev Team stats_logging.a running
[ 17] Admin Commands 1.9.0.5271 AMXX Dev Team admincmd.amxx running
[ 18] Slots Reservation 1.9.0.5271 AMXX Dev Team adminslots.amxx running
[ 19] Menus Front-End 20.06.06 SKAJIbnEJIb & AM amxmodmenu_rbs. running
[ 20] Commands Menu 1.9.0.5271 AMXX Dev Team cmdmenu.amxx running
[ 21] Players Menu 1.7 neugomon players_menu.am running
[ 22] Teleport Menu 1.9.0.5271 AMXX Dev Team telemenu.amxx running
[ 23] Maps Menu 1.9.0.5271 AMXX Dev Team mapsmenu.amxx running
[ 24] Plugin Menu 1.9.0.5271 AMXX Dev Team pluginmenu.amxx running
[ 25] Restrict Weapons 1.9.0.5271 AMXX Dev Team restmenu.amxx running
[ 26] Admin Chat 1.9.0.5271 AMXX Dev Team adminchat.amxx running
[ 27] [190] Chat Controller 20.06.06 SKAJIbnEJIb chat_controller running
[ 28] Scrolling Message 1.9.0.5271 AMXX Dev Team scrollmsg.amxx running
[ 29] Info. Messages 1.9.0.5271 AMXX Dev Team imessage.amxx running
[ 30] Admin Votes 1.9.0.5271 Wildness Team adminvote.amxx running
[ 31] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 32] Lite MapChooser 2.6 neygomon lite_mapchooser running
[ 33] ReChecker Logging freesrv AMXX rc_logging.amxx running
[ 34] RC BaseChanger freesrv AMXX rc_basechanger. running
[ 35] AntiSpam FlashLight 1.0 Leo_[BH] flashlight_no_s running
[ 36] [190] High Ping Kicker 20.06.06 SKAJIbnEJIb hpk_rbs.amxx running
[ 37] AFK Control ReNew 1.2(a) neygomon afk_control.amx running
[ 38] Spect Bot 1.2 SKAJIbnEJIb & Bo SpectBot.amxx running
[ 39] C4_Block 1.0 SNauPeR C4_Block.amxx paused
[ 40] FPS Meter 1.1 neygomon fps.amxx running
[ 41] Flashbang Ban 0.2 mx?! flashbang_ban.a running
[ 42] Auto recording demo 2.0 IzI | Bonaqua (R amx_autodemorec running
[ 43] [ReAPI] Advanced Team 0.1.0 Vaqtincha AdvancedTeamCho running
[ 44] GameName Changer 1.0 neugomon gamename_change running
[ 45] Welcom 1.0 4el welcome_music.a running
[ 46] Advanced Ultimate Weap 0.1.0b steelzzz auw.amxx running
[ 47] unknown unknown unknown ultimate_weapon running
[ 48] [AUW] Addon: Weapon Ma 0.0.2 xxx auw_addon_maps. running
[ 49] [190] VIP RBS 20.07.20 SKAJIbnEJIb vip_rbs.amxx running
[ 50] [190] AR Vampire 20.06.06 SKAJIbnEJIb ar_vampire.amxx running
[ 51] [190] Ultimate Models 20.06.06 SKAJIbnEJIb ultimate_models running
[ 52] [ReAPI] Healthnade 0.0.2 F@nt0M reapi_healthnad running
[ 53] TOP VIP (Auto Set) 1.0a Leo_[BH] top_vip.amxx running
[ 54] Map Spawns Editor 1.0.16 iG_os map_spawns_edit running
[ 55] [182] PTB RBS 20.06.06 SKAJIbnEJIb ptb_rbs.amxx running
[ 56] Online Helper 2.1.3 Nordic Warrior online_helper.a running
[ 57] Parachute 1.0 maeStro parachute.amxx running
[ 58] Mode 2x2 2.5re s1lent mode.amxx running
[ 59] [ReAPI] AWPoff 1.4.3 PAffAEJIkA :3 awp_off.amxx running
[ 60] Advanced Bullet Damage 1.0 Sn!ff3r/Vaqtinch damager.amxx running
[ 61] ResetScore 1.0 Leo_[BH] resetscore_reap running
[ 62] [182] Crux Ansata 17.10.30 Sanlerus crux_ansata.amx running
[ 63] Nade Messages 1.0 v3x nademessages.am running
[ 64] Death Gift 2.0.0 ArKaNeMaN DeathGift.amxx running
[ 65] [DG] More Bonuses 2.0.0 ArKaNeMaN DG_MoreBonuses. running
[ 66] [DG] More Funcs 2.0.0 ArKaNeMaN DG_MoreFuncs.am running
[ 67] [DG] ARU Ext. 1.0.0 ArKaNeMaN DG_Aru.amxx running
[ 68] [DG] AUW Ext. 1.0.0 ArKaNeMaN DG_Auw.amxx running
[ 69] [DG] Misc Bonuses 1.0.0 ArKaNeMaN DG_Misc.amxx running
[ 70] [190] Hostage Mod 20.08.08 SKAJIbnEJIb hostage_mod.amx stopped
[ 71] [190] Real Hostages 20.06.06 SKAJIbnEJIb & Av real_hostages.a stopped
[ 72] GameCMS_Achievs_Core 1.3 zhorzh78 gamecms_achievs running
[ 73] GameCMS_Player_Achievs 1.3 zhorzh78 player_achievs_ running
[ 74] GameCMS_Special_Achiev 1.3 zhorzh78 special_achievs running
[ 75] GameCMS_Bomb_Achievs 1.2 zhorzh78 bomb_achievs_1. running
[ 76] CMS Achevs Reward 3.0 ApXuTekToR CMSAchevs_Rewar debug
[ 77] GameCMS BonusSystem 1.1 +- DUKKHAZ0R gamecms_bonus.a running
[ 78] [ReAPI] TopRoundDamage 1.0.6 Dager* *.* -G- damage_round.am running
[ 79] Win Team 1.0 maFFyoZZyk win_team.amxx running
[ 80] Knife Duel with Telepo 1.2 neygomon knife_duel.amxx running
[ 81] Ultimate KillStreak Ad 0.7 SAMURAI ut_killstreak_a running
[ 82] ChatAdditions: Core v1.3.0 Sergey Shorokhov ChatAdditions_C debug
[ 83] ChatAdditions: GameCMS v1.3.0 Sergey Shorokhov CA_Storage_Game debug
[ 84] CA: Mute v1.3.0 Sergey Shorokhov CA_Mute.amxx debug
[ 85] CA: Gag v1.3.0 Sergey Shorokhov CA_Gag.amxx debug
[ 86] [190] Chat RBS 20.06.06 SKAJIbnEJIb chat_rbs.amxx running
- Автор плагина
- Sergey Shorokhov
- Версия плагина
- v1.3.0
- Исходный код
-
#include <amxmodx>
#include <sqlx>
#include <cellqueue>
#include <ChatAdditions>
#include <CA_StorageAPI_endpoint>
#include <CA_GAG_API>
#pragma ctrlchar '\'
#pragma dynamic 131072
#pragma tabsize 2
#pragma reqlib mysql
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib mysql
#endif
new const SQL_TBL_GAGS[] = "comms"
const QUERY_LENGTH = 4096
const MAX_REASON_LENGTH = 256;
new g_query[QUERY_LENGTH]
new Handle: g_tuple = Empty_Handle
new Queue: g_queueLoad = Invalid_Queue
new g_serverID = -1
new ca_storage_host[64],
ca_storage_user[128],
ca_storage_pass[128],
ca_storage_dbname[128]
public stock const PluginName[] = "ChatAdditions: GameCMS storage"
public stock const PluginVersion[] = CA_VERSION
public stock const PluginAuthor[] = "Sergey Shorokhov"
public stock const PluginURL[] = "github.com/ChatAdditions/ChatsAdditions_AMXX"
public stock const PluginDescription[] = "GameCMS storage provider for ChatAdditions"
public plugin_init() {
register_plugin(PluginName, PluginVersion, PluginAuthor)
if(!SQL_SetAffinity("mysql")) {
set_fail_state("Can't user 'MySQL'. Check modules.ini")
}
Register_CVars()
AutoExecConfig(true, "CA_Storage_GameCMS")
g_queueLoad = QueueCreate(MAX_AUTHID_LENGTH)
}
public OnConfigsExecuted() {
g_tuple = SQL_MakeDbTuple(ca_storage_host, ca_storage_user, ca_storage_pass, ca_storage_dbname)
SQL_SetCharset(g_tuple, "utf8")
Storage_Create()
}
public plugin_end() {
SQL_FreeHandle(g_tuple)
QueueDestroy(g_queueLoad)
}
public plugin_natives() {
RegisterNatives()
}
public plugin_cfg() {
RegisterForwards()
}
Register_CVars() {
bind_pcvar_string(create_cvar("ca_storage_host", "127.0.0.1", FCVAR_PROTECTED,
.description = "GameCMS MySQL database host address"
),
ca_storage_host, charsmax(ca_storage_host)
)
bind_pcvar_string(create_cvar("ca_storage_user", "root", FCVAR_PROTECTED,
.description = "GameCMS MySQL database user"
),
ca_storage_user, charsmax(ca_storage_user)
)
bind_pcvar_string(create_cvar("ca_storage_pass", "", FCVAR_PROTECTED,
.description = "GameCMS MySQL database host password"
),
ca_storage_pass, charsmax(ca_storage_pass)
)
bind_pcvar_string(create_cvar("ca_storage_dbname", "players_gags", FCVAR_PROTECTED,
.description = "GameCMS MySQL database name"
),
ca_storage_dbname, charsmax(ca_storage_dbname)
)
}
Storage_Create() {
formatex(g_query, charsmax(g_query), "CREATE TABLE IF NOT EXISTS %s ", SQL_TBL_GAGS); {
strcat(g_query, "( bid int(6) NOT NULL AUTO_INCREMENT,", charsmax(g_query))
strcat(g_query, "authid varchar(32) COLLATE utf8_unicode_ci NOT NULL,", charsmax(g_query))
strcat(g_query, "name varchar(32) COLLATE utf8_unicode_ci NOT NULL,", charsmax(g_query))
strcat(g_query, "created int(11) NOT NULL,", charsmax(g_query))
strcat(g_query, "expired int(11) NOT NULL,", charsmax(g_query))
strcat(g_query, "length int(10) NOT NULL,", charsmax(g_query))
strcat(g_query, "reason varchar(64) COLLATE utf8_unicode_ci NOT NULL,", charsmax(g_query))
strcat(g_query, "admin_id int(6) NOT NULL,", charsmax(g_query))
strcat(g_query, "admin_nick varchar(32) COLLATE utf8_unicode_ci NOT NULL,", charsmax(g_query))
strcat(g_query, "server_id int(6) NOT NULL,", charsmax(g_query))
strcat(g_query, "modified_by varchar(32) COLLATE utf8_unicode_ci NOT NULL,", charsmax(g_query))
strcat(g_query, "type int(2) NOT NULL,", charsmax(g_query))
strcat(g_query, "PRIMARY KEY (bid),", charsmax(g_query))
strcat(g_query, "KEY sid (server_id),", charsmax(g_query))
strcat(g_query, "KEY type (type),", charsmax(g_query))
strcat(g_query, "KEY authid (authid),", charsmax(g_query))
strcat(g_query, "KEY created (created),", charsmax(g_query))
strcat(g_query, "KEY aid (admin_id)", charsmax(g_query))
strcat(g_query, ") ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=37 ;", charsmax(g_query))
}
SQL_ThreadQuery(g_tuple, "handle_StorageCreated", g_query)
}
public handle_StorageCreated(failstate, Handle: query, error[], errnum, data[], size, Float: queuetime) {
if(IsSQLQueryFailed(failstate, query, error, errnum)) {
return
}
CA_Log(logLevel_Debug, "Table '%s' created! (queryTime: '%.3f' sec)", SQL_TBL_GAGS, queuetime)
GameCMS_GetServerID()
}
Storage_Save(const name[], const authID[], const IP[],
const reason[], const adminName[], const adminAuthID[],
const adminIP[], const expireAt, const flags) {
#pragma unused adminIP, adminAuthID, IP
new name_safe[MAX_NAME_LENGTH * 2];
SQL_QuoteString(Empty_Handle, name_safe, charsmax(name_safe), name);
new reason_safe[MAX_REASON_LENGTH * 2];
SQL_QuoteString(Empty_Handle, reason_safe, charsmax(reason_safe), reason);
new adminName_safe[MAX_NAME_LENGTH * 2];
SQL_QuoteString(Empty_Handle, adminName_safe, charsmax(adminName_safe), adminName);
// TODO: Optimize this EPIC QUERY
formatex(g_query, charsmax(g_query), "INSERT INTO %s ", SQL_TBL_GAGS); {
strcat(g_query, "( authid,name,created,", charsmax(g_query))
strcat(g_query, "expired,length,reason,", charsmax(g_query))
strcat(g_query, "admin_id,admin_nick,server_id,modified_by,type )", charsmax(g_query))
strcat(g_query, " VALUES ( ", charsmax(g_query))
strcat(g_query, fmt("'%s',", authID), charsmax(g_query))
strcat(g_query, fmt("'%s',", name_safe), charsmax(g_query))
strcat(g_query, fmt("UNIX_TIMESTAMP(NOW()),"), charsmax(g_query))
strcat(g_query, fmt("%i,", expireAt), charsmax(g_query))
strcat(g_query, fmt("(%i - UNIX_TIMESTAMP(NOW())) / 60,", expireAt), charsmax(g_query))
strcat(g_query, fmt("'%s',", reason_safe), charsmax(g_query))
strcat(g_query, fmt("'%i',", 1 /* JUST A 1 AND NOTHING ELSE!!! */), charsmax(g_query))
strcat(g_query, fmt("'%s',", adminName_safe), charsmax(g_query))
strcat(g_query, fmt("'%i',", g_serverID), charsmax(g_query))
strcat(g_query, fmt("'%s',", adminName_safe), charsmax(g_query))
strcat(g_query, fmt("%i ) ", CAGAGFlags_to_GCMS_Flags(gag_flags_s: flags)), charsmax(g_query))
strcat(g_query, "ON DUPLICATE KEY UPDATE ", charsmax(g_query))
strcat(g_query, fmt("name='%s',", name_safe), charsmax(g_query))
strcat(g_query, fmt("reason='%s',", reason_safe), charsmax(g_query))
strcat(g_query, fmt("admin_nick='%s',", adminName_safe), charsmax(g_query))
strcat(g_query, "created=UNIX_TIMESTAMP(NOW()),", charsmax(g_query))
strcat(g_query, fmt("expired=%i,", expireAt), charsmax(g_query))
strcat(g_query, fmt("type=%i; ", CAGAGFlags_to_GCMS_Flags(gag_flags_s: flags)), charsmax(g_query))
}
SQL_ThreadQuery(g_tuple, "handle_Saved", g_query)
}
public handle_Saved(failstate, Handle: query, error[], errnum, data[], size, Float: queuetime) {
if(IsSQLQueryFailed(failstate, query, error, errnum)) {
return
}
formatex(g_query, charsmax(g_query), "SELECT \
name,authid,reason,\
admin_nick,\
created,expired,type")
strcat(g_query, fmt(" FROM %s", SQL_TBL_GAGS), charsmax(g_query))
strcat(g_query, fmt(" WHERE bid=%i;", SQL_GetInsertId(query)), charsmax(g_query))
SQL_ThreadQuery(g_tuple, "handle_SavedResult", g_query)
}
public handle_SavedResult(failstate, Handle: query, error[], errnum, data[], size, Float: queuetime) {
if(IsSQLQueryFailed(failstate, query, error, errnum)) {
return
}
enum { res_name, res_authid, /* res_ip, */ res_reason,
res_admin_name, /* res_admin_authid, res_admin_ip, */
res_created_at, res_expire_at, res_flags
}
new name[MAX_NAME_LENGTH]; SQL_ReadResult(query, res_name, name, charsmax(name))
new authID[MAX_AUTHID_LENGTH]; SQL_ReadResult(query, res_authid, authID, charsmax(authID))
new IP[MAX_IP_LENGTH]; /* SQL_ReadResult(query, res_ip, IP, charsmax(IP)) */
new reason[MAX_REASON_LENGTH]; SQL_ReadResult(query, res_reason, reason, charsmax(reason))
new adminName[MAX_NAME_LENGTH]; SQL_ReadResult(query, res_admin_name, adminName, charsmax(adminName))
new adminAuthID[MAX_AUTHID_LENGTH];/* SQL_ReadResult(query, res_admin_authid, adminAuthID, charsmax(adminAuthID)) */
new adminIP[MAX_IP_LENGTH]; /* SQL_ReadResult(query, res_admin_ip, adminIP, charsmax(adminIP)) */
new createdAt = SQL_ReadResult(query, res_created_at)
new expireAt = SQL_ReadResult(query, res_expire_at)
new flags = GCMS_FlagsTo_CAGAGFlags(SQL_ReadResult(query, res_flags))
CA_Log(logLevel_Debug, "Player gag saved {'%s', '%s', '%s', '%s', '%s', '%s', '%s', %i, %i, %i} (queryTime: '%.3f' sec)", \
name, authID, IP, reason, adminName, adminAuthID, adminIP, createdAt, expireAt, flags,\
queuetime \
)
ExecuteForward(g_fwd_StorageSaved, g_ret,
name, authID, IP, reason,
adminName, adminAuthID, adminIP,
createdAt, expireAt, flags
)
}
Storage_Load(const authID[]) {
if(!g_storageInitialized) {
QueuePushString(g_queueLoad, authID)
return
}
formatex(g_query, charsmax(g_query), "SELECT name, authid, reason,\
admin_nick, \
created, expired, type FROM %s", SQL_TBL_GAGS); {
strcat(g_query, fmt(" WHERE (authid = '%s')", authID), charsmax(g_query))
strcat(g_query, " AND (expired > UNIX_TIMESTAMP(NOW())) LIMIT 1;", charsmax(g_query))
}
SQL_ThreadQuery(g_tuple, "handle_Loaded", g_query)
}
public handle_Loaded(failstate, Handle: query, error[], errnum, data[], size, Float: queuetime) {
if(IsSQLQueryFailed(failstate, query, error, errnum)) {
return
}
enum { res_name, res_authid, /* res_ip, */res_reason,
res_admin_name, /* res_admin_authid, res_admin_ip, */
res_created_at, res_expire_at, res_flags
}
new bool: found = (SQL_NumResults(query) != 0)
if(!found) {
return;
}
new name[MAX_NAME_LENGTH]; SQL_ReadResult(query, res_name, name, charsmax(name))
new authID[MAX_AUTHID_LENGTH]; SQL_ReadResult(query, res_authid, authID, charsmax(authID))
new IP[MAX_IP_LENGTH]; /* SQL_ReadResult(query, res_ip, IP, charsmax(IP)) */
new reason[MAX_REASON_LENGTH]; SQL_ReadResult(query, res_reason, reason, charsmax(reason))
new adminName[MAX_NAME_LENGTH]; SQL_ReadResult(query, res_admin_name, adminName, charsmax(adminName))
new adminAuthID[MAX_AUTHID_LENGTH]; /* SQL_ReadResult(query, res_admin_authid, adminAuthID, charsmax(adminAuthID)) */
new adminIP[MAX_IP_LENGTH]; /* SQL_ReadResult(query, res_admin_ip, adminIP, charsmax(adminIP)) */
new createdAt = SQL_ReadResult(query, res_created_at)
new expireAt = SQL_ReadResult(query, res_expire_at)
new flags = GCMS_FlagsTo_CAGAGFlags(SQL_ReadResult(query, res_flags))
CA_Log(logLevel_Debug, "Player gag loaded {'%s', '%s', '%s', '%s', '%s', '%s', '%s', %i, %i, %i} (queryTime: '%.3f' sec)", \
name, authID, IP, reason, adminName, adminAuthID, adminIP, createdAt, expireAt, flags,\
queuetime \
)
ExecuteForward(g_fwd_StorageLoaded, g_ret,
name, authID, IP, reason,
adminName, adminAuthID, adminIP,
createdAt, expireAt, flags
)
}
Storage_Remove(const authID[]) {
formatex(g_query, charsmax(g_query), "DELETE FROM %s ", SQL_TBL_GAGS); {
strcat(g_query, fmt("WHERE (authid = '%s')", authID), charsmax(g_query))
}
SQL_ThreadQuery(g_tuple, "handle_Removed", g_query)
}
public handle_Removed(failstate, Handle: query, error[], errnum, data[], size, Float: queuetime) {
if(IsSQLQueryFailed(failstate, query, error, errnum)) {
return
}
CA_Log(logLevel_Debug, "Player gag removed { } (queryTime: '%.3f' sec)", \
queuetime \
)
ExecuteForward(g_fwd_StorageRemoved, g_ret)
}
GameCMS_GetServerID() {
new net_address[64]; get_cvar_string("net_address", net_address, charsmax(net_address))
new serverAddress[2][32]; explode_string(net_address, ":", serverAddress, sizeof(serverAddress), charsmax(serverAddress[]))
formatex(g_query, charsmax(g_query), "SELECT id FROM servers WHERE servers.ip = '%s' AND servers.port = '%s' LIMIT 1;",
serverAddress[0], serverAddress[1]
)
SQL_ThreadQuery(g_tuple, "handle_GetServerID", g_query)
}
public handle_GetServerID(failstate, Handle: query, error[], errnum, data[], size, Float: queuetime) {
if(IsSQLQueryFailed(failstate, query, error, errnum)) {
return
}
new bool: found = bool: (SQL_NumResults(query) != 0)
new net_address[64]; get_cvar_string("net_address", net_address, charsmax(net_address))
if(!found) {
set_fail_state("Server `%s` not found on db.", net_address)
return;
}
g_serverID = SQL_ReadResult(query, 0)
CA_Log(logLevel_Debug, "Found server `%s` in db. ServerID=%i", net_address, g_serverID)
g_storageInitialized = true
ExecuteForward(g_fwd_StorageInitialized, g_ret)
for(new i, len = QueueSize(g_queueLoad); i < len; i++) {
new authID[MAX_AUTHID_LENGTH]; QueuePopString(g_queueLoad, authID, charsmax(authID))
Storage_Load(authID)
}
}
enum {
GCMS_FLAG_NONE = -1,
GCMS_FLAG_ALL,
GCMS_FLAG_CHAT,
GCMS_FLAG_VOICE
}
static stock gag_flags_s: GCMS_FlagsTo_CAGAGFlags(const flag) {
switch(flag) {
case GCMS_FLAG_NONE: return (gagFlag_Removed);
case GCMS_FLAG_ALL: return (gagFlag_Say | gagFlag_SayTeam | gagFlag_Voice);
case GCMS_FLAG_CHAT: return (gagFlag_Say | gagFlag_SayTeam);
case GCMS_FLAG_VOICE: return (gagFlag_Voice);
}
CA_Log(logLevel_Warning, "[WARN]: GCMS_FlagsTo_CAGAGFlags() => Undefinded flag:%i", flag)
return gagFlag_Removed;
}
static stock CAGAGFlags_to_GCMS_Flags(const gag_flags_s: flags) {
if((flags & gagFlag_Voice) == gagFlag_Voice) {
return GCMS_FLAG_VOICE;
}
if((flags & (gagFlag_Say | gagFlag_SayTeam | gagFlag_Voice)) == (gagFlag_Say | gagFlag_SayTeam | gagFlag_Voice)) {
return GCMS_FLAG_ALL;
}
if(flags & (gagFlag_Say | gagFlag_SayTeam)) {
return GCMS_FLAG_CHAT;
}
return GCMS_FLAG_NONE;
}
что не так ?
В этой теме было размещено решение! Перейти к решению.