FetchNativeFromPlayer

From GTA Network Wiki
Jump to: navigation, search

FetchNativeFromPlayer
Server-Side Function

utilities-terminal.png Server-Side csharp.png C#

This function returns data from a Native call.


icon-warning.png WARNING: This function is synchronous and could take a long time to return. Do not use this if your resource is not multithreaded.

If you know what you're doing and want to use this function anyway, consider reading Meta.xml for more information about multithreaded resources.


Syntax

T NAPI.Native.FetchNativeFromPlayer<T>(Client player, ulong/Hash longHash [, params object[] args ]);

Required Arguments

  • T: the type to return. This can be any of these: int, uint, string, float, double, bool.
  • player: parameter input should be in Client type.
  • longHash: parameter input should be in ulong or Hash type.

Optional Arguments

  • args: optional arguments, can be of every type.

NOTE: This function returns the native data.

Usage example

int ammoCount = NAPI.Native.FetchNativeFromPlayer<int>(sender, Hash.GET_AMMO_IN_PED_WEAPON, sender.handle, WeaponHash.SMG);

Changelog

Version Description
1.0 Release.

References

http://www.dev-c.com/nativedb/

https://cdn.rage.mp/public/natives/