Call

From GTA Network Wiki
Jump to: navigation, search

Call
Server-Side Function

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

Call a method from another class inside your own resource. This is used to avoid creating unnecessary static classes.

Syntax

object NAPI.Resource.Call(Script scriptEngine, string className, string methodName [, params object[] arguments]);

Required Arguments

  • scriptEngine: A class instance which extends Script. Doesn't have to be the instance where the method is getting called. Parameter input should be in Script type.
  • className: The name of the class you are trying to call. Parameter input should be in string type.
  • methodName: The name of the method you are trying to call. Parameter input should be in string type.

Optional Arguments

  • arguments: List of arguments.

NOTE: This function returns null if the method return type is void.

Usage example(s)

class MyClass : Script {
    ...
    NAPI.Resource.Call(this, "myOtherClass", "myCoolMethod", "this is a first argument", "this is a second argument", 12f, 1001);
}

Changelog

Version Description
1.0 Release.