Перейти к содержанию

Run

Материал из RAGE MP Wiki Archive
Версия от 10:13, 12 декабря 2019; imported>Bonus (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...")
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

Runs thread-safe API code on main thread.


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

<syntaxhighlight lang="csharp"> NAPI.Chat.SendChatMessageToPlayer(client, "Hello right now."); NAPI.Task.Run(() => {

   NAPI.Chat.SendChatMessageToPlayer(client, "Hello after 5 seconds.");

}, 5000); </syntaxhighlight>