diff --git a/discord_verificiation/scripting/unloze_player_time.sp b/discord_verificiation/scripting/unloze_player_time.sp index ebcc1d2..c853d86 100644 --- a/discord_verificiation/scripting/unloze_player_time.sp +++ b/discord_verificiation/scripting/unloze_player_time.sp @@ -28,8 +28,6 @@ public Plugin myinfo = url = "www.unloze.com" }; -//timer -Handle g_hTimer_avg_hour_count = null; public Action time_query_activity(Handle timer, any data) { @@ -86,6 +84,7 @@ public void OnPluginStart() RegConsoleCmd("sm_topplaytime", Command_TopTime, "retreives top 1000 playtime highscores on all connected servers"); g_h_time_activity = CreateTimer(10.0, time_query_activity, INVALID_HANDLE, TIMER_REPEAT); + CreateTimer(600.0, UpdateForward, _, TIMER_REPEAT); ConVar cvar; HookConVarChange((cvar = CreateConVar("sm_mapchooser_afk_detect_time", "120", "Time in seconds until a player is considered as AFK and therefore excluded from player average time.")), Cvar_playerAFKTime); @@ -96,7 +95,6 @@ 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); ConVar cvar2; HookConVarChange((cvar2 = CreateConVar("sm_rtv_avg_capacity", "5", "The capacity for how many times the average a players rtv can be worth.")), Cvar_playerRTVAverageCap); @@ -104,6 +102,18 @@ public void OnPluginStart() delete cvar2; } +public Action UpdateForward(Handle timer) +{ + for (int i = 0; i < MaxClients; i++) + { + if (IsValidClient(i) && !IsFakeClient(i) && !IsClientSourceTV(i) && !is_bot_player[i]) + { + select_client_time_server(i); + } + } + return Plugin_Handled; +} + public void Cvar_playerAFKTime(ConVar convar, const char[] oldValue, const char[] newValue) { g_iPlayerAFKTime = convar.IntValue; @@ -124,8 +134,6 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_ma CreateNative("GetAveragePlayerTimeOnServer", Native_GetAveragePlayerActiveTimeServer); CreateNative("GetPlayerWorthRTV_boost_", Native_GetPlayerWorthRTV_boost); - //return g_iPlayerTimeServer[client]; - g_hForwardPlayerHours = CreateGlobalForward("GetPlayerHoursServer", ET_Ignore, Param_Cell, Param_Cell); return APLRes_Success; } @@ -205,10 +213,6 @@ public void OnPluginEnd() { if (g_h_time_activity != null) delete g_h_time_activity; - if (g_hTimer_avg_hour_count != null) - { - delete g_hTimer_avg_hour_count; - } CloseHandle(g_hForwardPlayerHours); } @@ -311,10 +315,13 @@ public void SQL_OnQueryCompletedTimeServer(Database db, DBResultSet results, con delete results; int iHours_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);