-
Notifications
You must be signed in to change notification settings - Fork 55
Anti Wallhack
This module prevents most wallhacks from functioning correctly. The plugin manages and renders out entities so they appear when they should and not render out unless needed. This module checks certain Cvars from the clients and servers to make sure predictions are correct for players. If this module is installed on a L4D(2) server then it will only work with the survivors.
If you are testing this module against your own wallhack cheats to see how it works, make sure you note the following:
- It will always allow you to see teammates.
- It will allow you to see everyone if you are dead or spectating unless in first-person viewmode.
- This module will increase your server's CPU usage
- In some games, this module is known to cause graphical glitching and sound issues
smac_wallhack “1”
- Enable Anti-Wallhack. This will increase your server's CPU usage.
smac_wallhack_maxtraces “1280”
- Max amount of traces that can be executed in one tick.
This convar is not written to the config and must be added manually.
The default is 1280 and in most cases it shouldn't need to be changed. If your server is lagging then this can be decreased. Recommended decrements if your server's CPU usage is maxing out: 1280 → 1120 → 980. A lower number will increase the “flickering” effects, so you need to find a proper balance between CPU usage and lag.
The anti-wallhack provides an API for plugins to determine which players should be processed.
#!sourcepawn
/**
* Sets whether to ignore a client from visibility tests.
* Processing time for anti-wallhack will decrease with every ignored client.
*
* @param client Client index.
* @param bIgnore If true, client will not undergo visibility tests. If false, results in default behavior.
* @noreturn
* @error If the client is not InGame or the index is invalid.
*/
native SMAC_WH_SetClientIgnore(client, bool:bIgnore);
/**
* Returns whether a client is ignored from visibility tests.
*
* @param client Client index.
* @return True if client is ignored from visibility tests, false otherwise.
* @error If the client is not connected or the index is invalid.
*/
native bool:SMAC_WH_GetClientIgnore(client);
A simple plugin that provides admins with a sm_wallhack_ignore
command to toggle the anti-wallhack features on a given player.
#!sourcepawn
#include <sourcemod>
#include <smac_wallhack>
public OnPluginStart()
{
RegAdminCmd("sm_wallhack_ignore", Command_WallhackIgnore, ADMFLAG_GENERIC, "sm_wallhack_ignore <player> <0/1> - toggles whether player(s) undergo visibility tests.");
}
public Action:Command_WallhackIgnore(client, args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_wallhack_ignore <player> <0/1>");
return Plugin_Handled;
}
decl String:sBuffer[64];
GetCmdArg(2, sBuffer, sizeof(sBuffer));
new bool:bIgnore = bool:StringToInt(sBuffer);
GetCmdArg(1, sBuffer, sizeof(sBuffer));
decl String:target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
if ((target_count = ProcessTargetString(
sBuffer,
client,
target_list,
MAXPLAYERS,
0,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (new i = 0; i < target_count; i++)
{
new target = target_list[i];
if (!IsClientInGame(target))
continue;
SMAC_WH_SetClientIgnore(target, bIgnore);
ReplyToCommand(client, "%N is now being %s.", target, SMAC_WH_GetClientIgnore(target) ? "ignored" : "not ignored");
}
return Plugin_Handled;
}