From e2c992061651c844a7e6f174dc5dc4e12c84cf08 Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 1 Mar 2026 15:54:33 +0100 Subject: [PATCH] remade the static 5000 number into a cvar quickly --- .../scripting/unloze_player_time.sp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/discord_verificiation/scripting/unloze_player_time.sp b/discord_verificiation/scripting/unloze_player_time.sp index 3350268..d5ff493 100644 --- a/discord_verificiation/scripting/unloze_player_time.sp +++ b/discord_verificiation/scripting/unloze_player_time.sp @@ -16,6 +16,7 @@ int g_iPlayerTimeServer[MAXPLAYERS + 1]; int g_iPlayerAFKTime; int g_iPlayerCount_excludeSpec; int g_iPlayerRTVCapacity; +int g_iAvgHour_Contribution_per_player; static Handle g_hForwardPlayerHours; @@ -100,6 +101,11 @@ public void OnPluginStart() HookConVarChange((cvar2 = CreateConVar("sm_rtv_avg_capacity", "5", "The capacity for how many times the average a players rtv can be worth.")), Cvar_playerRTVAverageCap); g_iPlayerRTVCapacity = cvar2.IntValue; delete cvar2; + + ConVar cvar3; + HookConVarChange((cvar3 = CreateConVar("sm_avg_hour_contribution_per_player", "5000", "How many hours maximum each player can contribute to averagehours")), Cvar_AverageHourContribution); + g_iAvgHour_Contribution_per_player = cvar3.IntValue; + delete cvar3; } public Action UpdateForward(Handle timer) @@ -129,6 +135,11 @@ public void Cvar_playerRTVAverageCap(ConVar convar, const char[] oldValue, const g_iPlayerRTVCapacity = convar.IntValue; } +public void Cvar_AverageHourContribution(ConVar convar, const char[] oldValue, const char[] newValue) +{ + g_iAvgHour_Contribution_per_player = convar.IntValue; +} + public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_max) { CreateNative("GetAveragePlayerTimeOnServer", Native_GetAveragePlayerActiveTimeServer); @@ -165,7 +176,7 @@ public int GetAveragePlayerActiveTimeServer() //re-introducing the hour capacity but putting it here is better than putting it at the mysql query //at the time of making this change its only affeting me jenz and nobody else. this is meant to prevent //the average hour from being too skewed by high playtime people. - int added_hours = g_iPlayerTimeServer[i] > 5000 ? 5000 : g_iPlayerTimeServer[i]; + int added_hours = g_iPlayerTimeServer[i] > g_iAvgHour_Contribution_per_player ? g_iAvgHour_Contribution_per_player : g_iPlayerTimeServer[i]; total_hours += added_hours; total_players++; } @@ -320,14 +331,6 @@ public void SQL_OnQueryCompletedTimeServer(Database db, DBResultSet results, con delete results; int iHours_Server = (iTime_Server / 60) / 60; int iMinutes_Server = (iTime_Server / 60) % 60; - //just a hardcap, maybe it will be adapted somewhen in the future - //2026, i am removing the hardcap so it wont interfere with play time based restrictions. - /* - if (iHours_Server > 5000) - { - iHours_Server = 5000; - } - */ g_iPlayerTimeServer[client] = iHours_Server; Call_StartForward(g_hForwardPlayerHours);