Commit f3518e8a authored by Zipcore's avatar Zipcore

Added SB++ 1.6.x support

parent 5013dcfe
No preview for this file type
......@@ -29,7 +29,17 @@ public void OnPluginStart()
AutoExecConfig(true, "discord_sourcebans");
}
public int SBPP_OnBanPlayer(int iAdmin, int iTarget, int iTime, const char[] sReason)
{
PrePareMsg(iAdmin, iTarget, iTime, sReason);
}
public int OnSBBanPlayer(int client, int target, int time, char[] reason)
{
PrePareMsg(client, target, time, reason);
}
void PrePareMsg(int client, int target, int time, const char[] reason)
{
char sColor[8];
g_cColor.GetString(sColor, sizeof(sColor));
......
......@@ -48,6 +48,11 @@ public int SourceComms_OnSilencePlayer(int client, int target, int time, char[]
PrePareMsg(client, target, time, 3, reason);
}
public int SourceComms_OnBlockAdded(int client, int target, int time, int type, char[] reason)
{
PrePareMsg(client, target, time, type, reason);
}
public int PrePareMsg(int client, int target, int time, int type, char[] reason)
{
char sAuth[32];
......@@ -74,22 +79,22 @@ public int PrePareMsg(int client, int target, int time, int type, char[] reason)
{
int years = RoundToFloor(time / 525600.0);
Format(sLength, sizeof(sLength), "%d mins (%d year%s)", time, years, years == 1 ? "" : "s");
}
}
else if (time >= 10080)
{
int weeks = RoundToFloor(time / 10080.0);
Format(sLength, sizeof(sLength), "%d mins (%d week%s)", time, weeks, weeks == 1 ? "" : "s");
}
}
else if (time >= 1440)
{
int days = RoundToFloor(time / 1440.0);
Format(sLength, sizeof(sLength), "%d mins (%d day%s)", time, days, days == 1 ? "" : "s");
}
}
else if (time >= 60)
{
int hours = RoundToFloor(time / 60.0);
Format(sLength, sizeof(sLength), "%d mins (%d hour%s)", time, hours, hours == 1 ? "" : "s");
}
}
else Format(sLength, sizeof(sLength), "%d min%s", time, time == 1 ? "" : "s");
Discord_EscapeString(sName, strlen(sName));
......@@ -120,6 +125,36 @@ public int PrePareMsg(int client, int target, int time, int type, char[] reason)
g_cColorSilence.GetString(sColor, sizeof(sColor));
sType = "Silence";
}
case 4:
{
g_cColorSilence.GetString(sColor, sizeof(sColor));
sType = "UnMute";
}
case 5:
{
g_cColorSilence.GetString(sColor, sizeof(sColor));
sType = "UnGag";
}
case 6:
{
g_cColorSilence.GetString(sColor, sizeof(sColor));
sType = "UnSilence";
}
case 14:
{
g_cColorSilence.GetString(sColor, sizeof(sColor));
sType = "UnMute (tmp)";
}
case 15:
{
g_cColorSilence.GetString(sColor, sizeof(sColor));
sType = "UnGag (tmp)";
}
case 16:
{
g_cColorSilence.GetString(sColor, sizeof(sColor));
sType = "UnSilence (tmp)";
}
}
ReplaceString(sMSG, sizeof(sMSG), "{COLOR}", sColor);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment