FiveM version: Canary
Client side GetZoneAtCoords native is behaving like it’s caching the results of the Native.
What I expect to happen:
GetZoneAtCoords providing unique/correct results when called.
What happens instead:
Code example:
RegisterCommand('zoneTest', function()
print(1, GetZoneAtCoords(-2956.87, 483.47, 14.73)) -- Should return 494 (correct)
print(1, GetZoneAtCoords(-2956.57, 481.7, 14.75)) -- Should return 494 (correct)
print(1, GetZoneAtCoords(-2960.176, 479.0105, 15.97156)) -- Should return 494 (correct)
print(1, GetZoneAtCoords(-2964.697, 476.386, 16.01)) -- Should return 82 (actually returns 494)
end)
If you add Wait between function calls you will receive correct information:
RegisterCommand('zoneTest', function()
print(1, GetZoneAtCoords(-2956.87, 483.47, 14.73)) -- Returns 494
Wait(500)
print(1, GetZoneAtCoords(-2956.57, 481.7, 14.75)) -- Returns 494
Wait(500)
print(1, GetZoneAtCoords(-2960.176, 479.0105, 15.97156)) -- Returns 494
Wait(500)
print(1, GetZoneAtCoords(-2964.697, 476.386, 16.01)) -- Returns 82
end)
```
Also, additionally - it looks like the result is "cached" globally, and rewrites all returns from that native, so if you run this while there is other script running in parallel - the other script will also be "affected"