remade the static 5000 number into a cvar quickly
This commit is contained in:
parent
3765d1b008
commit
e2c9920616
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user