Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detailed KickClient message #504

Merged
merged 6 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
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}"
}
}