CoD4 2D Radar Code

Posts 1–4 of 4 · Page 1 of 1
CoD4 2D Radar Code
A Simple CoD4 2D Radar!

Code:
#include <windows.h>
#include "Esp.h" 
#include "Vector.h"
#include "Menu.h" 
#include "ClientHooks.h" 
#include "Draw.h" 

CRadar Radar;

BOOL CRadar::WorldToRadar(CEntity_t *Ent, CEntity_t *LocalEnt, CClientInfo_t *Client, CClientInfo_t *LocalClient, float *Out )
{
	Vec3 rotation, 
		view = { ref->VXPos, ref->VYPos, ref->VZPos },
		aim = { Ent->pX, Ent->pY, Ent->pZ },
		local = { ( aim[0] - view[0] ), ( aim[1] - view[1] ), ( aim[2] - view[2] ) }; 

	if( (Ent->ClientNumber == cg->clientNum) || (!Ent->Alive) || (!Ent->IsValidEnt) )
		return 0;

	iMyTeam = LocalClient->Team; 
	iPlayerTeam = Client->Team; 

	local[2] = 0.0f; 

	Distance = sqrt( local[0]*local[0] + local[1]*local[1] + local[2]*local[2] ) / 25; 

	Vector.vectoangles( local, rotation ); 
	rotation[1] = Vector.AngleNormalize180( rotation[1] - cg->Yaw );
	Vector.AngleVectors( rotation, local, 0, 0 ); 
	VectorScale( local, Distance, local );

	if		( local[0] > 100.0f )	VectorScale( local, 100.0f  / local[0], local );
	else if	( local[0] < -100.0f )	VectorScale( local, -100.0f / local[0], local ); 
	if		( local[1] > 100.0f )	VectorScale( local, 100.0f  / local[1], local ); 
	else if	( local[1] < -100.0f )	VectorScale( local, -100.0f / local[1], local ); 

	Out[0] = (int)-local[1] + (iPosX + 105.0f);
	Out[1] = (int)-local[0] + (iPosY + 105.0f);

	return 1;
} 

VOID CRadar::DrawRadar()
{
	CClientInfo_t* Client, *LocalClient;
	CEntity_t* Ent, *LocalEnt;
	
	Vec2 View = { ref->Viewport_Height, ref->Viewport_Width }; 

	LocalClient = Esp.GetLocalClient();
	LocalEnt = Esp.GetLocalClient(); 

	iwidth = 210.0f;
	iheight = iwidth;
	iPosX = View[1] * 0.025f;
	iPosY = View[0] * 0.39375f; 

	DrawMyGui( iPosX, iPosY, iwidth, iheight, Menu.dwColor_Enabled ); 

	for(int i = 0; i < _MAX_PLAYERS_; i++)
	{
		Ent = Esp.GetEntityByIndex( i );
		Client = Esp.GetPlayerByIndex( i ); 

		if(Ent->Alive && Ent->IsValidEnt && Ent->ClientNumber != iClient && Ent->iEntityType == TYPE_HUMAN )
		{
			if(WorldToRadar( Ent, LocalEnt, Client, LocalClient, Final ) )
			{ 
				bIsEnemy = (iPlayerTeam != iMyTeam) || (iMyTeam == NULL && iPlayerTeam == NULL); 

				Draw.FillRgb( Final[0] - 1.0f, Final[1] - 1.0f, 5.5, 5.5, bIsEnemy ? tred : tlblue );
			}
		}
	}
}

VOID CRadar::DrawMyGui( int iPosX, int iPosY, int iwidth, int iheight, DWORD dwColor )
{
	Draw.DrawRectangle( iPosX , iPosY, iwidth, iheight, 2.5, dwColor ); 

	Draw.FillRgb( iPosX, iPosY, iwidth, iheight, 0, 0, 0, 80 ); 
	Draw.FillRgb( iPosX, iPosY + (iwidth / 2), iwidth, 1.0f, dwColor ); 
	Draw.FillRgb( iPosX + (iheight / 2), iPosY, 1.0f, iheight, dwColor );
	Draw.FillRgb( iPosX + (iwidth / 2) - 1, iPosY + (iheight / 2) - 1, 4.0f, 4.0f, 255, 255, 255, 255 ); 
}

Have Fun,Enjoy
where i can put it?
is this undetected by pb or not???
How is it user supposed #include files that he doesn't have?
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us