Skip to content

Commit

Permalink
Merge pull request #51 from sapphonie/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
sapphonie authored Jul 17, 2021
2 parents acc985f + ff09b1c commit 56c65e1
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 72 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file + UTF 8
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
Binary file modified plugins/stac.smx
Binary file not shown.
2 changes: 1 addition & 1 deletion scripting/stac.sp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// we have to re pragma because sourcemod sucks lol
#pragma newdecls required

#define PLUGIN_VERSION "5.0.7"
#define PLUGIN_VERSION "5.1.0"

#define UPDATE_URL "https://raw.githubusercontent.com/sapphonie/StAC-tf2/master/updatefile.txt"

Expand Down
9 changes: 6 additions & 3 deletions scripting/stac/stac_client.sp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ Action CheckAuthOn(Handle timer, int userid)
SteamAuthFor[Cl][0] = '\0';
if (kickUnauth)
{
StacGeneralPlayerDiscordNotify(userid, "Kicked for being unauthorized w/ Steam");
StacGeneralPlayerNotify(userid, "Kicked for being unauthorized w/ Steam");
StacLog("[StAC] Kicking %N for not being authorized with Steam.", Cl);
KickClient(Cl, "[StAC] Not authorized with Steam Network, please authorize and reconnect");
}
else
{
StacGeneralPlayerDiscordNotify(userid, "Client failed to authorize w/ Steam in a timely manner");
StacGeneralPlayerNotify(userid, "Client failed to authorize w/ Steam in a timely manner");
StacLog("[StAC] Client %N failed to authorize w/ Steam in a timely manner.", Cl);
}
}
Expand Down Expand Up @@ -76,7 +76,10 @@ public void OnClientAuthorized(int Cl, const char[] auth)
if (!IsFakeClient(Cl))
{
strcopy(SteamAuthFor[Cl], sizeof(SteamAuthFor[]), auth);
//StacLog("auth %s for Cl %N", auth, Cl);
if (DEBUG)
{
StacLog("[StAC] auth %s for Cl %N", auth, Cl);
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions scripting/stac/stac_commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ Action checkAdmin(int callingCl, int args)
}
if (!isAdmin)
{
StacGeneralPlayerDiscordNotify(GetClientUserId(callingCl), "Client %N attempted to use %s, blocked access!", callingCl, arg0);
PrintToImportant("{hotpink}[StAC]{white} Client %N attempted to use %s, blocked access." , callingCl, arg0);
StacLogSteam(GetClientUserId(callingCl));
StacGeneralPlayerNotify(GetClientUserId(callingCl), "Client %N attempted to use %s, blocked access!", callingCl, arg0);
return Plugin_Handled;
}
StacGeneralPlayerDiscordNotify(GetClientUserId(callingCl), "Admin %N used %s", callingCl, arg0);
StacGeneralPlayerNotify(GetClientUserId(callingCl), "Admin %N used %s", callingCl, arg0);
}

if (StrEqual(arg0, "sm_stac_checkall"))
Expand Down
16 changes: 8 additions & 8 deletions scripting/stac/stac_cvar_checks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void ConVarCheck(QueryCookie cookie, int Cl, ConVarQueryResult result, const cha
else if (result != ConVarQuery_Okay && !IsCheatOnlyVar(cvarName))
{
PrintToImportant("{hotpink}[StAC]{white} Could not query cvar %s on Player %N", cvarName, Cl);
StacLog("[StAC] Could not query cvar %s on player %N", cvarName, Cl);
StacLog("[StAC] Could not query cvar %s on player %L", cvarName, Cl);
}
}

