expanded from top 100 to top 1000, also added time tracking for ze2. does probably not damage to add

This commit is contained in:
jenz 2024-05-06 18:49:02 +02:00
parent 9fb583385e
commit 48e50398ce

View File

@ -11,7 +11,7 @@ Database g_hDatabase;
bool is_bot_player[MAXPLAYERS + 1];
Handle g_h_time_activity = null;
char g_csSID[MAXPLAYERS + 1][65];
char g_cTimeRecords[100][128];
char g_cTimeRecords[1000][128];
int g_iPlayerTimeServer[MAXPLAYERS + 1];
int g_iPlayerAFKTime;
int g_iPlayerCount_excludeSpec;
@ -39,7 +39,7 @@ public Action time_query_activity(Handle timer, any data)
}
char sServer[64];
int i_port = GetConVarInt(FindConVar("hostport"));
if (i_port == 27015)
if (i_port == 27015 || i_port == 27035) //might as well count play time on ze2. it was not done before but its a bit like why not anyways.
{
Format(sServer, sizeof(sServer), "ze_time");
}
@ -108,22 +108,6 @@ public void OnPluginStart()
delete cvar2;
}
/*
public Action log_average_hour_count(Handle timer, any data)
{
int i_port = GetConVarInt(FindConVar("hostport"));
int avg_hour = GetAveragePlayerActiveTimeServer();
if (!g_hDatabase)
{
return Plugin_Handled;
}
char sQuery[512];
Format(sQuery, sizeof(sQuery), "INSERT INTO `average_hours` (`avg_hour`, `server_port`) VALUES ('%i', '%i')", avg_hour, i_port);
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
return Plugin_Continue;
}
*/
public void Cvar_playerAFKTime(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_iPlayerAFKTime = convar.IntValue;
@ -434,7 +418,7 @@ public void OnMapStart()
char sServer[32];
int i_port = GetConVarInt(FindConVar("hostport"));
if (i_port == 27015 || i_port == 27019)
if (i_port == 27015 || i_port == 27019 || i_port == 27035)
{
Format(sServer, sizeof(sServer), "ze_time");
}
@ -454,7 +438,7 @@ public void OnMapStart()
{
return;
}
Format(sQuery, sizeof(sQuery), "select player_name, sum(%s) as %s_total from unloze_playtimestats.player_time GROUP BY steam_id order by %s_total desc limit 100", sServer, sServer, sServer);
Format(sQuery, sizeof(sQuery), "select player_name, sum(%s) as %s_total from unloze_playtimestats.player_time GROUP BY steam_id order by %s_total desc limit 1000", sServer, sServer, sServer);
g_hDatabase.Query(SQL_OnQueryCompletedTopTime, sQuery);
}
@ -463,7 +447,7 @@ public Action Command_TopTime(int client, int args)
char sTitle[64];
char sServer[32];
int i_port = GetConVarInt(FindConVar("hostport"));
if (i_port == 27015 || i_port == 27019)
if (i_port == 27015 || i_port == 27019 || i_port == 27035)
{
Format(sServer, sizeof(sServer), "ZE");
}
@ -479,7 +463,7 @@ public Action Command_TopTime(int client, int args)
{
Format(sServer, sizeof(sServer), "JB");
}
Format(sTitle, sizeof(sTitle), "[UNLOZE Playtime] Top 100 Record Holders for %s:", sServer);
Format(sTitle, sizeof(sTitle), "[UNLOZE Playtime] Top 1000 Record Holders for %s:", sServer);
Menu menu = new Menu(MenuHandler1);
menu.SetTitle(sTitle);
for (int i = 0; i < sizeof(g_cTimeRecords); i++)