internal static unsafe T Call <T>(ulong hash, params InputArgument[] arguments)
        {
            NativeTask nativeTask = new NativeTask();

            nativeTask._hash      = hash;
            nativeTask._arguments = arguments;
            ScriptDomain.CurrentDomain.ExecuteTask((IScriptTask)nativeTask);
            return((T)_Module_.GTA__2ENative__2EObjectFromNative(typeof(T), nativeTask._result));
        }
        public void Call(Hash hash, params InputArgument[] arguments)
        {
            var task = new NativeTask();

            task.Hash = (ulong)hash;

            ulong[] args = new ulong[arguments.Length];
            for (int i = 0; i < arguments.Length; ++i)
            {
                args[i] = arguments[i].data;
            }

            task.Arguments = args;

            taskList.Add(task);
        }
Beispiel #3
0
        /// <summary>
        /// Executes a script function inside the current script domain.
        /// </summary>
        /// <param name="hash">The function has to call.</param>
        /// <param name="args">A list of function arguments.</param>
        /// <returns>A pointer to the return value of the call.</returns>
        public static ulong *Invoke(ulong hash, params ulong[] args)
        {
            var domain = ScriptDomain.CurrentDomain;

            if (domain == null)
            {
                throw new InvalidOperationException("Illegal scripting call outside script domain.");
            }

            var task = new NativeTask {
                Hash = hash, Arguments = args
            };

            domain.ExecuteTask(task);

            return(task.Result);
        }