Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CalcScreenCoors(D3DXVECTOR3 *vecWorld, D3DXVECTOR3 *vecScreen)
- {
- D3DXMATRIX m((float *)(0xB6FA2C));
- DWORD *dwLenX = (DWORD *)(0xC17044);
- DWORD *dwLenY = (DWORD *)(0xC17048);
- vecScreen->x = (vecWorld->z * m._31) + (vecWorld->y * m._21) + (vecWorld->x * m._11) + m._41;
- vecScreen->y = (vecWorld->z * m._32) + (vecWorld->y * m._22) + (vecWorld->x * m._12) + m._42;
- vecScreen->z = (vecWorld->z * m._33) + (vecWorld->y * m._23) + (vecWorld->x * m._13) + m._43;
- double fRecip = (double)1.0 / vecScreen->z;
- vecScreen->x *= (float)(fRecip * (*dwLenX));
- vecScreen->y *= (float)(fRecip * (*dwLenY));
- }
- int GetPlayerTarget(int radius)
- {
- static int iX;
- static int iY;
- for (int i = 0; i < SAMP_MAX_VEHICLES; i++)
- {
- if (SF->getSAMP()->getVehicles()->iIsListed[i] != 1)
- continue;
- if (SF->getSAMP()->getVehicles()->pSAMP_Vehicle[i] == NULL)
- continue;
- if (SF->getSAMP()->getVehicles()->pSAMP_Vehicle[i]->pGTA_Vehicle == NULL)
- continue;
- struct vehicle_info *vinfo = SF->getGame()->vehicleInfoGet(i, 0);
- D3DXVECTOR3 vecPos;
- vecPos.x = vinfo->detachable_car->position[0];
- vecPos.y = vinfo->detachable_car->position[1];
- vecPos.z = vinfo->detachable_car->position[2];
- D3DXVECTOR3 screenPos;
- CalcScreenCoors(&vecPos, &screenPos);
- if (screenPos.z < 1.f)
- continue;
- iX = GetSystemMetrics(SM_CXSCREEN) * 0.5299999714f;
- iY = GetSystemMetrics(SM_CYSCREEN) * 0.4f;
- if ((screenPos.x > iX + (radius)) || (screenPos.y > iY + (radius)) || (screenPos.x < iX - (radius)) || (screenPos.y < iY - (radius)))
- continue;
- return i;
- }
- return -1;
- }
- void Aimbot()
- {
- if (step == true)
- {
- CVector mypos;
- CVector enpos;
- CVector vector;
- int enid = GetPlayerTarget(50);
- if (enid != -1)
- {
- struct vehicle_info *vinfo = SF->getGame()->vehicleInfoGet(enid, 0);
- enpos.fX = vinfo->detachable_car->position[0];
- enpos.fY = vinfo->detachable_car->position[1];
- enpos.fZ = vinfo->detachable_car->position[2];
- CCamera *pCamera = GAME->GetCamera();
- mypos = *pCamera->GetCam(pCamera->GetActiveCam())->GetSource();
- vector = mypos - enpos;
- float *crosshairOffset = (float *)0xB6EC10;
- float mult = tan(pCamera->GetCam(pCamera->GetActiveCam())->GetFOV() * 0.5f * 0.017453292f);
- float fx = M_PI - atan2(1.0f, mult * (crosshairOffset[1] - 0.5f + crosshairOffset[1] - 0.5f));
- float AngleX = atan2f(vector.fY, -vector.fX) - M_PI / 2;
- *(float*)0xB6F258 = -(AngleX - fx);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement