ConnectAnnounceNewPlayers: improve code

This commit is contained in:
Dogan 2019-07-10 23:15:23 +02:00
parent ebdba36347
commit a96ca3a15f

View File

@ -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;