Utilizing Citizen.InvokeNative to replace a missing getter for SetVehicleTowTruckArmPosition

I want to replace the non existent native GetVehicleTowTruckArmPosition which is the getter of SetVehicleTowTruckArmPosition. I don’t understand how Citizen.InvokeNative works at all but it looks like a powerful tool that may fix my issue. How does it work? Is there something ready for my existing issue?

1 Like

What is the Citizen.InvokeNative

The Citizen.InvokeNative invokes a native from a hex.

is like the functions that we have in lua, actually functions like SetVehicleTowTruckArmPosition underneath execute the Citizen.InvokeNative.

How do I say this?
Just open the following directory C:\Users\<your_account>\AppData\Local\FiveM.app\citizen\scripting\lua and you will find all the files that contain the native, so if we open the file natives_21E43A33.lua we will find a list of the various natives with their respective hexes

At the top of the file whe have the _in defined like the Citizen.InvokeNative

And if whe search the SetVehicleTowTruckArmPosition

image

As you can see it’s simply a Citizen.InvokeNative. so actually FiveM helped us by creating these functions to be able to write in an easier way, otherwise we would have had to call the respective hex each time with Citizen.InvokeNative!


Probably this native could help you to find the offset of the tow truck arm

2 Likes

Couldn’t figure it out, how to associate an HEX with the implied name of what the hex does?

However this function was born maybe for others to use:


function IsVehicleTowTruck(vehicle)
	local bone = GetEntityBoneIndexByName(vehicle, "tow_arm")
	
	return bone ~= -1
end