Assualt Cube Offline Aimbot

Posts 115 of 26 · Page 1 of 2
Assualt Cube Offline Aimbot
100% coded and reversed by me, except the aim function, credits to assualtcube team .
dllmain.cpp
Code:
#include <windows.h>
#include <math.h>
#include "classes_ac.h"

#define PI 3.14159265f
#define RAD 57.29578f

cPlayer * local;
cPlayerTable * pPlayerTable;

float absf(float a)
{
	if(a<0){return -a;}else{return a;}
}

void aim(vec to, vec from, float &yaw, float &pitch) //0-180 pitch, 0-360 yaw
{
	pitch = atan2(to.z - from.z, to.dist(from)) * 180 / PI;
	yaw = -(float)atan2(to.x - from.x, to.y - from.y) / PI * 180 + 180;
}

int target_cross()
{
	int target;
	local = *(cPlayer**)(0x004E4DBC);
	float ty, tp, t_ret;
	float ret = 999;
	pPlayerTable = *(cPlayerTable**)(0x004E4E08);
	int playercount = *(int*)(0x004E4E10);
	for(int i = 0; i < playercount - 1; i++)
	{
		playercount = *(int*)(0x004E4E10);
			aim(pPlayerTable->player[i]->pos, local->pos, ty, tp);
			t_ret = (absf(local->pitch - tp) + absf(local->yaw - ty));
			if(t_ret < ret)
			{
				ret = t_ret; //3
				target = i;
			}
	}
	return target;
}

void aimbot()
{
	local = *(cPlayer**)(0x004E4DBC);
	pPlayerTable = *(cPlayerTable**)(0x004E4E08);
	for(;;)
	{
		if(GetAsyncKeyState(VK_LBUTTON) && *(int*)(0x004E4E10) > 0)
		{
			int target = target_cross();
			if(local->pos.z - pPlayerTable->player[target]->pos.z >= 7.5)
			{
				aim(pPlayerTable->player[target]->footpos, local->pos, local->yaw, local->pitch);
			}
			else
				aim(pPlayerTable->player[target]->pos, local->pos, local->yaw, local->pitch);
		}
	}
}

BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
{
	if( dwReason == DLL_PROCESS_ATTACH )
	{
		CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)aimbot, NULL, NULL, NULL);
	}
	return TRUE;
}
classes_ac.h
Code:
#include <math.h>

class cPlayer;
class cPlayerTable;
struct vec;

struct vec
{
    union
    {
        struct { float x, y, z; };
        float v[3];
        int i[3];
    };

    vec() {}
    vec(float a, float b, float c) : x(a), y(b), z(c) {}
    vec(float *v) : x(v[0]), y(v[1]), z(v[2]) {}

    float &operator[](int i)       { return v[i]; }
    float  operator[](int i) const { return v[i]; }

    bool iszero() const { return x==0 && y==0 && z==0; }

    bool operator==(const vec &o) const { return x == o.x && y == o.y && z == o.z; }
    bool operator!=(const vec &o) const { return x != o.x || y != o.y || z != o.z; }
    vec operator-() const { return vec(-x, -y, -z); }

    vec &mul(float f) { x *= f; y *= f; z *= f; return *this; }
    vec &div(float f) { x /= f; y /= f; z /= f; return *this; }
    vec &add(float f) { x += f; y += f; z += f; return *this; }
    vec &sub(float f) { x -= f; y -= f; z -= f; return *this; }

    vec &add(const vec &o) { x += o.x; y += o.y; z += o.z; return *this; }
    vec &sub(const vec &o) { x -= o.x; y -= o.y; z -= o.z; return *this; }

    float squaredlen() const { return x*x + y*y + z*z; }
    float dot(const vec &o) const { return x*o.x + y*o.y + z*o.z; }

    float magnitude() const { return sqrtf(squaredlen()); }
    vec &normalize() { div(magnitude()); return *this; }

    float dist(const vec &e) const { vec t; return dist(e, t); }
    float dist(const vec &e, vec &t) const { t = *this; t.sub(e); return t.magnitude(); }

    float distxy(const vec &e) const { float dx = e.x - x, dy = e.y - y; return sqrtf(dx*dx + dy*dy); }
    float magnitudexy() const { return sqrtf(x*x + y*y); }

    bool reject(const vec &o, float max) const { return x>o.x+max || x<o.x-max || y>o.y+max || y<o.y-max; }

