From a96ca3a15f2616cffcb53f8c24f1f87307939ee1 Mon Sep 17 00:00:00 2001 From: Dogan Date: Wed, 10 Jul 2019 23:15:23 +0200 Subject: [PATCH] ConnectAnnounceNewPlayers: improve code --- ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp b/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp index 36bd258d..36c51ad2 100644 --- a/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp +++ b/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp @@ -148,8 +148,6 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] if ((client = GetClientFromSerial(data)) == 0) return; - int clientid = GetClientSerial(client); - char sAuthID[32]; GetClientAuthId(client, AuthId_Steam2, sAuthID, sizeof(sAuthID)); @@ -167,7 +165,7 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] g_bNewPlayer[client] = true; g_bNewPlayerChatBlock[client] = true; NewPlayerMessage(client); - CreateTimer(10.0, BlockChat, clientid, TIMER_FLAG_NO_MAPCHANGE); + CreateTimer(10.0, BlockChat, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE); char sQuery[512]; Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth) VALUES ('%s')" , sAuthID); @@ -203,8 +201,7 @@ public void OnClientDisconnect(int client) public Action BlockChat(Handle timer, int clientid) { - int client = -1; - if ((client = GetClientFromSerial(clientid)) == -1) + if ((client = GetClientFromSerial(clientid)) == 0) return; g_bNewPlayerChatBlock[client] = false;