Expand Down Expand Up @@ -206,23 +206,23 @@ bool IsCheatOnlyVar(const char[] cvarName)
void oobVarsNotify(int userid, const char[] name, const char[] value)
{
int Cl = GetClientOfUserId(userid);
PrintToImportant("{hotpink}[StAC] {red}[Detection]{white} Player %L is cheating - OOB cvar/netvar value {blue}%s{white} on var {blue}%s{white}!", Cl, value, name);

PrintToImportant("{hotpink}[StAC] {red}[Detection]{white} Player %N is cheating - OOB cvar/netvar value {blue}%s{white} on var {blue}%s{white}!", Cl, value, name);
StacLogSteam(userid);
char msg[128];
Format(msg, sizeof(msg), "Client has OOB value %s for var %s!", value, name);
StacDetectionDiscordNotify(userid, msg, 1);
StacDetectionNotify(userid, msg, 1);
}


// cheatonly cvars/concmds/etc
void illegalVarsNotify(int userid, const char[] name)
{
int Cl = GetClientOfUserId(userid);
PrintToImportant("{hotpink}[StAC] {red}[Detection]{white} Player %L is cheating - detected known cheat var/concommand {blue}%s{white}!", Cl, name);

PrintToImportant("{hotpink}[StAC] {red}[Detection]{white} Player %N is cheating - detected known cheat var/concommand {blue}%s{white}!", Cl, name);
StacLogSteam(userid);
char msg[128];
Format(msg, sizeof(msg), "Known cheat var %s exists on client!", name);
StacDetectionDiscordNotify(userid, msg, 1);
StacDetectionNotify(userid, msg, 1);
}


