From f9b9de0b57a8284d7ea96bb8ccd672b16299b010 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 27 Oct 2025 21:39:13 +0000 Subject: [PATCH] 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 --- shared/_authToken.lua | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/shared/_authToken.lua b/shared/_authToken.lua index abe8ee3..700dd85 100644 --- a/shared/_authToken.lua +++ b/shared/_authToken.lua @@ -137,21 +137,31 @@ function distExploitCheck(table, src) return false end + local maxDist = 10.0 + local nearestDist = 999999.0 + local nearestCoords = nil + local ped = src and GetPlayerPed(src) or PlayerPedId() local srcCoords = GetEntityCoords(ped) - local allow = false 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 - else - allow = false 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") - return false - end + 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 end \ No newline at end of file