citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.49k stars 2.06k forks source link

Some natives are returning 1 instead of true #2642

Open ahcenezdh opened 2 months ago

ahcenezdh commented 2 months ago

What happened?

I'm pretty sure this thing was already reported, some natives are returning 1 instead of true, i tried with and without lua 5.4 and it's the same

Expected result

Return true instead of 1

Reproduction steps

Here is a small command to test this

RegisterCommand("col", function()
    local isVehicleElectric = Citizen.InvokeNative(0x1FCB07FE230B6639, GetHashKey("cyclone"))
    print(isVehicleElectric)
end, false)

If you try to replace cyclone by adder it will return false (since the vehicle is not electric) You need to be on the build 3258 to use this native

Importancy

Slight inconvenience

Area(s)

Natives

Specific version(s)

8903/Windows

Additional information

This problem is here since a long moment

outsider31000 commented 2 months ago

if you use OAL it should return properly, if you want to test...

ahcenezdh commented 2 months ago

if you use OAL it should return properly, if you want to test...

I tested with OAL and it's the same

outsider31000 commented 2 months ago

then propabably you need to wait for the declaration to be added with proper return

AvarianKnight commented 2 months ago

This isn't a bug, this is for compatibility, a lot of scripts have come to expect natives to function like this and changing the behavior would break a lot of things.

This is also the same for the JS runtime iirc.

outsider31000 commented 2 months ago

specialy for Lua yeah.

thelindat commented 2 months ago

some natives are returning 1 instead of true

They have always worked this way.

I tested with OAL and it's the same

Apparently not.

Add to fxmanifest and refresh.

use_experimental_fxv2_oal 'yes'
lua54 'yes'
ahcenezdh commented 2 months ago

image image

ahcenezdh commented 2 months ago

then propabably you need to wait for the declaration to be added with proper return

Yeah maybe