Expand Down Expand Up @@ -256,7 +256,7 @@ Action Timer_CheckClientConVars(Handle timer, int userid)
{
if (DEBUG)
{
StacLog("[StAC] Checking client id, %i, %N", Cl, Cl);
StacLog("[StAC] Checking client id, %i, %L", Cl, Cl);
}
// init variable to pass to QueryCvarsEtc
int i;
Expand Down
13 changes: 12 additions & 1 deletion scripting/stac/stac_livefeed.sp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,18 @@ void LiveFeed_PlayerCmd(int userid)

for (int LiveFeedViewer = 1; LiveFeedViewer <= MaxClients; LiveFeedViewer++)
{
if (IsValidAdmin(LiveFeedViewer) || IsValidSrcTV(LiveFeedViewer))
if
(
// only show to admins in spec
(
IsValidAdmin(LiveFeedViewer)
&&
GetClientTeam(LiveFeedViewer) < 2
)
// and sourcetv
||
IsValidSrcTV(LiveFeedViewer)
)
{
// ONPLAYERRUNCMD
SetHudTextParams
Expand Down
15 changes: 8 additions & 7 deletions scripting/stac/stac_misc_checks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public Action OnClientSayCommand(int Cl, const char[] command, const char[] sArg
}
else
{
PrintToImportant("{hotpink}[StAC] {red}[Detection]{white} Blocked newline print from player %L", Cl);
StacDetectionDiscordNotify(userid, "client tried to print a newline character", 1);
StacLog("[StAC] [Detection] Blocked newline print from player %L", Cl);
PrintToImportant("{hotpink}[StAC] {red}[Detection]{white} Blocked newline print from player %N", Cl);
StacLogSteam(userid);
StacDetectionNotify(userid, "client tried to print a newline character", 1);
}
return Plugin_Stop;
}
Expand Down Expand Up @@ -65,8 +65,8 @@ public Action OnClientCommand(int Cl, int args)

if (strlen(ClientCommandChar) > 255)
{
StacGeneralPlayerDiscordNotify(userid, "Client sent a very large command - length %i - to the server! Next message is the command.", strlen(ClientCommandChar));
StacGeneralPlayerDiscordNotify(userid, "%s", ClientCommandChar);
StacGeneralPlayerNotify(userid, "Client sent a very large command - length %i - to the server! Next message is the command.", strlen(ClientCommandChar));
StacGeneralPlayerNotify(userid, "%s", ClientCommandChar);
StacLog("Client sent a very large command - length %i - to the server! Next message is the command.", strlen(ClientCommandChar));
StacLog("%s", ClientCommandChar);
return Plugin_Stop;
Expand Down Expand Up @@ -207,8 +207,9 @@ void userinfoSpamEtc(int userid, const char[] cvar, const char[] oldvalue, const
);
if (userinfoSpamDetects[Cl] % 5 == 0)
{
StacDetectionDiscordNotify(userid, "userinfo spam", userinfoSpamDetects[Cl]);
StacDetectionNotify(userid, "userinfo spam", userinfoSpamDetects[Cl]);
}
StacLogSteam(userid);
// BAN USER if they trigger too many detections
if (userinfoSpamDetects[Cl] >= maxuserinfoSpamDetections && maxuserinfoSpamDetections > 0)
{
Expand Down Expand Up @@ -339,7 +340,7 @@ void checkInterp(int userid)
{
char message[256];
Format(message, sizeof(message), "Client was kicked for attempted interp exploitation. Their interp: %.2fms", lerp);
StacGeneralPlayerDiscordNotify(userid, message);
StacGeneralPlayerNotify(userid, message);
KickClient(Cl, "%t", "interpKickMsg", lerp, min_interp_ms, max_interp_ms);
MC_PrintToChatAll("%t", "interpAllChat", Cl, lerp);
StacLog("%t", "interpAllChat", Cl, lerp);
Expand Down
26 changes: 17 additions & 9 deletions scripting/stac/stac_onplayerruncmd.sp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Action OnPlayerRunCmd
if (cmdnum < 0 || tickcount < 0)
{
StacLog("[StAC] cmdnum %i, tickcount %i", cmdnum, tickcount);
StacGeneralPlayerDiscordNotify(userid, "Client has invalid usercmd data!");
StacGeneralPlayerNotify(userid, "Client has invalid usercmd data!");
// returning Plugin_Handled allows for airstuck to work again
return Plugin_Continue;
}
Expand Down Expand Up @@ -257,8 +257,9 @@ void bhopCheck(int userid)
PrintToImportant("{hotpink}[StAC]{white} Player %N {mediumpurple}bhopped{white}!\nConsecutive detections so far: {palegreen}%i" , Cl, bhopDetects[Cl]);
if (bhopDetects[Cl] % 5 == 0)
{
StacDetectionDiscordNotify(userid, "consecutive tick perfect bhops", bhopDetects[Cl]);
StacDetectionNotify(userid, "consecutive tick perfect bhops", bhopDetects[Cl]);
}
StacLogSteam(userid);

if (bhopDetects[Cl] >= maxBhopDetections)
{
Expand Down Expand Up @@ -333,14 +334,15 @@ void turnbindCheck(int userid)
turnTimes[Cl]++;
float turnSec = turnTimes[Cl] * tickinterv;
PrintToImportant("%t", "turnbindAdminMsg", Cl, turnSec);
StacLogSteam(userid);

if (turnSec < maxAllowedTurnSecs)
{
MC_PrintToChat(Cl, "%t", "turnbindWarnPlayer");
}
else if (turnSec >= maxAllowedTurnSecs)
{
StacGeneralPlayerDiscordNotify(userid, "Client was kicked for turn binds");
StacGeneralPlayerNotify(userid, "Client was kicked for turn binds");
KickClient(Cl, "%t", "turnbindKickMsg");
MC_PrintToChatAll("%t", "turnbindAllChat", Cl);
StacLog("%t", "turnbindAllChat", Cl);
Expand Down Expand Up @@ -386,9 +388,10 @@ void fakeangCheck(int userid)
clangles[Cl][0][2],
fakeAngDetects[Cl]
);
StacLogSteam(userid);
if (fakeAngDetects[Cl] == 1 || fakeAngDetects[Cl] % 5 == 0)
{
StacDetectionDiscordNotify(userid, "fake angles", fakeAngDetects[Cl]);
StacDetectionNotify(userid, "fake angles", fakeAngDetects[Cl]);
}
if (fakeAngDetects[Cl] >= maxFakeAngDetections && maxFakeAngDetections > 0)
{
Expand Down Expand Up @@ -425,13 +428,14 @@ void cmdnumspikeCheck(int userid)
Cl,
cmdnumSpikeDetects[Cl]
);
StacLogSteam(userid);
StacLogNetData(userid);
StacLogCmdnums(userid);
StacLogTickcounts(userid);

if (cmdnumSpikeDetects[Cl] % 5 == 0)
{
StacDetectionDiscordNotify(userid, "cmdnum spike", cmdnumSpikeDetects[Cl]);
StacDetectionNotify(userid, "cmdnum spike", cmdnumSpikeDetects[Cl]);
}

// punish if we reach limit set by cvar
Expand Down Expand Up @@ -491,14 +495,15 @@ void spinbotCheck(int userid)
Cl,
spinbotDetects[Cl]
);
StacLogSteam(userid);
StacLogNetData(userid);
StacLogAngles(userid);
StacLogCmdnums(userid);
StacLogTickcounts(userid);
StacLogMouse(userid);
if (spinbotDetects[Cl] % 20 == 0)
{
StacDetectionDiscordNotify(userid, "spinbot", spinbotDetects[Cl]);
StacDetectionNotify(userid, "spinbot", spinbotDetects[Cl]);
}
if (spinbotDetects[Cl] >= maxSpinbotDetections && maxSpinbotDetections > 0)
{
Expand Down Expand Up @@ -635,6 +640,7 @@ void psilentCheck(int userid)
aDiffReal, Cl,
pSilentDetects[Cl], fuzzy == 1 ? "yes" : "no", aDiffReal <= 3.0 ? "yes" : "no"
);
StacLogSteam(userid);
StacLogNetData(userid);
StacLogAngles(userid);
StacLogCmdnums(userid);
Expand All @@ -646,7 +652,7 @@ void psilentCheck(int userid)
}
if (pSilentDetects[Cl] % 5 == 0)
{
StacDetectionDiscordNotify(userid, "psilent", pSilentDetects[Cl]);
StacDetectionNotify(userid, "psilent", pSilentDetects[Cl]);
}
// BAN USER if they trigger too many detections
if (pSilentDetects[Cl] >= maxPsilentDetections && maxPsilentDetections > 0)
Expand Down Expand Up @@ -763,6 +769,7 @@ void aimsnapCheck(int userid)
Cl,
aimsnapDetects[Cl]
);
StacLogSteam(userid);
StacLogNetData(userid);
StacLogAngles(userid);
StacLogCmdnums(userid);
Expand All @@ -784,7 +791,7 @@ void aimsnapCheck(int userid)

if (aimsnapDetects[Cl] % 5 == 0)
{
StacDetectionDiscordNotify(userid, "aimsnap", aimsnapDetects[Cl]);
StacDetectionNotify(userid, "aimsnap", aimsnapDetects[Cl]);
}

// BAN USER if they trigger too many detections
Expand Down Expand Up @@ -889,6 +896,7 @@ void triggerbotCheck(int userid)
tbotDetects[Cl],
attack
);
StacLogSteam(userid);
StacLogNetData(userid);
StacLogAngles(userid);
StacLogCmdnums(userid);
Expand All @@ -906,7 +914,7 @@ void triggerbotCheck(int userid)
}
if (tbotDetects[Cl] % 5 == 0)
{
StacDetectionDiscordNotify(userid, "triggerbot", tbotDetects[Cl]);
StacDetectionNotify(userid, "triggerbot", tbotDetects[Cl]);
}
// BAN USER if they trigger too many detections
if (tbotDetects[Cl] >= maxTbotDetections && maxTbotDetections > 0)
Expand Down
Loading

0 comments on commit 56c65e1

Please sign in to comment.