mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 09:33:20 +00:00
globalbans: use expired vcolumn
This commit is contained in:
parent
7678f763a7
commit
bb1226d30f
2 changed files with 7 additions and 9 deletions
Binary file not shown.
|
@ -61,7 +61,7 @@ public void OnClientAuthorized(int client, const char[] auth) {
|
||||||
if(!StrEqual(auth, "BOT", true)) {
|
if(!StrEqual(auth, "BOT", true)) {
|
||||||
char query[256], ip[32];
|
char query[256], ip[32];
|
||||||
GetClientIP(client, ip, sizeof(ip));
|
GetClientIP(client, ip, sizeof(ip));
|
||||||
Format(query, sizeof(query), "SELECT `reason`, `steamid`, `expires` FROM `bans` WHERE `steamid` = '%s' OR ip = '?'", auth, ip);
|
Format(query, sizeof(query), "SELECT `reason`, `steamid`, `expired` FROM `bans` WHERE `steamid` = '%s' OR ip = '?'", auth, ip);
|
||||||
g_db.Query(DB_OnConnectCheck, query, GetClientUserId(client), DBPrio_High);
|
g_db.Query(DB_OnConnectCheck, query, GetClientUserId(client), DBPrio_High);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,18 +154,16 @@ public void DB_OnConnectCheck(Database db, DBResultSet results, const char[] err
|
||||||
//No failure, check the data.
|
//No failure, check the data.
|
||||||
if(results.RowCount > 0 && client) {
|
if(results.RowCount > 0 && client) {
|
||||||
results.FetchRow();
|
results.FetchRow();
|
||||||
char reason[128], expiresDate[64], steamid[32];
|
char reason[128], steamid[64];
|
||||||
DBResult result;
|
DBResult reasonResult;
|
||||||
results.FetchString(1, steamid, sizeof(steamid));
|
results.FetchString(1, steamid, sizeof(steamid));
|
||||||
|
bool expired = results.FetchInt(2) == 1;
|
||||||
if(results.IsFieldNull(2)) {
|
if(results.IsFieldNull(2)) {
|
||||||
DeleteBan(steamid);
|
DeleteBan(steamid);
|
||||||
}else{
|
}else{
|
||||||
results.FetchString(0, reason, sizeof(reason), result);
|
results.FetchString(0, reason, sizeof(reason), reasonResult);
|
||||||
results.FetchString(2, expiresDate, sizeof(expiresDate));
|
if(!expired) {
|
||||||
|
if(reasonResult == DBVal_Data)
|
||||||
int expires = StringToInt(expiresDate);
|
|
||||||
if(expires <= GetTime() && expires > 0) {
|
|
||||||
if(result == DBVal_Data)
|
|
||||||
KickClient(client, "You have been banned: %s", reason);
|
KickClient(client, "You have been banned: %s", reason);
|
||||||
else
|
else
|
||||||
KickClient(client, "You have been banned from this server.");
|
KickClient(client, "You have been banned from this server.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue