Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions game/addons/sourcemod/scripting/sbpp_checker.sp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define LISTBANS_USAGE "sm_listbans <#userid|name> - Lists a user's prior bans from Sourcebans"
#define LISTCOMMS_USAGE "sm_listcomms <#userid|name> - Lists a user's prior comms from Sourcebans"
#define INVALID_TARGET -1
#define Prefix "[SourceBans++] "

char g_DatabasePrefix[10] = "sb";
SMCParser g_ConfigParser;
Expand All @@ -50,6 +51,7 @@ public Plugin myinfo =
public void OnPluginStart()
{
LoadTranslations("common.phrases");
LoadTranslations("sourcechecker.phrases");

CreateConVar("sbchecker_version", VERSION, "", FCVAR_NOTIFY);
RegAdminCmd("sm_listbans", OnListSourceBansCmd, ADMFLAG_BAN, LISTBANS_USAGE);
Expand Down Expand Up @@ -107,16 +109,13 @@ public void OnConnectBanCheck(Database db, DBResultSet results, const char[] err
if (bancount > 0 || commcount > 0)
{
if(bancount == 0){
PrintToBanAdmins("\x04[SourceBans++]\x01 Warning: Player \"%N\" has %d previous commban%s.",
client,commcount,((commcount > 1 || commcount == 0) ? "s":""));
PrintToBanAdmins("%s%t", Prefix, "Comm Warning", client, commcount, ((commcount > 1 || commcount == 0) ? "s":""));
}
else if(commcount == 0){
PrintToBanAdmins("\x04[SourceBans++]\x01 Warning: Player \"%N\" has %d previous ban%s.",
client, bancount, ((bancount > 1 || bancount == 0) ? "s":""));
PrintToBanAdmins("%s%t", Prefix, "Ban Warning", client, bancount, ((bancount > 1 || bancount == 0) ? "s":""));
}
else{
PrintToBanAdmins("\x04[SourceBans++]\x01 Warning: Player \"%N\" has %d previous ban%s and %d previous commban%s.",
client, bancount, ((bancount > 1 || bancount == 0) ? "s":""),commcount,((commcount > 1 || commcount == 0) ? "s":""));
PrintToBanAdmins("%s%t", Prefix, "Ban and Comm Warning", client, bancount, ((bancount > 1 || bancount == 0) ? "s":""), commcount, ((commcount > 1 || commcount == 0) ? "s":""));
}
}
}
Expand Down Expand Up @@ -167,11 +166,11 @@ public Action OnListSourceBansCmd(int client, int args)

if (client == 0)
{
ReplyToCommand(client, "[SourceBans++] Note: if you are using this command through an rcon tool, you will not see results.");
ReplyToCommand(client, "%sNote: if you are using this command through an rcon tool, you will not see results.", Prefix);
}
else
{
ReplyToCommand(client, "\x04[SourceBans++]\x01 Look for %N's ban results in console.", target);
ReplyToCommand(client, "\x04%s\x01 Look for %N's ban results in console.", Prefix, target);
}

return Plugin_Handled;
Expand All @@ -191,17 +190,17 @@ public void OnListBans(Database db, DBResultSet results, const char[] error, Dat

if (results == null)
{
PrintListResponse(clientuid, client, "[SourceBans++] DB error while retrieving bans for %s:\n%s", targetName, error);
PrintListResponse(clientuid, client, "%sDB error while retrieving bans for %s:\n%s", Prefix, targetName, error);
return;
}

if (results.RowCount == 0)
{
PrintListResponse(clientuid, client, "[SourceBans++] No bans found for %s.", targetName);
PrintListResponse(clientuid, client, "%sNo bans found for %s.", Prefix, targetName);
return;
}

PrintListResponse(clientuid, client, "[SourceBans++] Listing bans for %s", targetName);
PrintListResponse(clientuid, client, "%sListing bans for %s", Prefix, targetName);
PrintListResponse(clientuid, client, "Ban Date Banned By Length End Date R Reason");
PrintListResponse(clientuid, client, "-------------------------------------------------------------------------------");
while (results.FetchRow())
Expand Down Expand Up @@ -332,11 +331,11 @@ public Action OnListSourceCommsCmd(int client, int args)

if (client == 0)
{
ReplyToCommand(client, "[SourceBans++] Note: if you are using this command through an rcon tool, you will not see results.");
ReplyToCommand(client, "%sNote: if you are using this command through an rcon tool, you will not see results.", Prefix);
}
else
{
ReplyToCommand(client, "\x04[SourceBans++]\x01 Look for %N's comm results in console.", target);
ReplyToCommand(client, "\x04%s\x01 Look for %N's comm results in console.", Prefix, target);
}

return Plugin_Handled;
Expand All @@ -356,17 +355,17 @@ public void OnListComms(Database db, DBResultSet results, const char[] error, Da

if (results == null)
{
PrintListResponse(clientuid, client, "[SourceBans++] DB error while retrieving comms for %s:\n%s", targetName, error);
PrintListResponse(clientuid, client, "%sDB error while retrieving comms for %s:\n%s", Prefix, targetName, error);
return;
}

if (results.RowCount == 0)
{
PrintListResponse(clientuid, client, "[SourceBans++] No comms found for %s.", targetName);
PrintListResponse(clientuid, client, "%sNo comms found for %s.", Prefix, targetName);
return;
}

PrintListResponse(clientuid, client, "[SourceBans++] Listing comms for %s", targetName);
PrintListResponse(clientuid, client, "%sListing comms for %s", Prefix, targetName);
PrintListResponse(clientuid, client, "Ban Date Banned By Length End Date T R Reason");
PrintListResponse(clientuid, client, "-------------------------------------------------------------------------------");
while (results.FetchRow())
Expand Down
8 changes: 5 additions & 3 deletions game/addons/sourcemod/scripting/sbpp_sleuth.sp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#define LENGTH_DOUBLE 3
#define LENGTH_NOTIFY 4

#define PREFIX "[SourceSleuth] "

//- Handles -//
Database hDatabase = null;
ArrayList g_hAllowedArray = null;
Expand Down Expand Up @@ -133,7 +135,7 @@ public Action ReloadListCallBack(int client, int args)

if (client != 0)
{
PrintToChat(client, "[SourceSleuth] WhiteList has been reloaded!");
PrintToChat(client, "%sWhiteList has been reloaded!", PREFIX);
}

return Plugin_Continue;
Expand Down Expand Up @@ -226,7 +228,7 @@ public void SQL_CheckHim(Database db, DBResultSet results, const char[] error, D
case LENGTH_NOTIFY:
{
/* Notify Admins when a client with an ip on the bans list connects */
PrintToAdmins("[SourceSleuth] %t", "sourcesleuth_admintext", client, steamid, IP);
PrintToAdmins("%s%t", "sourcesleuth_admintext", PREFIX, client, steamid, IP);
}
}
}
Expand All @@ -236,7 +238,7 @@ public void SQL_CheckHim(Database db, DBResultSet results, const char[] error, D
stock void BanPlayer(int client, int time)
{
char Reason[255];
Format(Reason, sizeof(Reason), "[SourceSleuth] %T", "sourcesleuth_banreason", client);
Format(Reason, sizeof(Reason), "%s%T", "sourcesleuth_banreason", PREFIX, client);
SBPP_BanPlayer(0, client, time, Reason);
}

Expand Down
18 changes: 18 additions & 0 deletions game/addons/sourcemod/translations/sourcechecker.phrases.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"Phrases"
{
"Ban Warning"
{
"#format" "{1:N},{2:d},{3:s}"
"en" "Warning: Player \"{1:N}\" has {2} previous ban{3}."
}
"Comm Warning"
{
"#format" "{1:N},{2:d},{3:s}"
"en" "Warning: Player \"{1:N}\" has {2} previous comm block{3}."
}
"Ban and Comm Warning"
{
"#format" "{1:N},{2:d},{3:s},{4:d},{5:s}"
"en" "Warning: Player \"{1:N}\" has {2} previous ban{3} and {4} previous comm block{5}."
}
}