ok maybe nothing new here but i wanna share the technique i use to get range of aiming from crosshair to get cloestSoldier(credits : Lowrob, smallc, ICY, others i forget)
first of all i use numpad to toggle distance so i delacre this for vkdown and vkup and declare the integral type for disttoaim
then the function to get cloest soldier
this line is very important to set your size
some usefull drawing functions to draw a circle
finally in the rendering (in case you have an injected overlay you can do that to get the 2d range of aim get drawn in your screen
first of all i use numpad to toggle distance so i delacre this for vkdown and vkup and declare the integral type for disttoaim
PHP Code:
#define KEYDOWN(vkCode) ((GetAsyncKeyState(vkCode) & 0x8000) ? true : false)
#define KEYUP(vkCode) ((GetAsyncKeyState(vkCode) & 0x8000) ? false : true)
int distToAim = 25;
PHP Code:
float getDistFromCrosshair(ClientPlayer *pCloestSoldier)
{
D3DXVECTOR3 screenM;
D3DXVECTOR3 returningVector;
if (IsValidPtr(pCloestSoldier))
{
D3DXMATRIX transfo;
DxRenderer *pDxrenderer = DxRenderer::GetInstance();
if (IsValidPtr(pDxrenderer))
{
Screen *pScreen = pDxrenderer->m_pScreen;
if (IsValidPtr(pScreen))
{
screenM.x = (float)pScreen->m_Width / 2;
screenM.y = (float)pScreen->m_Height / 2;
screenM.z = 0;
ClientSoldierEntity *pSoldier = pCloestSoldier->m_pControlledControllable;
if (IsValidPtr(pSoldier))
{
pSoldier->GetTransform(&transfo);
D3DXVECTOR3 cloestSoldPos;
cloestSoldPos = transfo.m[3];
if (WorldToScreen(&cloestSoldPos))
{
returningVector.x = cloestSoldPos.x - screenM.x;
returningVector.y = cloestSoldPos.y - screenM.y;
//printf_s("X[%f]Y[%f]", returningVector.x, returningVector.y, fuck);
returningVector.z = 0;
float returndist = sqrtf((returningVector.x * returningVector.x) + (returningVector.y * returningVector.y));
//printf_s(" Ret[%f]\n", returndist, fuck);
if (returndist < distToAim)
return returndist;
}
else
{
return 10000.0f;
}
}
}
}
}
return 10000.0f;
}
PHP Code:
if (returndist < distToAim)
return returndist;
PHP Code:
void Draw2DCircle(float x, float y, float radius, D3DCOLOR color) // , LPDIRECT3DDEVICE9 dev
{
const int NUMPOINTS = 24 * 2;
const float PI = 3.14159;
D3DTLVERTEX Circle[NUMPOINTS + 1];
int i;
float X;
float Y;
float Theta;
float WedgeAngle; //Size of angle between two points on the circle (single wedge)
//Precompute WedgeAngle
WedgeAngle = (float)((2 * PI) / NUMPOINTS);
//Set up vertices for a circle
//Used <= in the for statement to ensure last point meets first point (closed circle)
for (i = 0; i <= NUMPOINTS; i++)
{
//Calculate theta for this vertex
Theta = i * WedgeAngle;
//Compute X and Y locations
X = (float)(x + radius * cos(Theta));
Y = (float)(y - radius * sin(Theta));
Circle[i] = CreateD3DTLVERTEX(X, Y, 0.0f, 1.0f, color, 0.0f, 0.0f);
}
//Now draw the circle
pDevice->SetFVF(D3DFVF_TL);
pDevice->SetTexture(0, NULL);
pDevice->DrawPrimitiveUP(D3DPT_LINESTRIP, NUMPOINTS, &Circle[0], sizeof(Circle[0]));
}
PHP Code:
void drawRangeofAim(int rom)
{
CenterX = DxRenderer::GetInstance()->m_pScreen->m_Width / 2;
CenterY = DxRenderer::GetInstance()->m_pScreen->m_Height / 2;
Draw2DCircle(CenterX, CenterY, rom, D3DCOLOR_RGBA(255, 0, 0, 255));
}
PHP Code:
int Render()
{
pDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, NULL, 1.0f, 0);
pDevice->BeginScene();
pDevice->CreateStateBlock(D3DSBT_ALL, &StateBlock);
if (TargetWindow == GetForegroundWindow())
{
sprintf_s(distAimed, "current 2d aim Range[%i]", distToAim);
DrawString(distAimed, 10, 10, 255, 0, 0, pFont);
if (KEYDOWN(VK_NUMPAD3))
{
Sleep(10);
drawRangeofAim(distToAim + 25);
if (KEYUP(VK_NUMPAD3))
{
distToAim += 25;
drawRangeofAim(distToAim);
if (distToAim > 350)
distToAim = 25;
}
}
if (GetKeyState(VK_NUMPAD4))
drawRangeofAim(distToAim);
}
pDevice->EndScene();
pDevice->PresentEx(0, 0, 0, 0, 0);
}
Thanks for sharing your thoughts about game
RépondreSupprimercheats for android. Regards