diff --git a/discord_verificiation/scripting/unloze_player_time.sp b/discord_verificiation/scripting/unloze_player_time.sp index 38403e7c..50918c5e 100644 --- a/discord_verificiation/scripting/unloze_player_time.sp +++ b/discord_verificiation/scripting/unloze_player_time.sp @@ -34,7 +34,30 @@ public Action time_query_activity(Handle timer, any data) Database.Connect(SQL_OnDatabaseConnect, "unloze_playtimestats"); return Plugin_Continue; } + char sServer[64]; + int i_port = GetConVarInt(FindConVar("hostport")); + if (i_port == 27015) + { + 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 Plugin_Continue; + } for (int client = 1; client <= MaxClients; client++) + { if (IsValidClient(client) && !IsFakeClient(client) && IsPlayerAlive(client)) { char sAuthID[32]; @@ -42,28 +65,6 @@ public Action time_query_activity(Handle timer, any data) char sIP[32]; GetClientIP(client, sIP, sizeof(sIP)); char sQuery[512]; - char sServer[64]; - int i_port = GetConVarInt(FindConVar("hostport")); - if (i_port == 27015) - { - 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 - { - continue; - } char sName[MAX_NAME_LENGTH]; GetClientName(client, sName, sizeof(sName)); int size2 = 2 * strlen(sName) + 1; @@ -71,10 +72,10 @@ public Action time_query_activity(Handle timer, any data) 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); 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); + Format(sQuery, sizeof(sQuery), "update unloze_playtimestats.player_time set player_name = '%s' where steam_id = '%s' and player_name != '%s'", sEscapedName, sAuthID, sEscapedName); g_hDatabase.Query(SQL_FinishedQuery, sQuery, _, DBPrio_Low); } - + } return Plugin_Continue; }