    vec &cross(const vec &a, const vec &b) { x = a.y*b.z-a.z*b.y; y = a.z*b.x-a.x*b.z; z = a.x*b.y-a.y*b.x; return *this; }

    void rotate_around_z(float angle) { *this = vec(cosf(angle)*x-sinf(angle)*y, cosf(angle)*y+sinf(angle)*x, z); }
    void rotate_around_x(float angle) { *this = vec(x, cosf(angle)*y-sinf(angle)*z, cosf(angle)*z+sinf(angle)*y); }
    void rotate_around_y(float angle) { *this = vec(cosf(angle)*x-sinf(angle)*z, y, cosf(angle)*z+sinf(angle)*x); }

    vec &rotate(float angle, const vec &d)
    {
        float c = cosf(angle), s = sinf(angle);
        return rotate(c, s, d);
    }

    vec &rotate(float c, float s, const vec &d)
    {
        *this = vec(x*(d.x*d.x*(1-c)+c) + y*(d.x*d.y*(1-c)-d.z*s) + z*(d.x*d.z*(1-c)+d.y*s),
                    x*(d.y*d.x*(1-c)+d.z*s) + y*(d.y*d.y*(1-c)+c) + z*(d.y*d.z*(1-c)-d.x*s),
                    x*(d.x*d.z*(1-c)-d.y*s) + y*(d.y*d.z*(1-c)+d.x*s) + z*(d.z*d.z*(1-c)+c));
        return *this;
    }

    void orthogonal(const vec &d)
    {
        int i = fabs(d.x) > fabs(d.y) ? (fabs(d.x) > fabs(d.z) ? 0 : 2) : (fabs(d.y) > fabs(d.z) ? 1 : 2);
        v[i] = d[(i+1)%3];
        v[(i+1)%3] = -d[i];
        v[(i+2)%3] = 0;
    }
};

class cPlayer
{
public:
		char unknown0[4]; //0x0000
	vec pos;
		char unknown16[36]; //0x0010
	vec footpos;
	float yaw; //0x0040  
	float pitch; //0x0044  
};//Size=0x0228(552)


class cPlayerTable
{
public:
	char unknown0[4]; //0x0000
	cPlayer* player[32]; //0x0004  
};//Size=0x043C(1084)
aimstyle is closest to crosshair (visibility check is hard to reverse). you can easily edit it to closest via distance or w/e. i coudlnt find the team in the player class, so it aims at teammates if they are closest to crosshair.

LIKE MY CLEAN CODING ?
Very Nice.
ty ill try to get around to make an online version.




I formatted so I gotta Redownload and test it for ya. (:
ok . the only problem i experienced with it is that when you are looking down onto an enemy, it aims too high. maybe someone with more trig under there belt can fix it. don't expect it to be 100% perfect, because it was my first aimbot and i struggled alot, but i got through it.

oh uhm one more thing, im not sure if it works unless you inject it in-game, ive never tried it without. i coded it usually while i was debugging etc, so if it crashes, inject is in-game and try again.
I just tried. It's working if i inject before the game starts.
ok ty for testing

one thing to make my aimbot better would be to make it aim at the footpos if your z position is like 5 or so many unites greater then the target's Z position.

i just updated it to aim at the footpos if their position is 7.5 less then yours... try the updated code
Quote Originally Posted by kibbles18 View Post
ok ty for testing

one thing to make my aimbot better would be to make it aim at the footpos if your z position is like 5 or so many unites greater then the target's Z position.

i just updated it to aim at the footpos if their position is 7.5 less then yours... try the updated code
It works better now. (:
Would be awesome! If you give us a tutorial on how you did the trig math would love you forever it's to complicated for me to understand the x'y'z and know how 3d works >_< example on how you did the math pwse?
after clicking directly bugtrap ..
need help ..
most of the math concepts are covered in high school geometry class. the important ones being sin, cos, tan.
IsVisible wrapper from UC forum
Code:
bool altVis(vec from,vec to) 
{ 
    static DWORD p = 0x47E780; //v1.1.0.4 
    __asm  
    { 
        push to.z 
        push to.y 
        push to.x 
        push from.z 
        push from.y 
        push from.x 
        xor eax, eax 
        call p 
        add esp, 24 
    } 
}
credits Hanoi22
Works great!
A few minor bugs but I'll fix them
Thanks!
In math class out teacher helped us remember it like this: Some old hippie caught another hippie tripping on acid.
Posts 115 of 26 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?