From 50406fe5bf1379a2b2b6048632e2904c7b02a5ad Mon Sep 17 00:00:00 2001 From: R3TROATTACK Date: Fri, 17 Aug 2018 12:38:45 -0500 Subject: [PATCH 1/6] KickClient description Print which admin ban the client, the reason and the length of the ban. --- game/addons/sourcemod/scripting/sbpp_main.sp | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/game/addons/sourcemod/scripting/sbpp_main.sp b/game/addons/sourcemod/scripting/sbpp_main.sp index ebffa08cf..7d41db998 100644 --- a/game/addons/sourcemod/scripting/sbpp_main.sp +++ b/game/addons/sourcemod/scripting/sbpp_main.sp @@ -1177,8 +1177,16 @@ public void VerifyInsert(Database db, DBResultSet results, const char[] error, D } // Kick player - if (GetClientUserId(client) == UserId) - KickClient(client, "%t", "Banned Check Site", WebsiteAddress); + if (GetClientUserId(client) == UserId) + { + char disconnect_reason[256], length[32]; + if(time == 0) + Format(length, sizeof(length), "permament"); + else + Format(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); + Format(disconnect_reason, sizeof(disconnect_reason), "%t\nADMIN: %N\nREASON: %s\nLENGTH: %s", "Banned Check Site", WebsiteAddress, admin, Reason, length); + KickClient(client, disconnect_reason); + } } public void SelectBanIpCallback(Database db, DBResultSet results, const char[] error, DataPack dataPack) @@ -2529,7 +2537,7 @@ stock void UTIL_InsertBan(int time, const char[] Name, const char[] Authid, cons stock void UTIL_InsertTempBan(int time, const char[] name, const char[] auth, const char[] ip, const char[] reason, const char[] adminAuth, const char[] adminIp, DataPack dataPack) { - dataPack.ReadCell(); // admin index + int admin = dataPack.ReadCell(); // admin index int client = dataPack.ReadCell(); @@ -2550,8 +2558,16 @@ stock void UTIL_InsertTempBan(int time, const char[] name, const char[] auth, co ServerCommand(buffer); - if (IsClientInGame(client)) - KickClient(client, "%t", "Banned Check Site", WebsiteAddress); + if (IsClientInGame(client)) + { + char disconnect_reason[256], length[32]; + if(time == 0) + Format(length, sizeof(length), "permament"); + else + Format(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); + Format(disconnect_reason, sizeof(disconnect_reason), "%t\nADMIN: %N\nREASON: %s\nLENGTH: %s", "Banned Check Site", WebsiteAddress, admin, reason, length); + KickClient(client, disconnect_reason); + } char banName[128], banReason[256], query[512]; From 19846b355994b813e679c4a41a1ebef4d0843e3b Mon Sep 17 00:00:00 2001 From: R3TROATTACK Date: Sat, 18 Aug 2018 06:29:56 -0500 Subject: [PATCH 2/6] Add phrase for kick reason --- game/addons/sourcemod/translations/sourcebans.phrases.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/game/addons/sourcemod/translations/sourcebans.phrases.txt b/game/addons/sourcemod/translations/sourcebans.phrases.txt index 49c2221bc..469b8b58a 100644 --- a/game/addons/sourcemod/translations/sourcebans.phrases.txt +++ b/game/addons/sourcemod/translations/sourcebans.phrases.txt @@ -146,4 +146,9 @@ "hu" "A ban eljárás sikeresen leállítva." "chi" "封禁操作已成功取消." } + "Kick Reason" + { + "#format" "{1:N}, {2:s}, {3:s}" + "en" "Admin: {1}\nReason: {2}\nLength: {3}" + } } From 9cebbaf0602c76a186a3ce54c1eecc630f7a3867 Mon Sep 17 00:00:00 2001 From: R3TROATTACK Date: Sat, 18 Aug 2018 06:30:37 -0500 Subject: [PATCH 3/6] Added translation for kick formatting --- game/addons/sourcemod/scripting/sbpp_main.sp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/game/addons/sourcemod/scripting/sbpp_main.sp b/game/addons/sourcemod/scripting/sbpp_main.sp index 7d41db998..94e0d4d70 100644 --- a/game/addons/sourcemod/scripting/sbpp_main.sp +++ b/game/addons/sourcemod/scripting/sbpp_main.sp @@ -1179,13 +1179,12 @@ public void VerifyInsert(Database db, DBResultSet results, const char[] error, D // Kick player if (GetClientUserId(client) == UserId) { - char disconnect_reason[256], length[32]; + char length[32]; if(time == 0) Format(length, sizeof(length), "permament"); else Format(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); - Format(disconnect_reason, sizeof(disconnect_reason), "%t\nADMIN: %N\nREASON: %s\nLENGTH: %s", "Banned Check Site", WebsiteAddress, admin, Reason, length); - KickClient(client, disconnect_reason); + KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, Reason, length); } } @@ -2560,13 +2559,12 @@ stock void UTIL_InsertTempBan(int time, const char[] name, const char[] auth, co if (IsClientInGame(client)) { - char disconnect_reason[256], length[32]; + char length[32]; if(time == 0) Format(length, sizeof(length), "permament"); else Format(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); - Format(disconnect_reason, sizeof(disconnect_reason), "%t\nADMIN: %N\nREASON: %s\nLENGTH: %s", "Banned Check Site", WebsiteAddress, admin, reason, length); - KickClient(client, disconnect_reason); + KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, reason, length); } char banName[128], banReason[256], query[512]; From 3d3a3d748b974612572a7e6bf822c9e21d825de4 Mon Sep 17 00:00:00 2001 From: R3TROATTACK Date: Sun, 19 Aug 2018 10:13:18 -0500 Subject: [PATCH 4/6] Change Format to FormatEx for ban length --- game/addons/sourcemod/scripting/sbpp_main.sp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/game/addons/sourcemod/scripting/sbpp_main.sp b/game/addons/sourcemod/scripting/sbpp_main.sp index 94e0d4d70..8a1fc7afa 100644 --- a/game/addons/sourcemod/scripting/sbpp_main.sp +++ b/game/addons/sourcemod/scripting/sbpp_main.sp @@ -1181,9 +1181,9 @@ public void VerifyInsert(Database db, DBResultSet results, const char[] error, D { char length[32]; if(time == 0) - Format(length, sizeof(length), "permament"); + FormatEx(length, sizeof(length), "permament"); else - Format(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); + FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, Reason, length); } } @@ -2561,9 +2561,9 @@ stock void UTIL_InsertTempBan(int time, const char[] name, const char[] auth, co { char length[32]; if(time == 0) - Format(length, sizeof(length), "permament"); + FormatEx(length, sizeof(length), "permament"); else - Format(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); + FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, reason, length); } From 025e693f38640353524d1658d69b88270682373b Mon Sep 17 00:00:00 2001 From: R3TROATTACK Date: Mon, 20 Aug 2018 08:47:17 -0500 Subject: [PATCH 5/6] Made admin menu bans use this --- game/addons/sourcemod/scripting/sbpp_main.sp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/game/addons/sourcemod/scripting/sbpp_main.sp b/game/addons/sourcemod/scripting/sbpp_main.sp index 8a1fc7afa..fb8d97012 100644 --- a/game/addons/sourcemod/scripting/sbpp_main.sp +++ b/game/addons/sourcemod/scripting/sbpp_main.sp @@ -2646,10 +2646,14 @@ stock void PrepareBan(int client, int target, int time, char[] reason, int size) } } LogAction(client, target, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, target, time, reason); - + char length[32]; + if(time == 0) + FormatEx(length, sizeof(length), "permament"); + else + FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes"); if (time > 5 || time == 0) time = 5; - Format(bannedSite, sizeof(bannedSite), "%T", "Banned Check Site", target, WebsiteAddress); + Format(bannedSite, sizeof(bannedSite), "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", client, reason, length);//temp BanClient(target, time, BANFLAG_AUTO, bannedSite, bannedSite, "sm_ban", client); } From 7601ed41c829f02b394c1311e04e8722ffe24705 Mon Sep 17 00:00:00 2001 From: R3TROATTACK Date: Sat, 29 Sep 2018 23:17:01 -0500 Subject: [PATCH 6/6] Removed spacing in translation format --- game/addons/sourcemod/translations/sourcebans.phrases.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/addons/sourcemod/translations/sourcebans.phrases.txt b/game/addons/sourcemod/translations/sourcebans.phrases.txt index 469b8b58a..a42c57c50 100644 --- a/game/addons/sourcemod/translations/sourcebans.phrases.txt +++ b/game/addons/sourcemod/translations/sourcebans.phrases.txt @@ -148,7 +148,7 @@ } "Kick Reason" { - "#format" "{1:N}, {2:s}, {3:s}" + "#format" "{1:N},{2:s},{3:s}" "en" "Admin: {1}\nReason: {2}\nLength: {3}" } }