[Debug How-To] Help! The native I’m calling won’t execute!
If a native you’re calling doesn’t seem to be doing anything in-game, you can check to see what the parameters require through the native documentation .
Here’s an example below using AddBlipForRadius and ClearPedProp
-- ADD_BLIP_FOR_RADIUS
local retval --[[ Blip ]] =
AddBlipForRadius(
posX --[[ number ]],
posY --[[ number ]],
posZ --[[ number ]],
radius --[[ number ]]
)
Since it defines the parameter for posX as a “number” (float, double, all fall under this) you would need to use a decimal place number like 0.0.
-- CLEAR_PED_PROP
ClearPedProp(
ped --[[ Ped ]],
propId --[[ integer ]]
)
Since propId is defined as a “integer”, you would need to use a flat number like 0.
I already checked my parameters, they’re the right type!
It could be a result of a undefined or incorrect variable being passed through to the native function call.
Here’s an example of how a native with the correct parameters could fail:
local ped = GetPlayerPed(player)
ClearPedTasksImmediately(ped)
This doesn’t work, why is that?
In this case, it’s because the variable being passed through (player) is undefined.
We can fix this by defining the player variable prior to the calling of the GetPlayerPed native function.
local player = PlayerId()
local ped = GetPlayerPed(player)
ClearPedTasksImmediately(ped)
With that, if you’re still having issues - feel free to make a post in the FiveM Modification Help section.
Have a great time developing your mods!