SolvedInternal Trigger Delay?

Posts 1–5 of 5 · Page 1 of 1
Internal Trigger Delay?
Can you believe it im asking for help?

No, seriously so i have been remaking a cheat from scratch and as i got to the triggerbot i thought i should add a trigger delay because they are nice to have. I though of various ways to approach this if i was external i could use Sleep but as i am internal sleep wont do the trick for me because it just freezes the entire process..

Ive asked around and some people say GetTickCount() is the most benefitial option. I have tried using this in many many different ways to no avail. Would anyone be willing to explain to me how to properly add a delay to a triggerbot internally without freezing the entire process?
@4nuoFZf9aE
Code:
static size_t lastTime = 0;


if (GetTickCount() > lastTime)
{
  //do stuf....
  lastTime = GetTickCount() + thedelayyouwant;
}
You could also use delta time:

Code:
static float time = 0.0f;
time += getDeltaTime(); // Custom function (I think engine->Time() returns delta time(csgo engine))

if (time >= delay) // Note that float 1.0 is 1 second, you should be able to figure out the rest yourself!
{
  // do stuff...
   time = 0;
}

Thats how I did it!

Quote Originally Posted by Yemiez View Post
@4nuoFZf9aE
Code:
static size_t lastTime = 0;


if (GetTickCount() > lastTime)
{
  //do stuf....
  lastTime = GetTickCount() + thedelayyouwant;
}
You could also use delta time:

Code:
static float time = 0.0f;
time += getDeltaTime(); // Custom function (I think engine->Time() returns delta time(csgo engine))

if (time >= delay) // Note that float 1.0 is 1 second, you should be able to figure out the rest yourself!
{
  // do stuff...
   time = 0;
}

Thats how I did it!

I tried the GetTickCount method like you did above and it worked perfectly i was close just was missing a few things here and there thanks for the support.
Quote Originally Posted by 4nuoFZf9aE View Post
I tried the GetTickCount method like you did above and it worked perfectly i was close just was missing a few things here and there thanks for the support.
You're welcome!

Solved!
Use std::chrono for time measurement though.
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us