------------------------------------------
#include "hacks.h";
/*--------------Colour RELATED VARS-------------------*/
int MenuIndex = 0;
// Create a colour for the text
D3DCOLOR fontRed = D3DCOLOR_ARGB(255, 255, 0, 0);
D3DCOLOR fontGreen = D3DCOLOR_ARGB(255, 0, 255, 0);
D3DCOLOR fontBlue = D3DCOLOR_ARGB(255, 0, 42, 255);
D3DCOLOR fontWhite = D3DCOLOR_ARGB(255, 255, 255, 255);
D3DCOLOR fontBlack = D3DCOLOR_ARGB(255, 0, 0, 0);
/*---------------------------------------------------*/
void Hacks::CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont)
{
D3DXCreateFont( d3dDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
choiceFont.c_str(), &m_font );
}
void Hacks::InitializeMenuItems()
{
hack[ESP_BOX_NAME].name = "ESP Box";
hack[ESP_HEALTH].name = "ESP Health";
hack[ESP_DISTANCE].name = "ESP Name + Distance";
hack[SNAP_LINE].name = "Snap Line";
hack[AIMBOT_HK].name = "Aimbot[Mouse 2]";
hack[HIDE_MENU].name = " Hide hack [INSERT]";
//make the hack visible by default
hack[HIDE_MENU].on = false; //shows hack by default
}
void Hacks::DrawMenu(IDirect3DDevice9 *d3dDevice)
{
if(!hack[HIDE_MENU].on)
{
//Add game name here, and put border around it
Drawing::DrawFilledRect( 55, 20, 200, 50, fontBlue, d3dDevice );
Drawing::DrawBorderBox(55, 20, 200, 50, 4, fontBlack, d3dDevice );
Drawing::Draw_Text("COD 4 MP hack", 190, 30, fontWhite, m_font);
//draw back of our hack, transparent black
Drawing::DrawFilledRect( 30, 55, 250, (62*MAX_MENU_ITEMS),fontBlue, d3dDevice );
//draw hack border
Drawing::DrawBorderBox(30, 55, 250, (62*MAX_MENU_ITEMS), 6/*was 6*/, fontBlack, d3dDevice );
//Reset our time and update the text again in 2 secs
int y = 40;
for(int i = 0; i < MAX_MENU_ITEMS; i ++)
{
//Draw each box's back colour, this will be based on whether the hack is on e.g.
//red means off and green means on
Drawing::DrawFilledRect( 45, 30+y, 220, 40, hack[i].on ? fontGreen : fontRed, d3dDevice );
//draw box Around Each hack item If the item is highlighted it will show with a white border
Drawing::DrawBorderBox(45, 30+y, 220, 40, 4, fontBlack, d3dDevice );
//draw White border to show the user which hack item is currently selected
if(MenuIndex == i)
{
Drawing::DrawBorderBox(41, 26+y, 228, 48, 4, fontWhite, d3dDevice );
}
//Ternary at its finest, if the hack is on we display the text colour in green
//otherwise its green
//Draw_Text(hack[i].KeyAssigned.c_str(), 160 , 32+y, fontWhite);
Drawing::Draw_Text(hack[i].name.c_str(), 170 , 39+y, fontBlack, m_font);
//Draw_Text(hack[i].state. c_str(), 355 , 32+y, hack[i].on ? fontGreen : fontRed);
//used to position the next item below by 30 height units
y+= 50;
}
Drawing::Draw_Text("Select using arrow keys", 170, ((62*MAX_MENU_ITEMS)+7), fontWhite, m_font);
Drawing::Draw_Text("Turn ON/OFF [END] key", 170, ((62*MAX_MENU_ITEMS)+27), fontWhite, m_font);
}
}
void Hacks::KeyboardInput()
{
if(GetAsyncKeyState(VK_UP)&1)
{
if(MenuIndex > 0)
{
MenuIndex--;
}
}
if(GetAsyncKeyState(VK_DOWN)&1)
{
if(MenuIndex < MAX_MENU_ITEMS-1)
{
MenuIndex++;
}
}
if(GetAsyncKeyState(VK_END)&1)
{
hack[MenuIndex].on = !hack[MenuIndex].on;
if(MenuIndex == ESP_DISTANCE)
{
//this is where we write memory, these are nop values
}
if(MenuIndex == SNAP_LINE)
{
//this is where we write memory
}
}
if(GetAsyncKeyState(VK_INSERT)&1)
{
//TEXT DOESNT CHANGE as the hack is either hidden or not
//and if its hidden you cant tell the user to turn hack on(at least we wont)
hack[HIDE_MENU].on = !hack[HIDE_MENU].on;
}
}
---------------------------------
#pragma once
#include <Windows.h>
#include "d3d9.h"
#include <ctime> //for the clock
#include "Drawing.h"
#include <iostream>
#include <math.h>
#include <algorithm> //USED FOR OUR SORTING ALGORITHM
#define D3DHOOK_TEXTURES //comment this to disable texture hooking
#define MAX_MENU_ITEMS 6 //so you limit up to make sure everything else run smoothly
//MOVE THESE to the top
//these are just examples you can do your own
#define ESP_BOX_NAME 0
#define ESP_HEALTH 1
#define ESP_DISTANCE 2
#define SNAP_LINE 3
#define AIMBOT_HK 4
#define HIDE_MENU 5
class Hacks
{
public:
int m_Stride;
/*Function prototypes*/
void Hacks::CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont);
void Hacks::InitializeMenuItems();
void Hacks::DrawMenu(IDirect3DDevice9 *d3dDevice);
void Hacks::KeyboardInput();
//our colours For the chams textures
//Spetznas and opfor
LPDIRECT3DTEXTURE9 texRed;
LPDIRECT3DTEXTURE9 texGreen;
//Marines and SAS
LPDIRECT3DTEXTURE9 texBlue;
LPDIRECT3DTEXTURE9 texWhite;
//used to get window size and other info
D3DVIEWPORT9 g_ViewPort;
//our font
LPD3DXFONT m_font;
//everything each hack needs bay bay
struct d3dMenuHack
{
bool on;
std::string name;
};
d3dMenuHack hack[MAX_MENU_ITEMS];
};
//We send these over to see whether we turn something on or not
struct ESP_Options
{
bool box_Plus_Name;
bool health;
bool distance;
bool snapLine;
bool aimbot;
};
-------------------------------------
#include "I_O.h"
std::string I_O::IntToString(int number)
{
std::stringstream ss;//create a stringstream
ss << number;//add number to the stream
return ss.str();//return a string with the contents of the stream
}
std::string I_O::FloatToString(float number)
{
//Round our number down
number = floorf(number);
std::stringstream ss;
ss << number;
return ss.str();
}
#include <iostream>
#include <Windows.h>
#include <sstream>
#include <string>
static class I_O
{
public:
static std::string IntToString(int number);
static std::string CharToString(char * text, int length);
static std::string FloatToString(float number);
};
----------------------------------------------------------
#include <windows.h>
#include <fstream>
#include <stdio.h>
using namespace std;
#include "main.h"
#include "d3d9.h"
//Globals
ofstream ofile;
char dlldir[320];
bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(hDll);
HMODULE hMod = LoadLibrary("d3d9.dll");
oDirect3DCreate9 = (tDirect3DCreate9)DetourFunc(
(BYTE*)GetProcAddress(hMod, "Direct3DCreate9"),
(BYTE*)hkDirect3DCreate9,
5);
return true;
}
return false;
}
void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
{
BYTE *jmp = (BYTE*)malloc(len+5);
DWORD dwback;
VirtualProtect(src, len, PAGE_READWRITE, &dwback);
memcpy(jmp, src, len); jmp += len;
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
src[0] = 0xE9;
*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
VirtualProtect(src, len, dwback, &dwback);
return (jmp-len);
}
bool RetourFunc(BYTE *src, BYTE *restore, const int len)
{
DWORD dwback;
if(!VirtualProtect(src, len, PAGE_READWRITE, &dwback)) { return false; }
if(!memcpy(src, restore, len)) { return false; }
restore[0] = 0xE9;
*(DWORD*)(restore+1) = (DWORD)(src - restore) - 5;
if(!VirtualProtect(src, len, dwback, &dwback)) { return false; }
return true;
}
#define WIN32_LEAN_AND_MEAN
#ifndef _MAIN_H
#define _MAIN_H
//char *GetDirectoryFile(char *filename);
//void __cdecl add_log (const char * fmt, ...);
void *DetourFunc(BYTE *src, const BYTE *dst, const int len);
bool RetourFunc(BYTE *src, BYTE *restore, const int len);
#endif
-----------------------------------------------------------------------------
#pragma once
#include <math.h>
//Here is our vector, makes things easier when dealing with coordinates
class Vect3d
{
public:
float x;
float y;
float z;
Vect3d(float _x, float _y, float _z)
{
x = _x;
y = _y;
z = _z;
}
Vect3d()
{
}
float length()
{
return (float)sqrt(x * x + y * y + z * z);
}
float dotproduct(Vect3d dot)
{
return (x * dot.x + y * dot.y + z * dot.z);
}
};
struct Color
{
public:
short R;
short G;
short B;
Color()
{
}
Color(short r, short g, short b)
{
R = r;
G = g;
B = b;
}
};
//Here we store the actual contents of the memory addresses usually within "PlayerData" we
//will use this just before calling the aimbot to put our player's data and the enemies at use
//e.g. find how far the enemy is from us
class PlayerDataVec
{
public:
float xMouse;
float yMouse;
int isValid;
float xPos;
float yPos;
float zPos;
int isAlive;
int clientNum;
Color color;
char name[16];
int pose;
int team;
bool visible;
int isInGame;
int health;
Vect3d VecCoords()
{
Vect3d vec(xPos, yPos, zPos);
return vec;
}
};
1 comentários:
Clique aqui para comentáriosGalera no final de semana tem tutorial no Canal programador GB tirando a duvida sobre o assunto
Fora de tópico Mostrar Código Esconder Código Mostrar EmoticonEsconder Emoticon