Jump to content

[C++] Game spammer

- - - - -

  • Please log in to reply
No replies to this topic

#1
Muted

Muted

    Learning Programmer

  • Members
  • PipPipPip
  • 86 posts
Hello, I wrote this approx. a year ago. It works with pretty much all DirectX driven games.
If it works for you, great. If not, don't worry about it.

#include <iostream>

#include <windows.h>

using namespace std;


int SpamNumber = 1000;

int SpamDelay = 100;

char *Game = "Brood War";

HWND hwnd = FindWindow(0, Game);


char *Message[] = {

    "\nTHE EPICLY AMAZING -- |               <| -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |              <>| -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |             <><| -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |            <>< | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |           <><  | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |          <><   | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |         <><    | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |        <><     | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |       <><      | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |      <><       | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |     <><        | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |    <><         | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |   <><          | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |  <><           | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- | <><            | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |<><             | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |><              | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |<               | -- OLYMPIC FISH!!\n",

    "\nTHE EPICLY AMAZING -- |                | -- OLYMPIC FISH!!\n"

};


void GameCheck();

void PressButton(HWND, BYTE);

void TypeText(HWND, char[]);

void SpamGame(HWND);


int main() {


    while (true) {

        Sleep(500);


        GameCheck();

        if (GetAsyncKeyState(VK_HOME)) { SpamGame(hwnd); }

        if (GetAsyncKeyState(VK_END)) { break; }

    }


    return 0;

}


void GameCheck() {


    if (!FindWindow(0, Game)) { MessageBox(0, "Game Window not found", " ", 0); exit(0); }


    return;

}


void PressButton(HWND hwnd, BYTE vk) {


    SendMessage(hwnd, vk, WM_KEYDOWN, 0);

    PostMessage(hwnd, WM_CHAR, vk, 0);

    SendMessage(hwnd, vk, WM_KEYUP, 0);


    return;

}


void TypeText(HWND hwnd, char String[]) {


     for (int x = 0; String[x] != 0; x++) { PressButton(hwnd, String[x]); }


     return;

}


void SpamGame(HWND hwnd) {


    int maxMessages = (sizeof Message) / (sizeof Message[0]);


    for (int x = 0; x <= SpamNumber; x++) {

        cout << "ITERATION: " << x << " out of: " << SpamNumber << endl;

        if (GetAsyncKeyState(VK_INSERT)) { break; } /* Pause execution */


        for (int NUMBER = 0; NUMBER < maxMessages; NUMBER++) {

            if (GetAsyncKeyState(VK_END)) { return; } /* Exit prematurely */

            TypeText(hwnd, Message[NUMBER]);

            Sleep(SpamDelay);

        }

    }


    return;

}

Welcome, hope it helps somebody (learn if nothing else).
“You may be disappointed if you fail, but you are doomed if you don't try.”
- Beverly Sills




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users