mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Make distExploitCheck() more verbose
When accessing a shop or stash will now attempt to print the nearest coordinates it can find and how far the player is from it This is more a debugging thing
This commit is contained in:
@@ -137,21 +137,31 @@ function distExploitCheck(table, src)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local maxDist = 10.0
|
||||||
|
local nearestDist = 999999.0
|
||||||
|
local nearestCoords = nil
|
||||||
|
|
||||||
local ped = src and GetPlayerPed(src) or PlayerPedId()
|
local ped = src and GetPlayerPed(src) or PlayerPedId()
|
||||||
local srcCoords = GetEntityCoords(ped)
|
local srcCoords = GetEntityCoords(ped)
|
||||||
local allow = false
|
|
||||||
|
|
||||||
for i = 1, #table do
|
for i = 1, #table do
|
||||||
if #(table[i].xy - srcCoords.xy) <= 10 then
|
|
||||||
|
local dist2d = #(table[i].xy - srcCoords.xy)
|
||||||
|
|
||||||
|
-- Track the nearestDist
|
||||||
|
if dist2d < nearestDist then
|
||||||
|
nearestDist = dist2d
|
||||||
|
nearestCoords = table[i]
|
||||||
|
end
|
||||||
|
|
||||||
|
if dist2d <= maxDist then
|
||||||
|
debugPrint("^1Found location^7: ^3"..nearestDist.." ^7away from player - "..formatCoord(nearestCoords))
|
||||||
return true
|
return true
|
||||||
else
|
|
||||||
allow = false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not allow then
|
print(src and ("^1Src ^3"..src.." ") or "", "^1Tried to open a registered shop/stash from over the distance limit^7")
|
||||||
print(src and ("^1Src ^3"..src.." ") or "", "^1Tried to open a registered shop/stash from over the distance limit^7")
|
print("^1Nearest Possible Location^7: ^3"..nearestDist.." ^7away from player - "..formatCoord(nearestCoords))
|
||||||
return false
|
return false
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user