Skip to content

Commit

Permalink
Fix exception on plugin unload, enhance chat messages in antilag
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooshua committed Feb 16, 2023
1 parent 5b3d23e commit e4d707a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/scripting/sourceforks_antilag.sp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ public Action Timer_CoolDownPlayers(Handle self)
continue;

if (ClientHeat[i] > HEAT_ATTACKER)
PrintToChat(admin, "[SourceForks] Client %L has unusual network activity.", i)
PrintToChat(admin, "[SourceForks] Client '%N' (#%i) has unusual network activity.", i, GetClientUserId(i));

if (ClientHeat[i] <= HEAT_ATTACKER)
PrintToChat(admin, "[SourceForks] Client %L is attempting to attack the server.", i)
PrintToChat(admin, "[SourceForks] Client '%N' (#%i) is attempting to DDOS the server.", i, GetClientUserId(i));

if (ClientHeat[i] <= 0 && punishment >= Punish_Kick)
PrintToChat(admin, "[SourceForks] Punishing client %L for attempted DDOS.", i)
PrintToChat(admin, "[SourceForks] Punishing client %L for attempted DDOS.", i);
}
}

Expand All @@ -151,7 +151,7 @@ public Action Timer_WarmUpPlayers(Handle self)
#if DEBUG
PrintToServer("Warming up");
#endif

for (int i = 1; i < MAXPLAYERS; i++)
{
ClientHeat[i] = DEFAULT_HEAT;
Expand All @@ -165,7 +165,6 @@ public Action Timer_WarmUpPlayers(Handle self)
// ==================================================================================

DynamicDetour Detour_InvalidReliableState;
DynamicDetour Detour_Ratelimit;

public OnPluginStart()
{
Expand Down Expand Up @@ -215,7 +214,6 @@ public OnClientConnected(int client)
public OnPluginEnd()
{
Detour_InvalidReliableState.Disable(Hook_Pre, Mitigate_IPArg);
Detour_Ratelimit.Disable(Hook_Pre, Mitigate_IPArg);

RecoverFunction(Config, "Ratelimiter", "RatelimiterSize");
RecoverFunction(Config, "CorruptedPacket", "CorruptedPacketSize");
Expand Down

0 comments on commit e4d707a

Please sign in to comment.