Stop Cheat Engine speedhackers in 542 bytes or less

Most speedhack detectors run server-side and, due to potential lag, must only be triggered if the speedhack is extremely obvious - several times normal speed. To get around this some players will just give themselves a smaller speedhack (<2x) but this still unbalances gameplay and is very hard to detect reliably serverside. Here’s an extremely simple yet powerful speedhack prevention method I came up with which runs totally clientside.

--noSpeeding basic but precise speedhack protection by Swamp Onions
--put this code in lua/autorun/client/nospeeding.lua

speedingTickCount = 0
isSpeeding = 0

timer.Create("noSpeeding", 1, 0, function()
	if speedingTickCount > ((1 / engine.TickInterval()) + 1) then
		isSpeeding = isSpeeding + 1
		isSpeeding = 0
	speedingTickCount = 0
	if isSpeeding > 5 then
		--crash their game LOL
		while true do end

hook.Add("Tick", "noSpeedingTick", function()
	speedingTickCount = speedingTickCount + 1

This can reliably detect speedhacks at an impressively low level while having almost zero false detections. It just works based on the fact that some timers are affected by Cheat Engine and some aren’t, and compares values between the two. Of course, any real hacker could stop this from running easily, but this is a good way to stop people who aren’t familiar with GMOD hacking and just boot up Cheat Engine to speedhack like in every game.

You can do the same thing serverside with hooks like Move or PlayerTick.

I see that being done in anticheat software but it has to give a lot more leeway to prevent false detections because of lag and such.

This can easily be bypassed, you can just remove the timer and hook.

I will never understand how people who can’t read visit forums. Or at least why they do…

This is something that has been known and done via the move hook since around 2008. I would prefer not using a hook and a timer and just use a move hook.

Server would be more reliable that the client. We don’t trust the client.

Can someone give a snippet using the Move hook? I’m unsure how to implement it and I would like to use it.

[editline]20th May 2015[/editline]

Would cmd rates affect it in any way?

GM/Move, the wiki is bae

I think you could just replace “Tick” with “Move” in the hook.Add(). But why? It’s better (semantically, at least) to do it with tick because what you’re really trying to detect is timing hacks, not speed hacks. People who use actual hacks besides Cheat Engine to cheat will just bypass it anyway. This should be used alongside a proper anti cheat; only effective one I have used is CAC. But this will detect people with a much lower speedhack than a serverside method.

trusting the client is like giving someone $500 who you just met.
also: if you trusted a client so much like this, your gonna have a terrible future programming a server where clients will manipulate any data coming towards them.
but that’s if you don’t change the this attitude of coding.

Also, this will cause issues with client/serverside lag since engine.tickinterval doesn’t scale to framerate and returns a constant value.

Trusting the client is the way to go. There is absolutley no doubt. Why not also make the money system client-side while you’re at it?

This is a very specific question but, Player’s have tick. How often does the SERVER update the client???

I ask because I’m trying to do client-side physics for my game-mode.

It’s difficult for me to tell where the client-side calculations stops, and where the server side calculations begin.

I think the point of this is that it will take out most skids who try to hack. Not EVERYONE knows how to bypass it.

hook.Remove(“Tick”, “noSpeedingTick”)

everyone knows how.

To be honest, renaming the hooks and timers you find online should be your first priority. You don’t just copy paste code from an extremely renowned forum and expect no one to bypass it.

Uh and you can detect and kill an infinite loop with a Lua script.

Before I cheat, all I do is look at clientside code. even if you renamed it I could easily adjust my code to it.

How to stop this clientside speedhack detection in 127 bytes or less

Run this before you speedhack. (example for a 5x speedhack)

local old = engine.TickInterval
local SpeedMultiplier = 5
engine.TickInterval = function()
    return old()/SpeedMultiplier