Order by newest, removed some info
This commit is contained in:
parent
59a99c7a0d
commit
03bb9e9ce2
@ -1,6 +1,6 @@
|
||||
#include <sourcemod>
|
||||
|
||||
#define VERSION "2.3.1"
|
||||
#define VERSION "2.3.3"
|
||||
#define LISTBANS_USAGE "sm_listbans <#userid|name> - Lists a user's prior bans from Sourcebans"
|
||||
#define DATABASE_PREFIX "sb"
|
||||
|
||||
@ -86,7 +86,7 @@ public Action OnListSourceBansCmd(int client, int args)
|
||||
char query[1024];
|
||||
char ip[30];
|
||||
GetClientIP(target_list[0], ip, sizeof(ip));
|
||||
FormatEx(query, sizeof(query), "SELECT bid, created, %s_admins.user, length, reason, RemoveType FROM %s_bans LEFT JOIN %s_admins ON %s_bans.aid = %s_admins.aid WHERE ((type = 0 AND %s_bans.authid REGEXP '^STEAM_[0-9]:%s$') OR (type = 1 AND ip = '%s')) AND ((length > '0' AND ends > UNIX_TIMESTAMP()) OR RemoveType IS NOT NULL)", DATABASE_PREFIX, DATABASE_PREFIX, DATABASE_PREFIX, DATABASE_PREFIX, DATABASE_PREFIX, DATABASE_PREFIX, auth[8], ip);
|
||||
FormatEx(query, sizeof(query), "SELECT bid, created, length, reason, RemoveType FROM %s_bans WHERE ((type = 0 AND %s_bans.authid REGEXP '^STEAM_[0-9]:%s$') OR (type = 1 AND ip = '%s')) AND ((length > '0' AND ends > UNIX_TIMESTAMP()) OR RemoveType IS NOT NULL) ORDER BY created DESC;", DATABASE_PREFIX, DATABASE_PREFIX, auth[8], ip);
|
||||
|
||||
char targetName[MAX_NAME_LENGTH];
|
||||
GetClientName(target_list[0], targetName, sizeof(targetName));
|
||||
@ -143,7 +143,7 @@ public void OnListBans(Database db, DBResultSet results, const char[] error, Dat
|
||||
{
|
||||
char banid[12];
|
||||
char createddate[11] = "<Unknown>";
|
||||
char bannedby[MAX_NAME_LENGTH] = "<Unknown>";
|
||||
//char bannedby[MAX_NAME_LENGTH] = "<Unknown>";
|
||||
char lenstring[32] = "N/A";
|
||||
char reason[28];
|
||||
char RemoveType[9] = " ";
|
||||
@ -158,13 +158,9 @@ public void OnListBans(Database db, DBResultSet results, const char[] error, Dat
|
||||
FormatTime(createddate, sizeof(createddate), "%Y-%m-%d", results.FetchInt(1));
|
||||
}
|
||||
|
||||
if (!results.IsFieldNull(2))
|
||||
{
|
||||
results.FetchString(2, bannedby, sizeof(bannedby));
|
||||
}
|
||||
|
||||
// NOT NULL
|
||||
int length = results.FetchInt(3);
|
||||
int length = results.FetchInt(2);
|
||||
if (length == 0)
|
||||
{
|
||||
Format(lenstring, sizeof(lenstring), "Permanent");
|
||||
@ -176,11 +172,11 @@ public void OnListBans(Database db, DBResultSet results, const char[] error, Dat
|
||||
|
||||
|
||||
// NOT NULL
|
||||
results.FetchString(4, reason, sizeof(reason));
|
||||
results.FetchString(3, reason, sizeof(reason));
|
||||
|
||||
if (!results.IsFieldNull(5))
|
||||
if (!results.IsFieldNull(4))
|
||||
{
|
||||
results.FetchString(5, RemoveType, sizeof(RemoveType));
|
||||
results.FetchString(4, RemoveType, sizeof(RemoveType));
|
||||
if (StrEqual(RemoveType, "E", false))
|
||||
Format(RemoveType, sizeof(RemoveType), "Expired");
|
||||
|
||||
@ -188,7 +184,7 @@ public void OnListBans(Database db, DBResultSet results, const char[] error, Dat
|
||||
Format(RemoveType, sizeof(RemoveType), "Unbanned");
|
||||
}
|
||||
|
||||
Format(cBuffer, sizeof(cBuffer), "Banned in %s\n\nBanned by: %s\nLength: %s(%s)\nReason: %s\n ", createddate, bannedby, lenstring, RemoveType, reason);
|
||||
Format(cBuffer, sizeof(cBuffer), "%s\n%s(%s)\nReason: %s\n ", createddate, lenstring, RemoveType, reason);
|
||||
menu.AddItem(banid, cBuffer);
|
||||
}
|
||||
menu.ExitButton = true;
|
||||
|
Loading…
Reference in New Issue
Block a user