properly implemented session mutes
This commit is contained in:
parent
f632418de8
commit
fc9df5f1bc
@ -42,10 +42,12 @@
|
|||||||
// Do not edit below this line //
|
// Do not edit below this line //
|
||||||
//-----------------------------//
|
//-----------------------------//
|
||||||
|
|
||||||
#define PLUGIN_VERSION "(SB++) 1.5.5"
|
#define PLUGIN_VERSION "(SB++) 1.5.6"
|
||||||
#define PREFIX "\x04[SourceComms]\x01 "
|
#define PREFIX "\x04[SourceComms]\x01 "
|
||||||
|
|
||||||
#define MAX_TIME_MULTI 30 // maximum mass-target punishment length
|
#define MAX_TIME_MULTI 30 // maximum mass-target punishment length
|
||||||
|
// session mute will expire after this if it hasn't already (fallback)
|
||||||
|
#define SESSION_MUTE_FALLBACK 120 * 60
|
||||||
|
|
||||||
#define NOW 0
|
#define NOW 0
|
||||||
#define TYPE_TEMP_SHIFT 10
|
#define TYPE_TEMP_SHIFT 10
|
||||||
@ -218,7 +220,7 @@ public OnPluginStart()
|
|||||||
// Catch config error
|
// Catch config error
|
||||||
if (!SQL_CheckConfig(DATABASE))
|
if (!SQL_CheckConfig(DATABASE))
|
||||||
{
|
{
|
||||||
SetFailState("Database failure: could not find database conf %s", DATABASE);
|
SetFailState("Database failure: could not find database config: %s", DATABASE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DB_Connect();
|
DB_Connect();
|
||||||
@ -246,6 +248,21 @@ public OnMapStart()
|
|||||||
|
|
||||||
public OnMapEnd()
|
public OnMapEnd()
|
||||||
{
|
{
|
||||||
|
decl String:Query[2048];
|
||||||
|
Format(Query, sizeof(Query),
|
||||||
|
"UPDATE %s_comms \
|
||||||
|
SET RemovedBy = 0, \
|
||||||
|
RemoveType = 'E', \
|
||||||
|
RemovedOn = UNIX_TIMESTAMP() \
|
||||||
|
WHERE sid = %d \
|
||||||
|
AND RemovedOn IS NULL \
|
||||||
|
AND length = -1",
|
||||||
|
DatabasePrefix, serverID);
|
||||||
|
#if defined LOG_QUERIES
|
||||||
|
LogToFile(logQuery, "OnMapEnd for: %s. QUERY: %s", clientAuth, Query);
|
||||||
|
#endif
|
||||||
|
SQL_TQuery(g_hDatabase, Query_ErrorCheck, Query);
|
||||||
|
|
||||||
// Clean up on map end just so we can start a fresh connection when we need it later.
|
// Clean up on map end just so we can start a fresh connection when we need it later.
|
||||||
// Also it is necessary for using SQL_SetCharset
|
// Also it is necessary for using SQL_SetCharset
|
||||||
if (g_hDatabase)
|
if (g_hDatabase)
|
||||||
@ -2929,10 +2946,20 @@ stock SavePunishment(admin = 0, target, type, length = -1, const String:reason[]
|
|||||||
"IFNULL((SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), 0)",
|
"IFNULL((SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$'), 0)",
|
||||||
DatabasePrefix, sAdminAuthIdEscaped, sAdminAuthIdYZEscaped);
|
DatabasePrefix, sAdminAuthIdEscaped, sAdminAuthIdYZEscaped);
|
||||||
|
|
||||||
|
if (length >= 0)
|
||||||
|
{
|
||||||
// authid name, created, ends, length, reason, aid, adminIp, sid
|
// authid name, created, ends, length, reason, aid, adminIp, sid
|
||||||
FormatEx(sQueryVal, sizeof(sQueryVal),
|
FormatEx(sQueryVal, sizeof(sQueryVal),
|
||||||
"'%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + %d, %d, '%s', %s, '%s', %d",
|
"'%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + %d, %d, '%s', %s, '%s', %d",
|
||||||
sAuthidEscaped, banName, length * 60, length * 60, banReason, sQueryAdm, adminIp, serverID);
|
sAuthidEscaped, banName, length * 60, length * 60, banReason, sQueryAdm, adminIp, serverID);
|
||||||
|
}
|
||||||
|
else // Session mutes
|
||||||
|
{
|
||||||
|
// authid name, created, ends, length, reason, aid, adminIp, sid
|
||||||
|
FormatEx(sQueryVal, sizeof(sQueryVal),
|
||||||
|
"'%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + %d, %d, '%s', %s, '%s', %d",
|
||||||
|
sAuthidEscaped, banName, SESSION_MUTE_FALLBACK, -1, banReason, sQueryAdm, adminIp, serverID);
|
||||||
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user