GetGameplayCamRot() broken?

Hi,

I’ve been toying with GetGameplayCamRot() today to get the direction of the player cam, but for some reason it only returns a single number, (seems to be X). I would have posted this in the modding discussion board, but it isn’t letting me. If you use GetGameplayCamRot() and expect a table result (x,y,z) it will throw an index error.

Did this function change? It’s the same for GetGameplayCamCoords too, but if you table.unpack that, it works fine.

Would appreciate some insight into this.

Thanks.

Indeed, this seems to be a case of two natives existing with the same name in the documentation data we imported, so it’ll ‘randomly break’ every build update because of non-deterministic sorting of table items in Lua.

http://runtime.fivem.net/doc/reference.html#_0x837765A25378F0BB (the ‘actual’ native)

http://runtime.fivem.net/doc/reference.html#_0x5B4E4C817FCC2DFB (prefixed with _, which gets stripped by script building)

Oddly, both of them should return a vector result. I’m assuming you’re using Lua, so what does print(type(GetGameplayCamRot(2))) show?

Yes, I should have stated I’m using Lua, my apologies.

Console spews “number” when I use your print statement.

Is this on production or on canary? It could be the older native list used in production has one of two versions of the native listed as float, or it could be a regression in canary in that case.

Maybe you could change the name of one of them?

I tested it a bit and it seems like this one always returns the Cam Rotation, even if the game itself moves the Cam, while the player is inactive.

But this one only returns the values when the player moved the cam.

In the latest update, the native with the _ prefix was renamed to have a _2 suffix.

1 Like