actually just removing timer to instead calling on postadminforward and disconnect. but also fixing warnings and just shifting indentation around
This commit is contained in:
parent
89cfffe410
commit
be2c2797ab
@ -159,7 +159,6 @@ public void OnPluginStart()
|
||||
AutoExecConfig(true, "plugin.SprayManager");
|
||||
|
||||
g_hTraceTimer = CreateTimer(0.25, Timer_PerformPlayerTraces, _, TIMER_REPEAT);
|
||||
g_hHideSpray = CreateTimer(4.0, Timer_UpdateHideSprays, _, TIMER_REPEAT);
|
||||
|
||||
if (g_bLoadedLate)
|
||||
{
|
||||
@ -328,6 +327,7 @@ public void OnClientPostAdminCheck(int client)
|
||||
}
|
||||
}
|
||||
update_client_online(client, 1);
|
||||
UpdateHideSprays();
|
||||
}
|
||||
|
||||
public void update_client_online(int client, int is_online)
|
||||
@ -365,6 +365,7 @@ public void OnClientDisconnect(int client)
|
||||
}
|
||||
|
||||
ClearPlayerInfo(client);
|
||||
UpdateHideSprays();
|
||||
}
|
||||
|
||||
public Action CS_OnTerminateRound(float &fDelay, CSRoundEndReason &reason)
|
||||
@ -599,6 +600,7 @@ int MenuHandler_Menu_ListBans(Menu hMenu, MenuAction action, int iParam1, int iP
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Menu_Trace(int client, int target)
|
||||
@ -727,6 +729,7 @@ int MenuHandler_Menu_Trace(Menu hMenu, MenuAction action, int iParam1, int iPara
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MenuHandler_Menu_Trace_SprayBan(Menu hMenu, MenuAction action, int iParam1, int iParam2)
|
||||
@ -789,6 +792,7 @@ int MenuHandler_Menu_Trace_SprayBan(Menu hMenu, MenuAction action, int iParam1,
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MenuHandler_Menu_Trace_Ban(Menu hMenu, MenuAction action, int iParam1, int iParam2)
|
||||
@ -846,6 +850,7 @@ int MenuHandler_Menu_Trace_Ban(Menu hMenu, MenuAction action, int iParam1, int i
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Menu_Spray(int client)
|
||||
@ -937,8 +942,11 @@ int MenuHandler_Menu_Spray(Menu hMenu, MenuAction action, int iParam1, int iPara
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//'
|
||||
|
||||
void Menu_SprayBan(int client)
|
||||
{
|
||||
if (!IsValidClient(client))
|
||||
@ -1024,6 +1032,7 @@ int MenuHandler_Menu_SprayBan(Menu hMenu, MenuAction action, int iParam1, int iP
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MenuHandler_Menu_SprayBan_Length(Menu hMenu, MenuAction action, int iParam1, int iParam2)
|
||||
@ -1066,6 +1075,7 @@ int MenuHandler_Menu_SprayBan_Length(Menu hMenu, MenuAction action, int iParam1,
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Menu_BanSpray(int client)
|
||||
@ -1140,6 +1150,7 @@ int MenuHandler_Menu_BanSpray(Menu hMenu, MenuAction action, int iParam1, int iP
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Menu_Unban(int client)
|
||||
@ -1211,6 +1222,7 @@ int MenuHandler_Menu_UnbanSpray(Menu hMenu, MenuAction action, int iParam1, int
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Menu_ListBans_Target(int client, int target)
|
||||
@ -1327,7 +1339,7 @@ int MenuHandler_Menu_ListBans_Target(Menu hMenu, MenuAction action, int iParam1,
|
||||
|
||||
MenuUnbanMode.Display(iParam1, MENU_TIME_FOREVER);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Menu MenuConfirmUnban = new Menu(MenuHandler_Menu_ConfirmUnban);
|
||||
@ -1343,6 +1355,7 @@ int MenuHandler_Menu_ListBans_Target(Menu hMenu, MenuAction action, int iParam1,
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MenuHandler_Menu_UnbanMode(Menu hMenu, MenuAction action, int iParam1, int iParam2)
|
||||
@ -1414,6 +1427,7 @@ int MenuHandler_Menu_UnbanMode(Menu hMenu, MenuAction action, int iParam1, int i
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MenuHandler_Menu_ConfirmUnban(Menu hMenu, MenuAction action, int iParam1, int iParam2)
|
||||
@ -1493,6 +1507,7 @@ int MenuHandler_Menu_ConfirmUnban(Menu hMenu, MenuAction action, int iParam1, in
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Action Command_MarkNSFW(int client, int argc)
|
||||
@ -2175,6 +2190,7 @@ public Action Command_SprayManager_UpdateInfo(int client, int argc)
|
||||
}
|
||||
|
||||
ReplyToCommand(client, "[SprayManager] Refreshed database.");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public bool isGoodSpray(int client)
|
||||
@ -2354,11 +2370,11 @@ public Action HookSprayer(int iClients[MAXPLAYERS], int &iNumClients, char sSoun
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action Timer_UpdateHideSprays(Handle hTimer)
|
||||
public void UpdateHideSprays()
|
||||
{
|
||||
if (!g_hDatabase)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
return;
|
||||
}
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
@ -2374,7 +2390,6 @@ public Action Timer_UpdateHideSprays(Handle hTimer)
|
||||
Format(sQuery, sizeof(sQuery), "SELECT `steamidtarget` FROM `sprayhidemanage` WHERE `steamidhider` = '%s' and `is_online` = 1;", g_csSID[client]);
|
||||
SQL_TQuery(g_hDatabase, select_sprays_to_hide, sQuery, GetClientSerial(client), DBPrio_Normal);
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Timer_PerformPlayerTraces(Handle hTimer)
|
||||
@ -2424,6 +2439,7 @@ public Action Timer_PerformPlayerTraces(Handle hTimer)
|
||||
bOnce[i] = true;
|
||||
}
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Timer_ProcessPersistentSprays(Handle hThis)
|
||||
@ -2466,6 +2482,7 @@ public Action Timer_ProcessPersistentSprays(Handle hThis)
|
||||
}
|
||||
|
||||
g_hRoundEndTimer = null;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Timer_ResetOldSprays(Handle hThis)
|
||||
@ -2504,6 +2521,7 @@ public Action Timer_ResetOldSprays(Handle hThis)
|
||||
}
|
||||
|
||||
g_hRoundEndTimer = null;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
void InitializeSQL()
|
||||
@ -2597,6 +2615,7 @@ public Action RetryMainTableCreation(Handle hTimer)
|
||||
SQL_TQuery(g_hDatabase, OnSQLTableCreated, "CREATE TABLE IF NOT EXISTS `spraymanager` (`steamid` TEXT NOT NULL, `name` TEXT DEFAULT 'unknown', `unbantime` INTEGER, `issuersteamid` TEXT, `issuername` TEXT DEFAULT 'unknown', `issuedtime` INTEGER NOT NULL, `issuedreason` TEXT DEFAULT 'none', PRIMARY KEY(steamid));");
|
||||
else
|
||||
SQL_TQuery(g_hDatabase, OnSQLTableCreated, "CREATE TABLE IF NOT EXISTS `spraymanager` (`steamid` VARCHAR(32) NOT NULL, `name` VARCHAR(32) NOT NULL, `unbantime` INT, `issuersteamid` VARCHAR(32), `issuername` VARCHAR(32) NOT NULL, `issuedtime` INT, `issuedreason` VARCHAR(64) NOT NULL, PRIMARY KEY(steamid)) CHARACTER SET utf8 COLLATE utf8_general_ci;");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void OnSQLSprayBlacklistCreated(Handle hParent, Handle hChild, const char[] err, any data)
|
||||
@ -2628,6 +2647,7 @@ public Action RetryBlacklistTableCreation(Handle hTimer)
|
||||
SQL_TQuery(g_hDatabase, OnSQLSprayBlacklistCreated, "CREATE TABLE IF NOT EXISTS `sprayblacklist` (`sprayhash` TEXT NOT NULL, `sprayer` TEXT DEFAULT 'unknown', `sprayersteamid` TEXT NOT NULL, PRIMARY KEY(sprayhash));");
|
||||
else
|
||||
SQL_TQuery(g_hDatabase, OnSQLSprayBlacklistCreated, "CREATE TABLE IF NOT EXISTS `sprayblacklist` (`sprayhash` VARCHAR(16) NOT NULL, `sprayer` VARCHAR(32) NOT NULL, `sprayersteamid` VARCHAR(32) NOT NULL, PRIMARY KEY(sprayhash)) CHARACTER SET utf8 COLLATE utf8_general_ci;");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void OnSQLNSFWListCreated(Handle hParent, Handle hChild, const char[] err, any data)
|
||||
@ -2659,6 +2679,7 @@ public Action RetryNSFWlistTableCreation(Handle hTimer)
|
||||
SQL_TQuery(g_hDatabase, OnSQLNSFWListCreated, "CREATE TABLE IF NOT EXISTS `spraynsfwlist` (`sprayhash` TEXT NOT NULL, `sprayersteamid` TEXT, `setbyadmin` INTEGER, PRIMARY KEY(sprayhash));");
|
||||
else
|
||||
SQL_TQuery(g_hDatabase, OnSQLNSFWListCreated, "CREATE TABLE IF NOT EXISTS `spraynsfwlist` (`sprayhash` VARCHAR(16) NOT NULL, `sprayersteamid` VARCHAR(32), `setbyadmin` TINYINT PRIMARY KEY(sprayhash)) CHARACTER SET utf8 COLLATE utf8_general_ci");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action RetryUpdatingPlayerInfo(Handle hTimer)
|
||||
@ -2670,6 +2691,7 @@ public Action RetryUpdatingPlayerInfo(Handle hTimer)
|
||||
|
||||
OnClientPostAdminCheck(i);
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void ConVarChanged_DecalFrequency(ConVar cvar, const char[] sOldValue, const char[] sNewValue)
|
||||
@ -3075,9 +3097,10 @@ public Action RetryPlayerInfoUpdate(Handle hTimer, int Serial)
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||
{
|
||||
return;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
UpdatePlayerInfo(client);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action RetrySprayHashUpdate(Handle hTimer, int Serial)
|
||||
@ -3085,9 +3108,10 @@ public Action RetrySprayHashUpdate(Handle hTimer, int Serial)
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||
{
|
||||
return;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
UpdateSprayHashInfo(client);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action RetryNSFWSprayLookup(Handle hTimer, int Serial)
|
||||
@ -3095,9 +3119,10 @@ public Action RetryNSFWSprayLookup(Handle hTimer, int Serial)
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||
{
|
||||
return;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
UpdateNSFWInfo(client);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
stock bool ForceSpray(int client, int target, bool bPlaySound=true)
|
||||
|
Loading…
Reference in New Issue
Block a user