I found this bit of code that attempts to detect a superjump. The issue with this is that it counts (z) height into it’s jump length so if someone falls off of a building, it considers that a superjump.
Is there a way in which I could modify this to only consider x and y to determine whether a superjump has occurred? I’m failing miserably and handling it. In my head, it makes sense that I’d want to grab the player coords and do some magical math based on the two points but I lose the plot at that point and have been unable to sort out a working example.
--[[ SUPERJUMP CHECK ]]--
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if (AntiCheat == true and whitelisted == false and whiteCheck == false)then
if IsPedJumping(PlayerPedId()) then
local jumplength = 0
repeat
Wait(0)
jumplength=jumplength+1
local isStillJumping = IsPedJumping(PlayerPedId())
until not isStillJumping
if jumplength > 200 then
TriggerServerEvent('AntiCheat:Jump', jumplength )
end
end
end
end
end)
Sorry, I’m bad at math. If someone is jumping diagonally, would I simply x+y? Is there some kind of radius deal I would need to chew on to get it right?
I seem to be failing at integrating the native. No jumps trigger it. My effort tries to set the last nonjump pos , getting the last isjump pos, then comparing the two with the native.
--[[ SUPERJUMP CHECK ]]--
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if (AntiCheat == true and whitelisted == false and whiteCheck == false)then
if not IsPedJumping(PlayerPedId()) then
notjump = GetEntityCoords(GetPlayerPed(-1))
elseif IsPedJumping(PlayerPedId()) then
local isStillJumping = IsPedJumping(PlayerPedId())
local isjump = GetEntityCoords(GetPlayerPed(-1))
until not isStillJumping
print('isjump: ',ESX.DumpTable(isjump))
if GetDistanceBetweenCoords(notjump, isjump, false) < 5 then
print('You triggered superjump')
--TriggerServerEvent('AntiCheat:Jump', jumplength )
end
end
end
end
end)
while true do
Wait(0)
if IsPedJumping(PlayerPedId()) then
local firstCoord = ...
while IsPedJumping () do
Wait (0)
end
local secondCoords = ...
local distance = ...
if distance > 10.0 then
...
end
end
I guess doing so may work. Can’t help much I’m on phone (you will have to fill the code but I hope you get the idea).
Citizen.CreateThread(function()
while true do
Wait(0)
if (AntiCheat == true and whitelisted == false and whiteCheck == false) then
if IsPedJumping(PlayerPedId()) then
local firstCoord = GetEntityCoords(GetPlayerPed(-1))
while IsPedJumping(PlayerPedId()) do
Wait (0)
end
local secondCoord = GetEntityCoords(GetPlayerPed(-1))
local jumplength = GetDistanceBetweenCoords(firstCoord, secondCoord, false)
if jumplength > 10.0 then
print('You triggered superjump')
TriggerServerEvent('AntiCheat:Jump', jumplength )
end
end
end
end
end)