yoshmi pointed out that names were not always up to date in the top 100 command
This commit is contained in:
parent
f3cccbc7fc
commit
a0c253c980
@ -64,8 +64,9 @@ public Action time_query_activity(Handle timer, any data)
|
|||||||
int size2 = 2 * strlen(sName) + 1;
|
int size2 = 2 * strlen(sName) + 1;
|
||||||
char[] sEscapedName = new char[size2 + 1];
|
char[] sEscapedName = new char[size2 + 1];
|
||||||
g_hDatabase.Escape(sName, sEscapedName, 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);
|
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.player_time set `%s` = `%s` + 10 where steam_id = '%s' and ipv4 = '%s'", sServer, sServer, sAuthID, sIP);
|
||||||
//LogError("sQuery: %s", sQuery);
|
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);
|
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)
|
public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] error, any data)
|
||||||
{
|
{
|
||||||
if (!db || strlen(error))
|
if (!db || strlen(error))
|
||||||
{
|
{
|
||||||
LogError("Query error 3: %s", error);
|
LogError("Query error 3: %s", error);
|
||||||
}
|
}
|
||||||
delete results;
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock bool IsValidClient(int client)
|
stock bool IsValidClient(int client)
|
||||||
{
|
{
|
||||||
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
|
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
if (!g_hDatabase)
|
if (!g_hDatabase)
|
||||||
{
|
{
|
||||||
Database.Connect(SQL_OnDatabaseConnect, "unloze_playtimestats");
|
Database.Connect(SQL_OnDatabaseConnect, "unloze_playtimestats");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
char sServer[32];
|
char sServer[32];
|
||||||
|
|
||||||
int i_port = GetConVarInt(FindConVar("hostport"));
|
int i_port = GetConVarInt(FindConVar("hostport"));
|
||||||
if (i_port == 27015 || i_port == 27019)
|
if (i_port == 27015 || i_port == 27019)
|
||||||
{
|
{
|
||||||
Format(sServer, sizeof(sServer), "ze_time");
|
Format(sServer, sizeof(sServer), "ze_time");
|
||||||
}
|
}
|
||||||
else if (i_port == 27016)
|
else if (i_port == 27016)
|
||||||
{
|
{
|
||||||
Format(sServer, sizeof(sServer), "zr_time");
|
Format(sServer, sizeof(sServer), "zr_time");
|
||||||
}
|
}
|
||||||
else if (i_port == 27017)
|
else if (i_port == 27017)
|
||||||
{
|
{
|
||||||
Format(sServer, sizeof(sServer), "mg_time");
|
Format(sServer, sizeof(sServer), "mg_time");
|
||||||
}
|
}
|
||||||
else if (i_port == 27023)
|
else if (i_port == 27023)
|
||||||
{
|
{
|
||||||
Format(sServer, sizeof(sServer), "jb_time");
|
Format(sServer, sizeof(sServer), "jb_time");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
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 100", sServer, sServer, sServer);
|
||||||
g_hDatabase.Query(SQL_OnQueryCompletedTopTime, sQuery);
|
g_hDatabase.Query(SQL_OnQueryCompletedTopTime, sQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Command_TopTime(int client, int args)
|
public Action Command_TopTime(int client, int args)
|
||||||
|
Loading…
Reference in New Issue
Block a user