Skip to content

Commit

Permalink
Merge pull request #504 from R3TROATTACK/v1.x
Browse files Browse the repository at this point in the history
Detailed KickClient message
  • Loading branch information
rumblefrog authored Oct 3, 2018
2 parents 93e1092 + 7601ed4 commit 2610abf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
32 changes: 25 additions & 7 deletions game/addons/sourcemod/scripting/sbpp_main.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,15 @@ 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 length[32];
if(time == 0)
FormatEx(length, sizeof(length), "permament");
else
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);
}
}

public void SelectBanIpCallback(Database db, DBResultSet results, const char[] error, DataPack dataPack)
Expand Down Expand Up @@ -2529,7 +2536,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();

Expand All @@ -2550,8 +2557,15 @@ 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 length[32];
if(time == 0)
FormatEx(length, sizeof(length), "permament");
else
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);
}

char banName[128], banReason[256], query[512];

Expand Down Expand Up @@ -2632,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);
}

Expand Down
5 changes: 5 additions & 0 deletions game/addons/sourcemod/translations/sourcebans.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
}

0 comments on commit 2610abf

Please sign in to comment.