yoshmi pointed out that names were not always up to date in the top 100 command

This commit is contained in:
jenz 2023-04-16 19:45:10 +02:00
parent f3cccbc7fc
commit a0c253c980

View File

@ -64,8 +64,9 @@ public Action time_query_activity(Handle timer, any data)
int size2 = 2 * strlen(sName) + 1;
char[] sEscapedName = new char[size2 + 1];
g_hDatabase.Escape(sName, sEscapedName, size2 + 1);
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.player_time set `%s` = `%s` + 10, player_name = '%s' where steam_id = '%s' and ipv4 = '%s'", sServer, sServer, sEscapedName, sAuthID, sIP);
//LogError("sQuery: %s", sQuery);
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.player_time set `%s` = `%s` + 10 where steam_id = '%s' and ipv4 = '%s'", sServer, sServer, sAuthID, sIP);
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.player_time set player_name = '%s' where steam_id = '%s'", sEscapedName, sAuthID);
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
}
@ -244,53 +245,53 @@ public void insert_client(int client)
public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] error, any data)
{
if (!db || strlen(error))
{
LogError("Query error 3: %s", error);
}
delete results;
if (!db || strlen(error))
{
LogError("Query error 3: %s", error);
}
delete results;
}
stock bool IsValidClient(int client)
{
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
return true;
return false;
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
return true;
return false;
}
public void OnMapStart()
{
if (!g_hDatabase)
{
Database.Connect(SQL_OnDatabaseConnect, "unloze_playtimestats");
return;
}
char sQuery[512];
char sServer[32];
if (!g_hDatabase)
{
Database.Connect(SQL_OnDatabaseConnect, "unloze_playtimestats");
return;
}
char sQuery[512];
char sServer[32];
int i_port = GetConVarInt(FindConVar("hostport"));
if (i_port == 27015 || i_port == 27019)
{
Format(sServer, sizeof(sServer), "ze_time");
}
else if (i_port == 27016)
{
Format(sServer, sizeof(sServer), "zr_time");
}
else if (i_port == 27017)
{
Format(sServer, sizeof(sServer), "mg_time");
}
else if (i_port == 27023)
{
Format(sServer, sizeof(sServer), "jb_time");
}
else
{
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);
g_hDatabase.Query(SQL_OnQueryCompletedTopTime, sQuery);
int i_port = GetConVarInt(FindConVar("hostport"));
if (i_port == 27015 || i_port == 27019)
{
Format(sServer, sizeof(sServer), "ze_time");
}
else if (i_port == 27016)
{
Format(sServer, sizeof(sServer), "zr_time");
}
else if (i_port == 27017)
{
Format(sServer, sizeof(sServer), "mg_time");
}
else if (i_port == 27023)
{
Format(sServer, sizeof(sServer), "jb_time");
}
else
{
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);
g_hDatabase.Query(SQL_OnQueryCompletedTopTime, sQuery);
}
public Action Command_TopTime(int client, int args)