public VerifyBan(Handle:owner, Handle:hndl, const String:error[], any:userid)
{
decl String:clientName[64];
decl String:clientAuth[64];
decl String:clientIp[64];
new client = GetClientOfUserId(userid);
if(!client)
return;
if(hndl == INVALID_HANDLE)
{
LogToFile(logFile, "Verify Ban Query Failed: %s", error);
PlayerRecheck[client] = CreateTimer(RetryTime, ClientRecheck, client);
return;
}
GetClientIP(client, clientIp, sizeof(clientIp));
GetClientAuthString(client, clientAuth, sizeof(clientAuth));
GetClientName(client, clientName, sizeof(clientName));
if(SQL_GetRowCount(hndl) > 0)
{
//decl String:buffer[40];
decl String:Name[128];
decl String:Query[512];
SQL_EscapeString(Database, clientName, Name, sizeof(Name));
if( serverID == -1 )
{
FormatEx(Query, sizeof(Query), "INSERT INTO %s_banlog (sid ,time ,name ,bid) VALUES \
((SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1), UNIX_TIMESTAMP(), '%s', \
(SELECT bid FROM %s_bans WHERE ((type = 0 AND authid REGEXP '^STEAM_[0-9]:%s$') OR (type = 1 AND ip = '%s')) AND RemoveType IS NULL LIMIT 0,1))",
DatabasePrefix, DatabasePrefix, ServerIp, ServerPort, Name, DatabasePrefix, clientAuth[8], clientIp);
}
else
{
FormatEx(Query, sizeof(Query), "INSERT INTO %s_banlog (sid ,time ,name ,bid) VALUES \
(%d, UNIX_TIMESTAMP(), '%s', \
(SELECT bid FROM %s_bans WHERE ((type = 0 AND authid REGEXP '^STEAM_[0-9]:%s$') OR (type = 1 AND ip = '%s')) AND RemoveType IS NULL LIMIT 0,1))",
DatabasePrefix, serverID, Name, DatabasePrefix, clientAuth[8], clientIp);
}
SQL_TQuery(Database, ErrorCheckCallback, Query, client, DBPrio_High);
/* FormatEx(buffer, sizeof(buffer), "banid 5 %s", clientAuth);
ServerCommand(buffer); */
TimerGetEndBan[client] = CreateTimer(0.5, RunTimerGetEndBan, client);
return;
}
#if defined DEBUG
LogToFile(logFile, "%s is NOT banned.", clientAuth);
#endif
PlayerStatus[client] = true;
}