_GET_OBJECT_OFFSET_FROM_COORDS returning inconsistent positions

_GET_OBJECT_OFFSET_FROM_COORDS

0x163E252DE035A133 reference link

  1. Client (production/canary) and FXServer version:
    Production & Canary. Any FXServer
  2. What you expected to happen:
    The native should return valid X, Y, Z values (as it has already returning before)
  3. What actually happens:
    Recently, when you use this native, you can receive a vector3 with a valid X value, but with Y & Z positions being zero. Seems like this depends in which values you are using in the offset (see below in the reproducible steps)
  4. Category of bug (eg. client, server, weapons, peds, native):
    Client/Native
  5. Reproducible steps, preferably with example script(s)

print('Incomplete vector3', GetObjectOffsetFromCoords(-448.980438, -303.591949, 34.467052, 35.000015258789, 0.0, 0.0, 0.4))

  • Result: vector3(-448.9804, 0, 0)

print('Complete vector3', GetObjectOffsetFromCoords(-448.980438, -303.591949, 34.467052, 35.000015258789, 0.0001, 0.0, 0.4))

  • Result: vector3(-448.9803, -303.5919, 34.86705)

This problem started somewhere during the last 30 days (maybe 40 days). I’m not sure when this started because i was taking sometime off these days.

1 Like

This reminds me of another report a while ago that a) wasn’t even reproducible and b) was even closed as ‘oh yeah doesn’t happen’ by the author… but I also can’t find that report at all, either.

In this case, however, I have a theory as to what happened - mitigation for this abusive code execution/memory reading ‘anticheat’ thing that likely ended up clearing 2nd/3rd result fields if the first one was marked as ‘equal’. The annoying part here is that we don’t have any reproduction code for the exploit itself at all, so it would be difficult to even find out if, say, a special case of this for result-as-vector cases doesn’t somehow reintroduce the issue for any other case.

1 Like

Fixed: fix(scripting/lua): don't zero out 'equal' vector results · citizenfx/fivem@8d45baa · GitHub

5 Likes

Seems like there’s another way to still achieve the same inconsistency, but now using vector3 instead of numbers as parameters (results in X being zero):

print('Incomplete', GetObjectOffsetFromCoords(vec3(-454.916199, -286.475464, 34.471020), 23.0, vec3(0.0, 0.0, 0.4)))
  • Result: vector3(0, -286.4755, 34.87102)
print('Complete', GetObjectOffsetFromCoords(vec3(-454.916199, -286.475464, 34.471020), 23.0, vec3(0.001, 0.001, 0.4)))
  • Result: vector3(-454.9157, -286.4742, 34.87102)

The first repro provided in the topic is fully fixed. But this one is another way i discovered to achieve the same regression problem.

I… was worried about that case biting back. Will check it out when I can.

1 Like

Seems to be resolved by the latest changeset: fix(scripting/lua): another vector result case · citizenfx/fivem@f6b983b · GitHub

1 Like