Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some natives are returning 1 instead of true #2642

Open
ahcenezdh opened this issue Jul 14, 2024 · 8 comments
Open

Some natives are returning 1 instead of true #2642

ahcenezdh opened this issue Jul 14, 2024 · 8 comments
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action

Comments

@ahcenezdh
Copy link
Contributor

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

@ahcenezdh ahcenezdh added bug triage Needs a preliminary assessment to determine the urgency and required action labels Jul 14, 2024
@outsider31000
Copy link

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

@ahcenezdh
Copy link
Contributor Author

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

I tested with OAL and it's the same

@outsider31000
Copy link

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

@AvarianKnight
Copy link
Contributor

AvarianKnight commented Jul 14, 2024

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
Copy link

specialy for Lua yeah.

@thelindat
Copy link
Contributor

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
Copy link
Contributor Author

image
image

@ahcenezdh
Copy link
Contributor Author

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

Yeah maybe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

4 participants