Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    F4DE's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Location
    The Netherlands
    Posts
    158
    Reputation
    10
    Thanks
    973
    Quote Originally Posted by WasserEsser View Post
    Post your entire code.
    Code:
    //AIMBOT CODE
    int bonePosition = 6;
    
    float flAngleNormalize(float angle)
    {
    	while (angle < -180)    angle += 360;
    	while (angle > 180)    angle -= 360;
    	return angle;
    }
    void ClampAngle(Vec3 &angles){
    	angles.y = flAngleNormalize(angles.y);
    	angles.x = flAngleNormalize(angles.x);
    	if (angles.x > 89.0f)
    		angles.x = 89.0f;
    	if (angles.x < -89.0f)
    		angles.x = -89.0f;
    
    	angles.z = 0;
    
    }
    
    Vec3 BonePos(DWORD target, DWORD address, int boneId)
    {
    	DWORD boneBase = Mem.Read<DWORD>(target + address);
    	Vec3 vBone;
    	vBone.x = Mem.Read<float>(boneBase + 0x30 * boneId + 0x0C);
    	vBone.y = Mem.Read<float>(boneBase + 0x30 * boneId + 0x1C);
    	vBone.z = Mem.Read<float>(boneBase + 0x30 * boneId + 0x2C);
    	return vBone;
    }
    
    void ClampAngles(Vec3 &angles)
    {
    	if (angles.x != angles.x)
    	{
    		angles.x = 0.0f;
    	}
    	if (angles.y != angles.y)
    	{
    		angles.y = 0.0f;
    	}
    	if (angles.x > 89.0f)
    	{
    		angles.x = 89.0f;
    	}
    	if (angles.x < -89.0f)
    	{
    		angles.x = -89.0f;
    	}
    	if (angles.y > 180.0f)
    	{
    		angles.y -= 360.0f;
    	}
    	if (angles.y < -180.0f)
    	{
    		angles.y += 180.0f;
    	}
    	angles.z = 0.0f;
    }
    
    void CalcAngle(Vec3 src, Vec3 dst, Vec3 &angles)
    {
    	Vec3 delta;
    	delta.x = src.x - dst.x;
    	delta.y = src.y - dst.y;
    	delta.z = src.z - dst.z;
    	double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);
    
    	angles.x = (float)(atan(delta.z / hyp) * 57.295779513082f);
    	angles.y = (float)(atan(delta.y / delta.x) * 57.295779513082f);
    	angles.z = 0.0f;
    
    	if (delta.x >= 0.0)
    		angles.y += 180.0f;
    }
    
    
    float Get3dDistance(float mycoordsX, float mycoordsZ, float mycoordsY, float enemycoordsX, float enemycoordsZ, float enemycoordsY)
    {
    	return sqrt(pow(double(enemycoordsX - mycoordsX), 2.0) +
    		pow(double(enemycoordsY - mycoordsY), 2.0) +
    		pow(double(enemycoordsZ - mycoordsZ), 2.0));
    }
    
    const double M_PI = 3.14159265358979323846; //  float: -3.4 × 1038 to +3.4 × 1038
    
    void MakeVector(Vec3 pfin, Vec3& vector)
    {
    	float pitch = (float)(pfin.x * M_PI / 180);
    	float yaw = (float)(pfin.y * M_PI / 180);
    	float tmp = (float)(cos(pitch));
    
    	vector.x = (float)(-tmp * -cos(yaw));
    	vector.y = (float)(sin(yaw)*tmp);
    	vector.z = (float)(-sin(pitch));
    }
    
    float GetFOV(Vec3 Angles, Vec3 Source, Vec3 Dst)
    {
    	Vec3 ang, aim;
    	float fov;
    	CalcAngle(Source, Dst, ang);
    	MakeVector(Angles, aim);
    	MakeVector(ang, ang);
    
    	float mag_s = sqrt((aim.x * aim.x) + (aim.y * aim.y) + (aim.z * aim.z));
    	float mag_d = sqrt((aim.x * aim.x) + (aim.y * aim.y) + (aim.z * aim.z));
    
    	float u_dot_v = aim.x * ang.x + aim.y * ang.y + aim.z * ang.z;
    	fov = acos(u_dot_v / (mag_s*mag_d)) * (180.0f / M_PI);
    	return fov;
    }
    
    int aimbone;
    Vec3 position;
    int index;
    int ClosestEnemyToCrosshair(float maxfov)
    {
    	DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
    	int LocalTeam = Mem.Read<int>(LocalPlayer + m_iTeamNum);
    	for (int i = 0; i < 64; i++)
    	{
    		DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (i * 0x10));
    		if (!entitybase) continue;
    		if (entitybase == LocalPlayer)
    			continue;
    		bool entitydormant = Mem.Read<bool>(entitybase + isDormant);
    		if (entitydormant)
    			continue;
    		int entityteam = Mem.Read<int>(entitybase + m_iTeamNum);
    
    		if (entityteam == LocalTeam)
    			continue;
    
    
    		int entitylifestate = Mem.Read<byte>(entitybase + 0x25B); //is lifestate
    		if (entitylifestate != 0)
    			continue;
    
    		DWORD Engine = Mem.Module("engine.dll");
    		DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
    		Vec3 currentangles = Mem.Read<Vec3>(clientstate + viewAngle);
    		Vec3 pos = BonePos(entitybase, 0x2698, aimbone); //bonematrix
    		float entitydistance = GetFOV(currentangles, position, pos);
    		if (entitydistance < maxfov)
    		{
    			maxfov = entitydistance;
    			index = i;
    		}
    	}
    	return index;
    }
    
    
    void Aimbot()
    {
    	while (true)
    	{
    		for (int i = 0; i<48; i++)
    		{
    			DWORD Client = Mem.Module("client.dll");
    			DWORD CurrentWeaponIndex = Mem.Read<DWORD>(LocalPlayer + m_hMyWeapons + ((i - 1) * 0x4)) & 0xFFF;
    			DWORD CurrentWeaponEntity = Mem.Read<DWORD>(Client + EntityList + (CurrentWeaponIndex - 1) * 0x10);
    			int CurrentWeaponId = Mem.Read<int>(CurrentWeaponEntity + m_iItemDefinitionIndex);
    			int MyXuid = Mem.Read<int>(CurrentWeaponEntity + m_OriginalOwnerXuidLow);
    			Mem.Write<int>(CurrentWeaponEntity + m_iItemIDHigh, -1); //When iItemIDHigh is set to non zero value, fallback values will be used.
    
    			Mem.Write<int>(CurrentWeaponEntity + m_nFallbackPaintKit, 180);
    			Mem.Write<int>(CurrentWeaponEntity + m_nFallbackSeed, 0);
    			Mem.Write<int>(CurrentWeaponEntity + m_nFallbackStatTrak, 1337);
    			Mem.Write<int>(CurrentWeaponEntity + m_iEntityQuality, 1);
    			Mem.Write<float>(CurrentWeaponEntity + m_flFallbackWear, 0.001000);
    			Mem.Write<int>(CurrentWeaponEntity + m_iAccountID, MyXuid);
    		}
    		while (GetAsyncKeyState(VK_MENU))
    		{
    			int entindex = ClosestEnemyToCrosshair(90.f);
    
    			if (entindex == 0)
    				continue;
    			DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
    			Vec3 origin = Mem.Read<Vec3>(LocalPlayer + 0x134);
    			Vec3 vecview = Mem.Read<Vec3>(LocalPlayer + 0x104);
    			position.x = origin.x + vecview.x;
    			position.y = origin.y + vecview.y;
    			position.z = origin.z + vecview.z;
    
    			Vec3 punch = Mem.Read<Vec3>(LocalPlayer + 0x3018);
    			Vec3 angles;
    
    			DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (entindex * 0x10));
    			Vec3 pos = BonePos(entitybase, 0x2698, bonePosition);
    
    			CalcAngle(position, pos, angles);
    			angles.x = angles.x - punch.x * 2.f;
    			angles.y = angles.y - punch.y * 2.f;
    			ClampAngles(angles);
    			if (angles.x == 0 && angles.y == 0)
    				continue;
    			DWORD Engine = Mem.Module("engine.dll");
    			DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
    			Mem.Write<Vec3>(clientstate + 0x4D0C, angles);
    		}
    		Sleep(1);
    	}
    }

  2. #17
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    First of all, take a look at my answer over here, i see that you use the same code:

    https://www.mpgh.net/forum/showthread...1#post11850527

    You have two ClampAngle functions for no reason.

    DWORD Engine = Mem.Module("engine.dll"); within a loop, this will slow everything down. Why would you iterate a snapshot of modules of your process each time you iterate through the loop? This is completely unnecessary since the base address of the module doesn't change unless you restart the game.

    maxfov seems to be defined in global space, which means it's not being reset when the function is getting called again. Fix that by declaring it inside the function with a high default value.

    if (entindex == 0)

    In your case, entindex 0 is the very first player. Doing that will basically ignore the very first player every time which is not what you want.

    DWORD Engine = Mem.Module("engine.dll"); within another loop. This will just slow everything down. Use it once at the start of your main and use that value throughout your code.

    My post here and the other thread should be enough to fix your issues. You have mistakes in your code that the guy over in the other thread had aswell, i didn't mention them here, you can look at the other thread for that.

  3. The Following User Says Thank You to WasserEsser For This Useful Post:

    F4DE (07-20-2016)

  4. #18
    F4DE's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Location
    The Netherlands
    Posts
    158
    Reputation
    10
    Thanks
    973
    Quote Originally Posted by WasserEsser View Post
    First of all, take a look at my answer over here, i see that you use the same code:

    https://www.mpgh.net/forum/showthread...1#post11850527

    You have two ClampAngle functions for no reason.

    DWORD Engine = Mem.Module("engine.dll"); within a loop, this will slow everything down. Why would you iterate a snapshot of modules of your process each time you iterate through the loop? This is completely unnecessary since the base address of the module doesn't change unless you restart the game.

    maxfov seems to be defined in global space, which means it's not being reset when the function is getting called again. Fix that by declaring it inside the function with a high default value.

    if (entindex == 0)

    In your case, entindex 0 is the very first player. Doing that will basically ignore the very first player every time which is not what you want.

    DWORD Engine = Mem.Module("engine.dll"); within another loop. This will just slow everything down. Use it once at the start of your main and use that value throughout your code.

    My post here and the other thread should be enough to fix your issues. You have mistakes in your code that the guy over in the other thread had aswell, i didn't mention them here, you can look at the other thread for that.
    Thanks for your help, I'm adjusting the code right now. How would you stop the aimbot from snapping the the map origin point? I had this problem before, and that is why I added the 'if (entindex == 0)' code.

  5. #19
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by F4DE View Post
    Thanks for your help, I'm adjusting the code right now. How would you stop the aimbot from snapping the the map origin point? I had this problem before, and that is why I added the 'if (entindex == 0)' code.
    By checking if the entitybase is valid.

    if ( !entitybase ) continue;

  6. #20
    F4DE's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Location
    The Netherlands
    Posts
    158
    Reputation
    10
    Thanks
    973
    Quote Originally Posted by WasserEsser View Post
    By checking if the entitybase is valid.

    if ( !entitybase ) continue;
    Hmm, I have this right now;

    Code:
    int ClosestEnemyToCrosshair()
    {
    	float maxfov = 99999.f;
    	DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
    	int LocalTeam = Mem.Read<int>(LocalPlayer + m_iTeamNum);
    	DWORD Engine = Mem.Module("engine.dll");
    	for (int i = 0; i < 64; i++)
    	{
    		DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (i * 0x10));
    		if (!entitybase) continue;
    		if (entitybase == LocalPlayer)
    			continue;
    		bool entitydormant = Mem.Read<bool>(entitybase + isDormant);
    		if (entitydormant)
    			continue;
    		int entityteam = Mem.Read<int>(entitybase + m_iTeamNum);
    
    		if (entityteam == LocalTeam)
    			continue;
    
    
    		int entitylifestate = Mem.Read<byte>(entitybase + 0x25B); //is lifestate
    		if (entitylifestate != 0)
    			continue;
    
    		DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
    		Vec3 currentangles = Mem.Read<Vec3>(clientstate + viewAngle);
    		Vec3 pos = BonePos(entitybase, 0x2698, aimbone); //bonematrix
    		float entitydistance = GetFOV(currentangles, position, pos);
    		if (entitydistance < maxfov)
    		{
    			maxfov = entitydistance;
    			index = i;
    		}
    	}
    	return index;
    }
    
    
    void Aimbot()
    {
    	while (true)
    	{
    		for (int i = 0; i<48; i++)
    		{
    			DWORD Client = Mem.Module("client.dll");
    			DWORD CurrentWeaponIndex = Mem.Read<DWORD>(LocalPlayer + m_hMyWeapons + ((i - 1) * 0x4)) & 0xFFF;
    			DWORD CurrentWeaponEntity = Mem.Read<DWORD>(Client + EntityList + (CurrentWeaponIndex - 1) * 0x10);
    			int CurrentWeaponId = Mem.Read<int>(CurrentWeaponEntity + m_iItemDefinitionIndex);
    			int MyXuid = Mem.Read<int>(CurrentWeaponEntity + m_OriginalOwnerXuidLow);
    			Mem.Write<int>(CurrentWeaponEntity + m_iItemIDHigh, -1); //When iItemIDHigh is set to non zero value, fallback values will be used.
    
    			Mem.Write<int>(CurrentWeaponEntity + m_nFallbackPaintKit, 180);
    			Mem.Write<int>(CurrentWeaponEntity + m_nFallbackSeed, 0);
    			Mem.Write<int>(CurrentWeaponEntity + m_nFallbackStatTrak, 1337);
    			Mem.Write<int>(CurrentWeaponEntity + m_iEntityQuality, 1);
    			Mem.Write<float>(CurrentWeaponEntity + m_flFallbackWear, 0.001000);
    			Mem.Write<int>(CurrentWeaponEntity + m_iAccountID, MyXuid);
    		}
    		DWORD Engine = Mem.Module("engine.dll");
    		while (GetAsyncKeyState(VK_MENU))
    		{
    			int entindex = ClosestEnemyToCrosshair();
    
    			DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
    			Vec3 origin = Mem.Read<Vec3>(LocalPlayer + 0x134);
    			Vec3 vecview = Mem.Read<Vec3>(LocalPlayer + 0x104);
    			position.x = origin.x + vecview.x;
    			position.y = origin.y + vecview.y;
    			position.z = origin.z + vecview.z;
    
    			Vec3 punch = Mem.Read<Vec3>(LocalPlayer + 0x3018);
    			Vec3 angles;
    
    			DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (entindex * 0x10));
    			if (!entitybase) continue;
    			Vec3 pos = BonePos(entitybase, 0x2698, bonePosition);
    
    			CalcAngle(position, pos, angles);
    			angles.x = angles.x - punch.x * 2.f;
    			angles.y = angles.y - punch.y * 2.f;
    			ClampAngles(angles);
    			if (angles.x == 0 && angles.y == 0)
    				continue;
    			DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
    			Mem.Write<Vec3>(clientstate + 0x4D0C, angles);
    		}
    		Sleep(1);
    	}
    }
    Did all of the essential things, not the extra code pieces will do those later to clean it up when it works. For some reason, it still gives me the same result as before ;l

  7. #21
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by WasserEsser View Post
    DWORD Engine = Mem.Module("engine.dll"); within a loop, this will slow everything down. Why would you iterate a snapshot of modules of your process each time you iterate through the loop? This is completely unnecessary since the base address of the module doesn't change unless you restart the game.
    Please read that sentence again and take a look at your code again. You're iterating through the snapshot list of modules 3 times per iteration.

    Do it once in your main function.

    If you still have problems ( the above won't fix the problem ), post your FULL code.
    Last edited by WasserEsser; 07-20-2016 at 02:11 PM.

  8. #22
    F4DE's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Location
    The Netherlands
    Posts
    158
    Reputation
    10
    Thanks
    973
    Quote Originally Posted by WasserEsser View Post
    Please read that sentence again and take a look at your code again. You're iterating through the snapshot list of modules 3 times per iteration.

    Do it once in your main function.

    If you still have problems ( the above won't fix the problem ), post your FULL code.
    Added it to the Main class, but now it litterly doesn't do anything ;l
    Pm'ed you the full Main class.

  9. #23
    Hunter's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Location
    Depths Of My Mind.
    Posts
    17,468
    Reputation
    3771
    Thanks
    6,159
    My Mood
    Cheerful
    1 week has passed and no further replies have been made by the OP. Assuming solved.

    /Closed.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [Solved] gmod autocrouch when aimbot locked
    By RGswerhgerheherherherhrh in forum Garry's Mod Coding & Resources
    Replies: 4
    Last Post: 05-11-2016, 05:04 AM
  2. [Solved] CSGO aimbot teammates see you looking at the ground
    By Oyn in forum Counter-Strike 2 Help
    Replies: 1
    Last Post: 04-23-2015, 10:54 PM
  3. [Help] Aimbot with Lock on Key ?
    By Alatheas in forum Garry's Mod Discussions & Help
    Replies: 1
    Last Post: 12-09-2014, 06:34 PM
  4. Riot shield loses lock-on when using aimbots. Any help?
    By jalba in forum Call of Duty Modern Warfare 3 Help
    Replies: 2
    Last Post: 09-02-2012, 01:05 AM
  5. America's Army aimbot
    By garebear in forum General Game Hacking
    Replies: 6
    Last Post: 12-30-2005, 04:52 PM