Run

From RAGE Multiplayer Wiki
Revision as of 10:13, 12 December 2019 by Bonus (talk | contribs) (Created page with "Runs thread-safe API code on main thread. {{CSharpContainer| {{#tag:pre|void {{Template:CSharp_Serverside_namespace}}Task.Run(Action task, [long delayTime = 0]);}} {{Paramete...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Runs thread-safe API code on main thread.


C# Syntax

void NAPI.Task.Run(Action task, [long delayTime = 0]);

Parameters

  • task: the action to execute. Parameter input should be in Action type
  • delayTime: delay time in milliseconds until the action gets executed. Parameter input should be in long type

Example

NAPI.Chat.SendChatMessageToPlayer(client, "Hello right now.");
NAPI.Task.Run(() => 
{
    NAPI.Chat.SendChatMessageToPlayer(client, "Hello after 5 seconds.");
}, 5000);