From 32e8029679802a6ef4965aa6d8af836c135ddcb2 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 2 Sep 2023 18:47:21 +0200 Subject: [PATCH] minimal update --- .../scripting/unloze_player_time.sp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/discord_verificiation/scripting/unloze_player_time.sp b/discord_verificiation/scripting/unloze_player_time.sp index a6103ed3..8a012b46 100644 --- a/discord_verificiation/scripting/unloze_player_time.sp +++ b/discord_verificiation/scripting/unloze_player_time.sp @@ -97,9 +97,10 @@ public void OnPluginStart() HookConVarChange((cvar1 = CreateConVar("sm_exclude_specs_avghour", "20", "How many players must be considered active on the server before specs are included in generating the average hour count")), Cvar_playerExcludeSpec); g_iPlayerCount_excludeSpec = cvar1.IntValue; delete cvar1; - g_hTimer_avg_hour_count = CreateTimer(1800.0, log_average_hour_count, _, TIMER_REPEAT); + //g_hTimer_avg_hour_count = CreateTimer(1800.0, log_average_hour_count, _, TIMER_REPEAT); } +/* public Action log_average_hour_count(Handle timer, any data) { int i_port = GetConVarInt(FindConVar("hostport")); @@ -113,6 +114,7 @@ public Action log_average_hour_count(Handle timer, any data) g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low); return Plugin_Continue; } +*/ public void Cvar_playerAFKTime(ConVar convar, const char[] oldValue, const char[] newValue) { @@ -134,21 +136,22 @@ public int GetAveragePlayerActiveTimeServer() { int total_hours = 0; int total_players = 0; - int spec_player_count = 0; + int active_player_count = 0; for (int i = 0; i < MaxClients; i++) { //checking player count before deciding if including or excluding spectators from actual average //the purpose of this is me (jenz) not boosting the hour average insanely when the server is very empty. (i often sit spec without playing and that ruins the generated average when low population because the count gets way too high due to me. But if i were actually playing it would instead be fine) - if (IsValidClient(i) && !IsFakeClient(i) && !IsClientSourceTV(i) && !is_bot_player[i] && PM_IsPlayerSteam(i) && GetClientIdleTime(i) < g_iPlayerAFKTime) + if (IsValidClient(i) && !IsFakeClient(i) && !IsClientSourceTV(i) && !is_bot_player[i] && PM_IsPlayerSteam(i) && GetClientIdleTime(i) < g_iPlayerAFKTime + && (GetClientTeam(i) == CS_TEAM_T || GetClientTeam(i) == CS_TEAM_CT)) { - spec_player_count++; + active_player_count++; } } for (int i = 0; i < MaxClients; i++) { if (IsValidClient(i) && !IsFakeClient(i) && !IsClientSourceTV(i) && !is_bot_player[i] && PM_IsPlayerSteam(i) && GetClientIdleTime(i) < g_iPlayerAFKTime) { - if (spec_player_count <= g_iPlayerCount_excludeSpec && GetClientTeam(i) == CS_TEAM_SPECTATOR) + if (active_player_count <= g_iPlayerCount_excludeSpec && GetClientTeam(i) == CS_TEAM_SPECTATOR) { continue; }