redid getclientauthid to only on connect
This commit is contained in:
parent
cfef039db5
commit
a88daaf583
@ -10,6 +10,7 @@ Database g_hDatabase;
|
|||||||
//check if autismbot
|
//check if autismbot
|
||||||
bool is_bot_player[MAXPLAYERS + 1];
|
bool is_bot_player[MAXPLAYERS + 1];
|
||||||
Handle g_h_time_activity = null;
|
Handle g_h_time_activity = null;
|
||||||
|
char g_csSID[MAXPLAYERS + 1][65];
|
||||||
char g_cTimeRecords[100][128];
|
char g_cTimeRecords[100][128];
|
||||||
int g_iPlayerTimeServer[MAXPLAYERS + 1];
|
int g_iPlayerTimeServer[MAXPLAYERS + 1];
|
||||||
int g_iPlayerAFKTime;
|
int g_iPlayerAFKTime;
|
||||||
@ -59,8 +60,6 @@ public Action time_query_activity(Handle timer, any data)
|
|||||||
{
|
{
|
||||||
if (IsValidClient(client) && !IsFakeClient(client) && IsPlayerAlive(client))
|
if (IsValidClient(client) && !IsFakeClient(client) && IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
char sAuthID[32];
|
|
||||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
|
||||||
char sIP[32];
|
char sIP[32];
|
||||||
GetClientIP(client, sIP, sizeof(sIP));
|
GetClientIP(client, sIP, sizeof(sIP));
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
@ -69,9 +68,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 where steam_id = '%s' and ipv4 = '%s'", sServer, sServer, sAuthID, sIP);
|
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.player_time set `%s` = `%s` + 10 where steam_id = '%s' and ipv4 = '%s'", sServer, sServer, g_csSID[client], sIP);
|
||||||
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
|
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' and player_name != '%s'", sEscapedName, sAuthID, sEscapedName);
|
Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.player_time set player_name = '%s' where steam_id = '%s' and player_name != '%s'", sEscapedName, g_csSID[client], sEscapedName);
|
||||||
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
|
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,6 +192,7 @@ public void SQL_OnDatabaseConnect(Database db, const char[] error, any data)
|
|||||||
|
|
||||||
public void OnClientPostAdminCheck(int client)
|
public void OnClientPostAdminCheck(int client)
|
||||||
{
|
{
|
||||||
|
GetClientAuthId(client, AuthId_Steam2, g_csSID[client], sizeof(g_csSID[]));
|
||||||
is_bot_player[client] = false;
|
is_bot_player[client] = false;
|
||||||
g_iPlayerTimeServer[client] = 0;
|
g_iPlayerTimeServer[client] = 0;
|
||||||
if(!IsValidClient(client) || IsFakeClient(client))
|
if(!IsValidClient(client) || IsFakeClient(client))
|
||||||
@ -204,21 +204,19 @@ public void OnClientPostAdminCheck(int client)
|
|||||||
insert_client(client);
|
insert_client(client);
|
||||||
select_client_time_server(client);
|
select_client_time_server(client);
|
||||||
|
|
||||||
char auth[50];
|
if (StrEqual("[U:1:1221121532]", g_csSID[client], false) || StrEqual("STEAM_0:0:610560766", g_csSID[client], false))
|
||||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
|
||||||
if (StrEqual("[U:1:1221121532]", auth, false) || StrEqual("STEAM_0:0:610560766", auth, false))
|
|
||||||
{
|
{
|
||||||
is_bot_player[client] = true;
|
is_bot_player[client] = true;
|
||||||
}
|
}
|
||||||
if (StrEqual("[U:1:408797742]", auth, false) || StrEqual("STEAM_0:0:204398871", auth, false))
|
if (StrEqual("[U:1:408797742]", g_csSID[client], false) || StrEqual("STEAM_0:0:204398871", g_csSID[client], false))
|
||||||
{
|
{
|
||||||
is_bot_player[client] = true;
|
is_bot_player[client] = true;
|
||||||
}
|
}
|
||||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
if (StrEqual("[U:1:1036189204]", g_csSID[client], false) || StrEqual("STEAM_0:0:518094602", g_csSID[client], false))
|
||||||
{
|
{
|
||||||
is_bot_player[client] = true;
|
is_bot_player[client] = true;
|
||||||
}
|
}
|
||||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
if (StrEqual("[U:1:120378081]", g_csSID[client], false) || StrEqual("STEAM_0:1:60189040", g_csSID[client], false))
|
||||||
{
|
{
|
||||||
is_bot_player[client] = true;
|
is_bot_player[client] = true;
|
||||||
}
|
}
|
||||||
@ -249,9 +247,7 @@ public void select_client_time_server(int client)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
char sAuthID[32];
|
Format(sQuery, sizeof(sQuery), "select sum(%s) as %s_total from unloze_playtimestats.player_time pt where pt.steam_id = '%s' GROUP BY steam_id order by %s_total desc", sServer, sServer, g_csSID[client], sServer);
|
||||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
|
||||||
Format(sQuery, sizeof(sQuery), "select sum(%s) as %s_total from unloze_playtimestats.player_time pt where pt.steam_id = '%s' GROUP BY steam_id order by %s_total desc", sServer, sServer, sAuthID, sServer);
|
|
||||||
g_hDatabase.Query(SQL_OnQueryCompletedTimeServer, sQuery, GetClientSerial(client));
|
g_hDatabase.Query(SQL_OnQueryCompletedTimeServer, sQuery, GetClientSerial(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,14 +284,13 @@ public void SQL_OnQueryCompletedTimeServer(Database db, DBResultSet results, con
|
|||||||
|
|
||||||
public void OnClientDisconnect(int client)
|
public void OnClientDisconnect(int client)
|
||||||
{
|
{
|
||||||
|
Format(g_csSID[client], sizeof(g_csSID[]), "");
|
||||||
is_bot_player[client] = false;
|
is_bot_player[client] = false;
|
||||||
g_iPlayerTimeServer[client] = 0;
|
g_iPlayerTimeServer[client] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insert_client(int client)
|
public void insert_client(int client)
|
||||||
{
|
{
|
||||||
char sAuthID[32];
|
|
||||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
|
||||||
char sName[MAX_NAME_LENGTH];
|
char sName[MAX_NAME_LENGTH];
|
||||||
GetClientName(client, sName, sizeof(sName));
|
GetClientName(client, sName, sizeof(sName));
|
||||||
int size2 = 2 * strlen(sName) + 1;
|
int size2 = 2 * strlen(sName) + 1;
|
||||||
@ -304,7 +299,7 @@ public void insert_client(int client)
|
|||||||
char sIP[32];
|
char sIP[32];
|
||||||
GetClientIP(client, sIP, sizeof(sIP));
|
GetClientIP(client, sIP, sizeof(sIP));
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
Format(sQuery, sizeof(sQuery), "INSERT INTO `player_time` (`steam_id`, `ipv4`, `player_name`, `ze_time`, `mg_time`, `zr_time`, `jb_time`) VALUES ('%s', '%s', '%s', 0, 0, 0, 0) ON DUPLICATE KEY UPDATE `player_name` = '%s'", sAuthID, sIP, sEscapedName, sEscapedName);
|
Format(sQuery, sizeof(sQuery), "INSERT INTO `player_time` (`steam_id`, `ipv4`, `player_name`, `ze_time`, `mg_time`, `zr_time`, `jb_time`) VALUES ('%s', '%s', '%s', 0, 0, 0, 0) ON DUPLICATE KEY UPDATE `player_name` = '%s'", g_csSID[client], sIP, sEscapedName, sEscapedName);
|
||||||
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
|
g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,9 +393,7 @@ public Action Command_Time(int client, int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
char sQuery[512];
|
char sQuery[512];
|
||||||
char sAuthID[32];
|
Format(sQuery, sizeof(sQuery), "select ze_time, mg_time, zr_time, jb_time from unloze_playtimestats.player_time pt where pt.steam_id = '%s'", g_csSID[client]);
|
||||||
GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID), false);
|
|
||||||
Format(sQuery, sizeof(sQuery), "select ze_time, mg_time, zr_time, jb_time from unloze_playtimestats.player_time pt where pt.steam_id = '%s'", sAuthID);
|
|
||||||
g_hDatabase.Query(SQL_OnQueryCompletedTime, sQuery, GetClientSerial(client));
|
g_hDatabase.Query(SQL_OnQueryCompletedTime, sQuery, GetClientSerial(client));
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user