FetchNativeFromPlayerWithTimeout

From GT-MP
Jump to: navigation, search
FetchNativeFromPlayerWithTimeout
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

Returns a native call's result from the specified player.

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.


Dialog-warning.png Note: This feature is currently not in the API, or is currently not accurate on the wiki due to upcoming API changes. New API functions and changes will be released with the next update.

Syntax

In C#
Server-Side Function

API.fetchNativeFromPlayerWithTimeout<T>(Client player, Hash native, int timeoutMs, params object[], args);
API.fetchNativeFromPlayerWithTimeout<T>(Client player, ulong longHash, int timeoutMs, params object[] args);

Required Arguments

  • T: the type to return.
    • Can be: int, uint, string, float, double, bool
  • player: parameter input should be in Client type.
  • native or longHash: parameter input should be in Hash or ulong type.
  • timeoutMs: parameter input should be in int type.
  • args: parameter input should be in object type.


NOTE: This function returns data in specified type. Return value will be default(T) if the operation times out.

Usage example

In C#
Server-Side Function

API.fetchNativeFromPlayerWithTimeout<T>(Client player, Hash native, int timeoutMs, params object[], args);
API.fetchNativeFromPlayerWithTimeout<T>(Client player, ulong longHash, int timeoutMs, params object[] args);

References