Aimbot lags when pressing

Posts 1–3 of 3 · Page 1 of 1
Aimbot lags when pressing
so everytime i press the set key to use aimbot my fps seems to drop from about 90 to 15-20, making it unplayable? Would any one be able to help

My code (very messy sorry)
Code:
#ifndef AIMBOT_H
#define AIMBOT_H
#define _USE_MATH_DEFINES

#include "Vector.h"
#include "Engine.h"
#include "Settings.h"
  
#include <math.h>

  
class Aimbot {

public:
	void run() {
		  
		float bestdistance = 9999;
		int target = -1;
		bool visycheck;
		if (Settings()->vischeck == 1) {
			  
			visycheck = false;
		} else {
			  
			visycheck = true;
		}
		  
		float psmooth = Settings()->psmo;
		float ysmooth = Settings()->ysmo;
		if (psmooth < 1.f || ysmooth < 1.f) {
			  
			psmooth = 1.f;
			ysmooth = 1.f;
		}
		float paura = Settings()->paur;
		float yaura = Settings()->yaur;
		if (paura < 1.f || yaura < 1.f) {
			paura = 1.f;
			yaura = 1.f;
		}
		float checkx = paura;
		float checkxtwo = paura * -1.f;
		float checky = yaura;
		float checkytwo = yaura * -1.f;
		  
		Vector diff;
		while (true) {
			if (Settings()->aimbotEnabled)
			if (Engine()->me.team > 1 && Engine()->me.team < 4 && Engine()->me.hp > 0) {
				  
				DWORD dwPlayerz = Engine()->Memory()->Read<DWORD>(Engine()->getClientModule()->dwBase + Engine()->Offsets()->dwLocalPlayer);
				DWORD dwEnginez = Engine()->Memory()->Read<DWORD>(Engine()->getEngineModule()->dwBase + Engine()->Offsets()->dwEnginePointer);
				int localid = Engine()->Memory()->Read<int>(dwPlayerz + Engine()->Offsets()->dwId);
				if (GetAsyncKeyState(Settings()->aimas_key) & 0x8000) {
					Vector mypunch = Engine()->Memory()->Read<Vector>(dwPlayerz + Engine()->Offsets()->dwVecPunch);
					Vector curangl,stableang = Engine()->Memory()->Read<Vector>(dwEnginez + Engine()->Offsets()->dwSetViewAngle);
					Vector myPos = Engine()->Memory()->Read<Vector>(dwPlayerz + Engine()->Offsets()->dwVecOrigin);
					Vector myOrig = Engine()->Memory()->Read<Vector>(dwPlayerz + Engine()->Offsets()->dwVecViewOffset);
					for (int i = 0; i < Engine()->iEnemies; i++) {
						  
						if (Engine()->entEnemies[i].is_dormant || Engine()->me.team == Engine()->entEnemies[i].team && Engine()->entEnemies[i].hp < 1) {
							
						}
						Vector testanga,testangb = Engine()->Memory()->Read<Vector>(dwEnginez + Engine()->Offsets()->dwSetViewAngle);
						calcFov(myPos, Engine()->entEnemies[i].position, testanga, mypunch, myOrig);
						diff.x = testanga.x - testangb.x;
						diff.y = testanga.y - testangb.y;
						clampAngles(diff);
						diff.y = fabs(diff.y);
						float idistance = calcDist(myPos, Engine()->entEnemies[i].position);
						Engine()->entEnemies[i].fovx = sin(diff.x * (M_PI / 180)) * idistance;
						Engine()->entEnemies[i].fovy = sin(diff.y * (M_PI / 180)) * idistance;
						int tempmask = Engine()->Memory()->Read<int>(Engine()->entEnemies[i].dwBase + Engine()->Offsets()->dwSpottedByMask);
						int pid = localid - 1;
						if (diff.y < 130.f && Engine()->entEnemies[i].fovy < checky && Engine()->entEnemies[i].fovy > checkytwo && Engine()->entEnemies[i].fovx > checkxtwo && Engine()->entEnemies[i].fovx < checkx && Engine()->entEnemies[i].fovx != 0 && Engine()->entEnemies[i].fovy != 0) {
							if (!Engine()->entEnemies[i].is_dormant && Engine()->me.team != Engine()->entEnemies[i].team && Engine()->entEnemies[i].hp > 0 && ((tempmask & (0x1 << pid)) != 0 || visycheck)) {
								float vectorlength = sqrt(Engine()->entEnemies[i].fovy*Engine()->entEnemies[i].fovy + Engine()->entEnemies[i].fovx*Engine()->entEnemies[i].fovx);
								if (vectorlength < bestdistance) { 
									bestdistance = vectorlength;
									target = i;
								}  
							}
						}  
					}
					if (Engine()->entEnemies[target].hp < 1 || Engine()->entEnemies[target].hp > 10000000 || Engine()->entEnemies[target].is_dormant || target == -1 || Engine()->entEnemies[target].fovy > checky || Engine()->entEnemies[target].fovy < checkytwo || Engine()->entEnemies[target].fovx < checkxtwo || Engine()->entEnemies[target].fovx > checkx) {
						  
						target = -1;
						bestdistance = 9999;
						continue;
					}
					if (Engine()->me.weapon_ammo == 0) {
						continue;
					}

					calcAng(myPos, Engine()->entEnemies[target].position, curangl, mypunch, myOrig);

					Vector randomname;
					randomname.x = curangl.x - stableang.x;
					randomname.y = curangl.y - stableang.y;
					randomname.z = 0.f;

					clampAngles(randomname);
					randomname.x = stableang.x + randomname.x / psmooth;
					randomname.y = stableang.y + randomname.y / ysmooth;
					clampAngles(randomname);
					Engine()->Memory()->Write<Vector>(dwEnginez + Engine()->Offsets()->dwSetViewAngle, randomname);
					  
				} else {
					  
					bestdistance = 9999;
					target = -1;
				}
				  
			}
			  
			Sleep(1);
			  
		}
	}

private:
	void clampAngles(Vector &angles) {
		
		if (!std::isfinite(angles.x)) {
			angles.x = 0;
		}

		if (!std::isfinite(angles.y)) {
			angles.y = 0;
		}

		while (angles.y < -180.0f) angles.y += 360.0f;

		while (angles.y > 180.0f) angles.y -= 360.0f;

		if (angles.x > 89.0f) angles.x = 89.0f;

		if (angles.x < -89.0f) angles.x = -89.0f;

		angles.z = 0;
		  
	}
	void calcAng(Vector &src, Vector &dst, Vector &viewAngl, Vector &mpnch, Vector &myOrig) {
		float delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z + myOrig.z - dst.z) };
		float hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
		viewAngl.x = atanf(delta[2] / hyp) * (180 / M_PI) - mpnch.x * 2.f;
		viewAngl.y = atanf(delta[1] / delta[0]) * (180 / M_PI) - mpnch.y * 2.f;
		viewAngl.z = 0.0f;
		if (delta[0] >= 0.0) {
			viewAngl.y += 180.0f;
		}
		  
	}
	void calcFov(Vector &src, Vector &dst, Vector &viewAngl, Vector &mpnch, Vector &myOrig) {
		  
		float delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z + myOrig.z - dst.z) };
		float hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
		viewAngl.x = atanf(delta[2] / hyp) * (180 / M_PI);
		viewAngl.y = atanf(delta[1] / delta[0]) * (180 / M_PI);
		viewAngl.z = 0.0f;
		if (delta[0] >= 0.0) {
			viewAngl.y += 180.0f;
		}
		  
	}
	float calcDist(Vector &myPos, Vector &enPos) {
		return sqrt((myPos.x - enPos.x) * (myPos.x - enPos.x) + (myPos.y - enPos.y) * (myPos.y - enPos.y) + (myPos.z - enPos.z) * (myPos.z - enPos.z));
	}
};

#endif
- - - Updated - - -

bump ! really need help

- - - Updated - - -

CSGO KEYS GIVEN TO PERSON WHO CAN HELP
Debug it and find out where it is causing lag.
It's not your code man, its c+p from Peans polyhack...

It's old source. Just use your brain and optimize this cheat. Good Luck!

More Sleep then 1 ? idk, try.
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us