Some natives don't work

Hey there,
atm, I’m trying to build a simple resource to always restore the player’s stamina. So I tried SetPlayerStamina, ChangePedStamina and RestorePedStamina but on all of those I get the error message

SCRIPT ERROR: [...] attempt to call a nil value (global '[...]')

I also tried the native GetTransportPedIsSeatedOn which throws the same error. But Native SetPlayerInvincible works fine, as well as PlayerPedId().
Current client.lua:

Citizen.CreateThread(function()
    local ped2 = PlayerPedId()
    local transport = GetTransportPedIsSeatedOn(ped2)
    print(transport)
    while true do
        SetPlayerInvincible(ped2, true)
        RestorePedStamina(ped2, 100.0)
        Citizen.Wait(1)
    end
end)

Current fxmanifest.lua:

fx_version 'cerulean' 
game 'rdr3'

client_script 'client.lua'
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'

Can someone help me? Did someone experience the same issue and knows how to resolve it?
(I used this reference: RedM Native Reference)

~ Turner

1 Like

If the native doesn’t work, you can use the InvokeNative equivalent.
For example, instead of :

RestorePedStamina(ped2, true)

You have to use it equivalent :

Citizen.InvokeNative(0x675680D089BFA21F, ped2, true)

You can find the equivalent hash in the vespura website : RedM Native Reference