Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 0.91 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <windows.h>
  2.  
  3. const int PRESS_BASE = 400;
  4. const int PRESS_INCREMENT = 150;
  5. const int PRESS_INCREMENT_INTERVAL = 4000; // != 0 !!!
  6.  
  7. const int WAIT_BASE = 200;
  8. const int WAIT_INCREMENT = 0;
  9. const int WAIT_INCREMENT_INTERVAL = 500; // != 0 !!!
  10.  
  11. //basketball
  12. void main()
  13. {
  14.         int startTime = -1;
  15.         while(true)
  16.         {
  17.                 if(GetAsyncKeyState(VK_RCONTROL))
  18.                 {
  19.                         if(startTime == -1)
  20.                                 startTime = GetTickCount();
  21.  
  22.                         int runtime = GetTickCount() - startTime;
  23.  
  24.                         INPUT ip;
  25.                         ZeroMemory(&ip,sizeof(INPUT));
  26.                         ip.type = INPUT_KEYBOARD;
  27.                         ip.ki.wVk = VK_SPACE;
  28.                         SendInput(1,&ip,sizeof(INPUT));
  29.                         Sleep( PRESS_BASE + (runtime/PRESS_INCREMENT_INTERVAL) * PRESS_INCREMENT);
  30.                         ip.ki.dwFlags |= KEYEVENTF_KEYUP;
  31.                         SendInput(1,&ip,sizeof(INPUT));
  32.          
  33.                         runtime = GetTickCount() - startTime;
  34.                         Sleep( WAIT_BASE + (runtime/WAIT_INCREMENT_INTERVAL) * WAIT_INCREMENT);
  35.                 }
  36.                 else
  37.                         startTime = -1;
  38.         }
  39. }