fivem icon indicating copy to clipboard operation
fivem copied to clipboard

Some natives are returning 1 instead of true

Open spacevx opened this issue 1 year ago • 8 comments

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

spacevx avatar Jul 14 '24 13:07 spacevx

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

outsider31000 avatar Jul 14 '24 13:07 outsider31000

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

I tested with OAL and it's the same

spacevx avatar Jul 14 '24 13:07 spacevx

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

outsider31000 avatar Jul 14 '24 13:07 outsider31000

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.

AvarianKnight avatar Jul 14 '24 13:07 AvarianKnight

specialy for Lua yeah.

outsider31000 avatar Jul 14 '24 13:07 outsider31000

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'

thelindat avatar Jul 14 '24 13:07 thelindat

image image

spacevx avatar Jul 14 '24 13:07 spacevx

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

Yeah maybe

spacevx avatar Jul 14 '24 13:07 spacevx

those are called ints, however you can use Citizen.ResultAsBoolean to force it to be a bool, it has always been like that :)

fairplayenthusiast avatar Jan 06 '25 08:01 fairplayenthusiast