jeudi 26 juillet 2018

C# Generate and execute random delay between tasks

I have this code here:

                        #region BunnyHop

                    bool bLocalIsOnGround = pLocal.IsOnGround();

                    if (bMouseEnabled && Config.MiscEnabled && Config.bBunnyHopEnabled && IsKeyState(Config.iBunnyHopKey) && pLocal.GetVelocity() > 45f)
                    {
                        if (bLocalIsOnGround)

                        g_pEngineClient.PlusJump();
                        else if (g_pEngineClient.GetJumpState() == 5)
                            g_pEngineClient.MinusJump();
                    }
                    #endregion

And I am looking to add a randomly generated delay like this:

                    {
                        if (bLocalIsOnGround)
                        //RANDOM DELAY HERE BETWEEN 0 AND 10  MS
                        g_pEngineClient.PlusJump();
                        else if (g_pEngineClient.GetJumpState() == 5)
                            g_pEngineClient.MinusJump();
                    }
                    #endregion

I have tried thread.delay and rest, neither are working properly. And help is appreciated.




Aucun commentaire:

Enregistrer un commentaire