Jump to content
RAGE Multiplayer Community

Recommended Posts

Everytime game crashes if client-side C# code includes `Task` with `async`, `await` operators.

 

How can I wait a long processing task or how to wait X miliseconds in a thread?

---

 

For example:

 

public class InputTest : Events.Script
    {
        public InputTest()
        {
            Input.Bind(RAGE.Ui.VirtualKeys.F2, true, HandleF2Button);
        }

        private void HandleF2Button()
        {
            Chat.Output("F2 pressed. See you in 5 seconds");

            Task.Factory.StartNew(async () =>
            {
                await Task.Delay(5000);
                Chat.Output("Hello from 5 seconds later...");
            });
        }
    }

 

 

Edited by enisn
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...