Results 1 to 11 of 11
  1. #1
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful

    Ray Tracing Based Triggerbot

    Hello!
    Recently I have seen some ray tracing functions and I wanted to implement it to update my triggerbot. I have used Merccys ray tracing functions:
    tiioN's hitboxes for head:
    Code:
    Hitbox[ 11 ].Setup( BONE_HEAD, Vector( -2.7713f, -2.8783f, -3.103f ), Vector( 6.955f, 3.5203f, 3.0067f ) );
    The triggerbot compiles nicely with no errors but it does not shoot when I aim for an entity head.
    If anyone could point out what is the problem here or have some pointers plez post

    ray.h:
    Code:
    #ifndef RAY_H 
    #define RAY_H 
    
    typedef struct Vector3d_
    {
    	float x, y, z;
    }Vector3d;
    
    class Ray {
    
    public:
    	Vector3d origin, direction, directionInverse;
    
    	Ray(Vector3d _origin, Vector3d _direction);
    
    	bool Trace(Vector3d leftBottom, Vector3d rightTop, float &distance);
    
    };
    
    #endif
    Ray.cpp:
    Code:
    #include "Ray.h" 
    #include <algorithm>
    
    Ray::Ray(Vector3d _origin, Vector3d _direction) {
    	origin = _origin;
    	direction = _direction;
    
    	directionInverse.x = 1.0f / direction.x;
    	directionInverse.y = 1.0f / direction.y;
    	directionInverse.z = 1.0f / direction.z;
    }
    
    
    bool Ray::Trace(Vector3d leftBottom, Vector3d rightTop, float &distance) {
    
    	// If line is parallel and outsite the box it is not possible to intersect  
    	if (direction.x == 0.0f && (origin.x < std::min(leftBottom.x, rightTop.x) || origin.x > std::max(leftBottom.x, rightTop.x)))
    		return false;
    
    	if (direction.y == 0.0f && (origin.y < std::min(leftBottom.y, rightTop.y) || origin.y > std::max(leftBottom.y, rightTop.y)))
    		return false;
    
    	if (direction.z == 0.0f && (origin.z < std::min(leftBottom.z, rightTop.z) || origin.z > std::max(leftBottom.z, rightTop.z)))
    		return false;
    
    	float t1 = (leftBottom.x - origin.x) * directionInverse.x;
    	float t2 = (rightTop.x - origin.x) * directionInverse.x;
    	float t3 = (leftBottom.y - origin.y) * directionInverse.y;
    	float t4 = (rightTop.y - origin.y) * directionInverse.y;
    	float t5 = (leftBottom.z - origin.z) * directionInverse.z;
    	float t6 = (rightTop.z - origin.z) * directionInverse.z;
    
    	float tmin = std::max(std::max(std::min(t1, t2), std::min(t3, t4)), std::min(t5, t6));
    	float tmax = std::min(std::min(std::max(t1, t2), std::max(t3, t4)), std::max(t5, t6));
    
    	if (tmax < 0) {
    		distance = tmax;
    		return false;
    	}
    
    	if (tmin > tmax) {
    		distance = tmax;
    		return false;
    	}
    
    	distance = tmin;
    	return true;
    }
    main:
    Code:
    int main()
    {
    	DWORD pId;
    	HWND hwnd = FindWindow(NULL, "Counter-Strike: Global Offensive");
    	GetWindowThreadProcessId(hwnd, &pId);
    	HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, NULL, pId);
    	DWORD clientDll = getDll("client.dll", pId);
    	DWORD engineDll = getDll("engine.dll", pId);
    
    	while (true) {
    
    			Vector3d viewAngle = Player.getViewAngle(hProc, engineDll);
    			Vector3d eyePos = Player.getEyePos(hProc, clientDll);
    
    			float distance;
    			Vector3d viewDirection = AngleToDirection(viewAngle);
    			Ray viewRay(eyePos, viewDirection);
    			for (int i = 0; i < 64; ++i)
    			{
    				Vector3d bottomHitboxHead = Entity.getBonePosition(clientDll, hProc, i);
    				bottomHitboxHead.x += -2.771300f;
    				bottomHitboxHead.y += -2.878300f;
    				bottomHitboxHead.z += -3.103000f;
    
    				Vector3d topHitboxHead = Entity.getBonePosition(clientDll, hProc, i);
    				topHitboxHead.x += 6.955000f;
    				topHitboxHead.y += 4.020300f;
    				topHitboxHead.z += 5.006700f;
    
    				if (viewRay.Trace(bottomHitboxHead, topHitboxHead, distance) && (GetAsyncKeyState(0x02) & (1 << 15)));
    				{
    					Mem.Write<int>(hProc, (clientDll + DwAttack), shoot);
    					Sleep(5);
    					Mem.Write<int>(hProc, (clientDll + DwAttack), dontShoot);
    					Sleep(10);
    				}
    
    			}
    			Sleep(1);
    		}
    	return 0;
    	}
    Last edited by Smoke; 07-14-2016 at 04:35 PM.

  2. #2
    ImWhacky's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    509
    Reputation
    56
    Thanks
    4,059
    My Mood
    Breezy
    This might be a little off topic but why is ray tracing better? Normal triggerbots work just fine


     

    Steam-TriggeredFemenazi
    CS:GO Rank-MG (but I'm a dirty cheater so who cares)
    Discord-ImWhacky#6260

    P.M. me if you have any questions.


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

    DarknzNet_Alt (07-14-2016)

  4. #3
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by ImWhacky View Post
    This might be a little off topic but why is ray tracing better? Normal triggerbots work just fine
    normal InCross triggerbots does not work on faceit servers

  5. The Following User Says Thank You to samlarenskoog For This Useful Post:

    ImWhacky (07-15-2016)

  6. #4
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by ImWhacky View Post
    This might be a little off topic but why is ray tracing better? Normal triggerbots work just fine
    Your usual triggerbot isn't working if you want to target out specific bones / hitboxes nor is your normal triggerbot working at long distances such as the almighty dust 2 middle. If servers choose to disable the the crosshair id, your trigger aint working either.

  7. The Following 3 Users Say Thank You to WasserEsser For This Useful Post:

    DarknzNet_Alt (07-14-2016),ImWhacky (07-15-2016),nexcat (07-14-2016)

  8. #5
    goochguy's Avatar
    Join Date
    Feb 2014
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    5
    Hello just taking a look at when Mercy uploaded the original it was in January 2015. This happened in September 2015: -Link to large image-

    Unfortunately this code is not going to work without a decent amount of modification.
    One place to start is that they changed the bone ID's. The head is 6 now I think.
    Good luck.

  9. #6
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by goochguy View Post
    Hello just taking a look at when Mercy uploaded the original it was in January 2015. This happened in September 2015: -Link to large image-

    Unfortunately this code is not going to work without a decent amount of modification.
    One place to start is that they changed the bone ID's. The head is 6 now I think.
    Good luck.
    Yes I know, I updated the hitbox and now I changed the head bone ID, thanks for the pointers. Now it just spams mouseclicks everywhere, outside and inside of csgo :/ I have no idea what the problem is.

    EDIT:
    This is how I get head bone pos:
    Code:
    	Vector3d getBonePosition( DWORD clientDll, HANDLE hProc, int i)
    	{
    		DWORD baseEntity = getEntityBase(hProc, clientDll, i);
    		if (baseEntity)
    		{
    			DWORD boneMatrix = Mem.Read<DWORD>(hProc, (baseEntity + DwBoneMatrix));
    			if (boneMatrix)
    			{
    				Vector3d bonePosition{};
    				bonePosition.x = Mem.Read<float>(hProc, (boneMatrix + 0x30 * targetBone + 0x0C));
    				bonePosition.y = Mem.Read<float>(hProc, (boneMatrix + 0x30 * targetBone + 0x1C));
    				bonePosition.z = Mem.Read<float>(hProc, (boneMatrix + 0x30 * targetBone + 0x2C));
    				return bonePosition;
    			}
    		}
    	}
    and this is the AngleToDirection func:
    Code:
    Vector3d AngleToDirection(Vector3d angle) {
    	angle.x = (angle.x) * 3.14159265 / 180;
    	angle.y = (angle.y) * 3.14159265 / 180;
    
    	float sinYaw = sin(angle.y);
    	float cosYaw = cos(angle.y);
    
    	float sinPitch = sin(angle.x);
    	float cosPitch = cos(angle.x);
    
    	Vector3d direction;
    	direction.x = cosPitch * cosYaw;
    	direction.y = cosPitch * sinYaw;
    	direction.z = -sinPitch;
    
    	return direction;
    }
    Edit 2:
    Currently when I try it ingame it only shoots at some angles, and it holds down mouse1 button longer when I am in the middle of the angle (as video shows, it is like a pyramid) I dont even have to hold the triggerbutton for this to happen. What is wrong? Dont mind the sound, realized it when I uploaded it.
    Last edited by samlarenskoog; 07-14-2016 at 07:05 PM.

  10. #7
    nexcat's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Posts
    59
    Reputation
    10
    Thanks
    549
    Quote Originally Posted by ImWhacky View Post
    snip~
    I've looked at your code, Your AngleToDirection function should use 2 vectors, your viewangles, and a forward vector. Multiply the forward vector by the range of the current weapon you're holding, or just use a certain number ( i use 10000.f )

    edit : also looking at your video, that's the problem i had when i didn't do what i said above ^
    Last edited by nexcat; 07-14-2016 at 07:42 PM.

  11. #8
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by nexcat View Post
    I've looked at your code, Your AngleToDirection function should use 2 vectors, your viewangles, and a forward vector. Multiply the forward vector by the range of the current weapon you're holding, or just use a certain number ( i use 10000.f )

    edit : also looking at your video, that's the problem i had when i didn't do what i said above ^
    How do I get the forward vector and how would I implement it in the func?
    Last edited by samlarenskoog; 07-14-2016 at 08:07 PM.

  12. #9
    gtaplayer2's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Location
    Dancing with my kawaii friend
    Posts
    588
    Reputation
    22
    Thanks
    1,984
    Quote Originally Posted by samlarenskoog View Post
    How do I get the forward vector and how would I implement it in the func?
    For forward vector look in the CSGO SDK, theres is a function called AngleVectors which gets your current angels and returns a forward vector.

  13. #10
    samlarenskoog's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Posts
    104
    Reputation
    25
    Thanks
    57
    My Mood
    Cheerful
    Quote Originally Posted by nexcat View Post
    I've looked at your code, Your AngleToDirection function should use 2 vectors, your viewangles, and a forward vector. Multiply the forward vector by the range of the current weapon you're holding, or just use a certain number ( i use 10000.f )

    edit : also looking at your video, that's the problem i had when i didn't do what i said above ^
    I found this function:
    Code:
    void AngleVectors (const QAngle &angles, Vector *forward)
    {
    	Assert( s_bMathlibInitialized );
    	Assert( forward );
    	
    	float	sp, sy, cp, cy;
    	
    	SinCos( DEG2RAD( angles[YAW] ), &sy, &cy );
    	SinCos( DEG2RAD( angles[PITCH] ), &sp, &cp );
    	
    	forward->x = cp*cy;
    	forward->y = cp*sy;
    	forward->z = -sp;
    }
    And that function is the same as my angleDirection function, except it outputs in parameter? So if I scale this vector up with 1000.f in viewDirection it should work?

    There might be a problem with how I get my eyePos, it only shows the z-value to 64.0626. I cant find any examples of how to get eyePos.
    Code:
    	Vector3d getEyePos(HANDLE hProc, DWORD clientDll)
    	{
    		DWORD localPlayer = Mem.Read<DWORD>(hProc, (clientDll + dwLocalPlayer));
    		if (localPlayer)
    		{
    			Vector3d eyePos{};
    			eyePos.x = Mem.Read<float>(hProc, (localPlayer + 0x104));
    			eyePos.y = Mem.Read<float>(hProc, (localPlayer + 0x108));
    			eyePos.z = Mem.Read<float>(hProc, (localPlayer + 0x10C));
    			return eyePos;
    		}
    	}
    Last edited by samlarenskoog; 07-15-2016 at 10:30 AM.

  14. #11
    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.

Similar Threads

  1. [Help] Ray trace masks
    By notjamesmay in forum Counter-Strike 2 Coding & Resources
    Replies: 3
    Last Post: 04-06-2016, 05:55 AM
  2. [Help] internal ray trace crashing
    By sethxi in forum Counter-Strike 2 Coding & Resources
    Replies: 5
    Last Post: 11-13-2015, 12:27 AM
  3. [Detected] CS:CARA V1.2 - Multihack - Glow ESP (Health-based) - Triggerbot - NoFlash - Keybinds
    By Sixsixx in forum Counter-Strike 2 Hacks
    Replies: 212
    Last Post: 09-24-2015, 06:16 PM
  4. [Detected] CS:CARA V1.1 - Multihack - Glow ESP (Health-based) - Triggerbot - NoFlash
    By Sixsixx in forum Counter-Strike 2 Hacks
    Replies: 68
    Last Post: 09-18-2015, 09:43 PM
  5. [Detected] CS:Cara - Multihack - Glow ESP (Health-based) - Triggerbot - NoFlash
    By Sixsixx in forum Counter-Strike 2 Hacks
    Replies: 19
    Last Post: 09-17-2015, 06:07 PM