Speed hacks can be solved by setting entity max speed to 7.4 which is around the max speed you can run. As I was trying to create a sort of anticheat and figured this out, tried both an external menu and scripthook menu and neither could bypass this. I believe it only has to be set on spawn/respawn
Citizen.CreateThread(function()
while true do
Wait(30000)
TriggerServerEvent("anticheat:timer")
end
end)
Citizen.CreateThread(function()
while true do
Wait(0)
if GetEntityHealth(GetPlayerPed(-1)) > 200 or Citizen.InvokeNative(0x9483AF821605B1D8, GetPlayerPed(-1)) > 100 then
TriggerServerEvent("anticheat:kick")
end
end
end)
Server side
Users = {}
RegisterServerEvent("anticheat:timer")
AddEventHandler("anticheat:timer", function()
if Users[source] then
if (os.time() - Users[source]) < 25 then
DropPlayer(source, "Speedhack")
else
Users[source] = os.time()
end
else
Users[source] = os.time()
end
end)
AddEventHandler('playerDropped', function()
if(Users[source])then
Users[source] = nil
end
end)
RegisterServerEvent("anticheat:kick")
AddEventHandler("anticheat:kick", function()
DropPlayer(source, "Hacker")
end)