DynamicNativeFunction Class

RAGE Plugin Hook Documentation

[This is preliminary documentation and is subject to change.]

Represents a dynamic object that can be used to invoke natives.

Inheritance Hierarchy


Namespace:  Rage.Native
Assembly:  RagePluginHook (in RagePluginHook.dll) Version: (0.56.1131.11510)

public sealed class DynamicNativeFunction : DynamicObject

The DynamicNativeFunction type exposes the following members.


Public methodTryInvokeMember (Overrides DynamicObjectTryInvokeMember(InvokeMemberBinder, Object, Object).)

Calls made on the dynamic object will be resolved at runtime rather than compile time, so calling any non-existing method on this object will work at compile time, but may fail at runtime. When the code runs, the name of the method will be resolved to a native name. Names can be formatted in two ways. The native's actual name, or its name without underscores, in PascalCase. For example, the two following code snippets will invoke the native STOP_PLAYER_TELEPORT.
Arguments can be passed to natives using traditional method call syntax. Certain types like IHandleables or Player, will be converted to their handle, so it's unnecessary to call Handle on an object:
Rage.Native.NativeFunction.Natives.SET_PLAYER_MODEL(Rage.Game.LocalPlayer, Rage.Game.GetHashKey("PLAYER_ZERO"));
Rage.Native.NativeFunction.Natives.SetPlayerModel(Rage.Game.LocalPlayer, Rage.Game.GetHashKey("PLAYER_ZERO"));
Natives can also be called using their original 64-bit value (a.k.a. hash). To call a native by its hash, begin the method name with x followed by the 64-bit value:
Rage.Native.NativeFunction.Natives.x00A1CADD00108836(Rage.Game.LocalPlayer, Rage.Game.GetHashKey("PLAYER_ZERO"));
If a native returns a value, the return type must be indicated as the first and only generic type argument.
uint vehicleHandle = Rage.Native.NativeFunction.Natives.GetVehiclePedIsTryingToEnter<uint>(Rage.Game.LocalPlayer.Character);
If the native returns a handle to one of the most common IHandleable types (Ped, Vehicle, Object, Blip, Group), the return type can be specified as one of these types, and RAGE Plugin Hook will automatically convert the handle to the specified IHandleable type.
Rage.Vehicle vehicle = Rage.Native.NativeFunction.Natives.GetVehiclePedIsTryingToEnter<Rage.Vehicle>(Rage.Game.LocalPlayer.Character);
See Also