I am not primarily coding in Lua, but I have noticed this for the second time now. I am using a simple native that shouldn’t require any parameters/variables, but somehow it returns with an error that says:
attempt to call nil value (global '<NATIVE>')
It is like my Lua code is trying to reach for a function that does not exist when I am trying to use a native?
I have tried this with InvalidateIdleCam() and one of the StartShapeTestLosProbe() or something. I don’t know what is causing this because sometimes it works in other scripts so maybe I am doing something wrong that I am not aware of.
I have this code where it happens:
local MenuActive = false
function OpenMenu(Type)
ESX.UI.Menu.CloseAll()
local elements = {}
if Type == 'clothingshop' then
SetNuiFocus(true, true)
SendNUIMessage({type = 'bbdClothingshopMenu'})
MenuActive = true
end
end
Citizen.CreateThread(function()
while true do
Wait(1000) --The idle camera activates after 30 second so we don't need to call this per frame
if MenuActive then
InvalidateIdleCam()
N_0x9e4cfff989258472() --Disable the vehicle idle camera
print("Disabling idle cam.")
end
end
end)
This returns an error that says:
attempt to call a nil value (global 'InvalidateIdleCam')
I have also just tried this and this fails as well:
local MenuActive = true
Citizen.CreateThread(function()
while true do
Wait(1000) --The idle camera activates after 30 second so we don't need to call this per frame
if MenuActive then
InvalidateIdleCam()
N_0x9e4cfff989258472() --Disable the vehicle idle camera
print("Disabling idle cam.")
end
end
end)
Comes with the same error:
attempt to call a nil value (global 'InvalidateIdleCam')
What does the function InvalidateIdleCam do? as thats the issue,
@Dutchkiller2000 Not sure what you meant with the above, as you can see its clear that that disables something else, because others don’t have it in their code does not mean he cant have it, how else are people going to be making unique scripts?
if you took the time to actually read the above snippets
N_0x9e4cfff989258472() --Disable the vehicle idle camera
You could see what this does, next time take some time before replying on something u have no clue about.
It was just a suggestion mate. Because the native doesnt have a name or a description on the natives site i thought that may cause the error above because there are no lines given of the error
Exactly, that is what I figured as well. It is like it is trying to call a function, but there are no function called that, it is a FiveM/GTA native that I am trying to call.
But right now I am trying to update the manifest, where can I see the latest manifest version, @TheIndra ?