• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 6 of 6
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      yolomaw's Avatar
      Join Date
      Jun 2017
      Posts
      3
      Thanks (-->)
      2
      Thanks (<--)
      0

      Grenade Prediction

      How to Call Game Functions
      Hello guys,
      I'm learning stuff while coding my first internal project. I've made Aimbot, ESP, Skinchanger, Nade Tracer and i saw one thing called Grenade Prediction - It will show you trace of grenade before you throw it.. The question is -> Is there some source which contains this function? I watched some snippets with this function (Found two, both from 2014 and both were using unknown function names so i could not understand how the thing works)..

    2. #2
      Jr.Hacker
      Learning to hack games!
       
      Feeling Normal
       
      HexMurder's Avatar
      Join Date
      Jun 2012
      Posts
      304
      Thanks (-->)
      6
      Thanks (<--)
      117
      I have never done it myself. Nor have i looked at a source with it. But if i had to venture a guess i would say you are going to need a LOT of math. And a good bit of knowledge/research of the source engine. I'm thinking (could be wrong) you just replicate the math of the grenade (including ray tracing to detect objects it may bounce off of) and draw lines accordingly. But maybe there is a simpler way. Really not sure. Good luck bro lol.
      Last edited by HexMurder; 06-10-2017 at 06:06 PM.

    3. Thanks yolomaw thanked for this post
    4. #3
      Administrator
      Hacked By Jesus
       
      Reversing
       
      [GH]Rake's Avatar
      Join Date
      Jan 2014
      Location
      USA
      Posts
      3,677
      Thanks (-->)
      893
      Thanks (<--)
      1094
      Find the function like Grenade::Attack() or Fire() or whatever, simulate it by defining your own objects and parameters, call it using your simulated grenade, in this manner it won't affect your player or the game. Then plot the path of the grenade based on whatever you log from the simulated function call. You'll have to be a good ass reverser to do this

    5. Thanks yolomaw thanked for this post
    6. #4
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      yolomaw's Avatar
      Join Date
      Jun 2017
      Posts
      3
      Thanks (-->)
      2
      Thanks (<--)
      0
      According to what you say, I will just skip this function because it seems to be above my coding skills for now.
      Thanks for replies guys, I appreciate it..
      You can lock this thread if you want, i got what i wanted^^

    7. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      yolomaw's Avatar
      Join Date
      Jun 2017
      Posts
      3
      Thanks (-->)
      2
      Thanks (<--)
      0
      After few hours i finished Grenade Prection code (based on dude719's code on UC)
      It's not pixel-perfect but w/e, it's enough for me
      Code:
      void PredictGrenade(CBaseEntity* pLocal)
      {
      	const float TIMEALIVE = 5.f;
      	const float GRENADE_COEFFICIENT_OF_RESTITUTION = 0.4f;
      
      	float fStep = 0.1f;
      	float fGravity = 800.0f / 8.f;
      
      	Vector3 vPos, vThrow, vThrow2;
      	Vector3 vStart;
      
      	int iCollisions = 0;
      
      	Vector3 vViewAngles;
      	I::Engine->GetViewAngles(vViewAngles);
      
      	vThrow[0] = vViewAngles[0];
      	vThrow[1] = vViewAngles[1];
      	vThrow[2] = vViewAngles[2];
      
      	if (vThrow[0] < 0)
      		vThrow[0] = -10 + vThrow[0] * ((90 - 10) / 90.0);
      	else
      		vThrow[0] = -10 + vThrow[0] * ((90 + 10) / 90.0);
      
      	float fVel = (90 - vThrow[0]) * 4;
      	if (fVel > 500)
      		fVel = 500;
      
      	U::AngleVectors2(vThrow, &vThrow2);
      
      	Vector3 vEye = pLocal->GetEyePosition();
      	vStart[0] = vEye[0] + vThrow2[0] * 16;
      	vStart[1] = vEye[1] + vThrow2[1] * 16;
      	vStart[2] = vEye[2] + vThrow2[2] * 16;
      
      	vThrow2[0] = (vThrow2[0] * fVel) + pLocal->GetVelocity()[0];
      	vThrow2[1] = (vThrow2[1] * fVel) + pLocal->GetVelocity()[1];
      	vThrow2[2] = (vThrow2[2] * fVel) + pLocal->GetVelocity()[2];
      
      	for (float fTime = 0.0f; fTime < TIMEALIVE; fTime += fStep)
      	{
      		vPos = vStart + vThrow2 * fStep;
      
      		Ray_t ray;
      		trace_t tr;
      		CTraceFilter loc;
      		loc.pSkip = pLocal;
      
      		ray.Init(vStart, vPos);
      		I::EngineTrace->TraceRay(ray, MASK_SOLID, &loc, &tr);
      		Color color = Color(0, 255, 0);
      		if (tr.DidHit())
      		{
      			float anglez = DotProduct(Vector3(0, 0, 1), tr.plane.normal);
      			float invanglez = DotProduct(Vector3(0, 0, -1), tr.plane.normal);
      			float angley = DotProduct(Vector3(0, 1, 0), tr.plane.normal);
      			float invangley = DotProduct(Vector3(0, -1, 0), tr.plane.normal);
      			float anglex = DotProduct(Vector3(1, 0, 0), tr.plane.normal);
      			float invanglex = DotProduct(Vector3(3-1, 0, 0), tr.plane.normal);
      			float scale = tr.endpos.DistTo(pLocal->GetOrigin()) / 60;
      			Color color = Color(0, 0, 255);
      			if (anglez > 0.5)
      			{
      				tr.endpos.z += 1;
      				Vector3 startPos = tr.endpos + Vector3(-scale, 0, 0);
      				Vector3 endPos = tr.endpos + Vector3(scale, 0, 0);
      				Vector3 outStart, outEnd;
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      
      				startPos = tr.endpos + Vector3(0, -scale, 0);
      				endPos = tr.endpos + Vector3(0, scale, 0);
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      			}
      			else if (invanglez > 0.5)
      			{
      				tr.endpos.z += 1;
      				Vector3 startPos = tr.endpos + Vector3(-scale, 0, 0);
      				Vector3 endPos = tr.endpos + Vector3(scale, 0, 0);
      				Vector3 outStart, outEnd;
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      
      				startPos = tr.endpos + Vector3(0, -scale, 0);
      				endPos = tr.endpos + Vector3(0, scale, 0);
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      			}
      			else if (angley > 0.5)
      			{
      				tr.endpos.y += 1;
      				Vector3 startPos = tr.endpos + Vector3(0, 0, -scale);
      				Vector3 endPos = tr.endpos + Vector3(0, 0, scale);
      				Vector3 outStart, outEnd;
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      
      				startPos = tr.endpos + Vector3(-scale, 0, 0);
      				endPos = tr.endpos + Vector3(scale, 0, 0);
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      			}
      			else if (invangley > 0.5)
      			{
      				tr.endpos.y += 1;
      				Vector3 startPos = tr.endpos + Vector3(0, 0, -scale);
      				Vector3 endPos = tr.endpos + Vector3(0, 0, scale);
      				Vector3 outStart, outEnd;
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      
      				startPos = tr.endpos + Vector3(-scale, 0, 0);
      				endPos = tr.endpos + Vector3(scale, 0, 0);
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      			}
      			else if (anglex > 0.5)
      			{
      				tr.endpos.x += 1;
      				Vector3 startPos = tr.endpos + Vector3(0, -scale, 0);
      				Vector3 endPos = tr.endpos + Vector3(0, scale, 0);
      				Vector3 outStart, outEnd;
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      
      				startPos = tr.endpos + Vector3(0, 0, -scale);
      				endPos = tr.endpos + Vector3(0, 0, scale);
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      			}
      			else if (invanglex > 0.5)
      			{
      				tr.endpos.x += 1;
      				Vector3 startPos = tr.endpos + Vector3(0, -scale, 0);
      				Vector3 endPos = tr.endpos + Vector3(0, scale, 0);
      				Vector3 outStart, outEnd;
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      
      				startPos = tr.endpos + Vector3(0, 0, -scale);
      				endPos = tr.endpos + Vector3(0, 0, scale);
      				if (U::WorldToScreen(startPos, outStart) && U::WorldToScreen(endPos, outEnd))
      					Draw->AddLine(ImVec2(outStart.x, outStart.y), ImVec2(outEnd.x, outEnd.y), color.GetU32());
      			}
      
      			vThrow2 = tr.plane.normal * -2.0f * DotProduct(vThrow2, tr.plane.normal) + vThrow2;
      			vThrow2 *= GRENADE_COEFFICIENT_OF_RESTITUTION;
      
      			iCollisions++;
      			if (iCollisions > 2)
      				break;
      
      			vPos = vStart + vThrow2 * tr.fraction * fStep;
      			fTime += (fStep * (1 - tr.fraction));
      		}
      
      		Vector3 vOutStart, vOutEnd;
      
      		if (U::WorldToScreen(vStart, vOutStart), U::WorldToScreen(vPos, vOutEnd))
      			Draw->AddLine(ImVec2(vOutStart.x, vOutStart.y), ImVec2(vOutEnd.x, vOutEnd.y), Color(0, 255, 0).GetU32());
      
      		vStart = vPos;
      		vThrow2.z -= fGravity * tr.fraction * fStep;
      	}
      }

    8. #6
      Administrator
      Hacked By Jesus
       
      Reversing
       
      [GH]Rake's Avatar
      Join Date
      Jan 2014
      Location
      USA
      Posts
      3,677
      Thanks (-->)
      893
      Thanks (<--)
      1094
      Advertise on GuidedHacking
      @yolomaw holy shit that's alot of code! Nice job getting it to work. Just curious, could you create a fake grenade object, call the game's "Throw grenade" function on it and use that to predict the results? That's what I always imagined doing rather than writing the whole function myself

    Similar Game Hacker Threads

    1. [Help] Grenade launcher hack
      By Roman_Ablo in forum Hacking Help
      Replies: 2
      Last Post: 03-01-2017, 03:32 PM