Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. int GetPlayerTarget(int radius)
  2. {
  3. static int iX;
  4. static int iY;
  5. struct vehicle_info *vinfo = SF->getGame()->vehicleInfoGet(VEHICLE_SELF, VEHICLE_ALIVE);
  6.  
  7. for (int i = 0; i < SAMP_MAX_VEHICLES; i++)
  8. {
  9.  
  10. if (SF->getSAMP()->getVehicles()->iIsListed[i] != 1)
  11. continue;
  12.  
  13.  
  14.  
  15. D3DXVECTOR3 vecPos;
  16. vecPos.x = vinfo->detachable_car->position[0];
  17. vecPos.y = vinfo->detachable_car->position[1];
  18. vecPos.z = vinfo->detachable_car->position[2];
  19.  
  20.  
  21. D3DXVECTOR3 screenPos;
  22. CalcScreenCoors(&vecPos, &screenPos);
  23. if (screenPos.z < 1.f)
  24. continue;
  25.  
  26. iX = GetSystemMetrics(SM_CXSCREEN) * 0.5299999714f;
  27. iY = GetSystemMetrics(SM_CYSCREEN) * 0.4f;
  28.  
  29.  
  30.  
  31. if ((screenPos.x > iX + (radius)) || (screenPos.y > iY + (radius)) || (screenPos.x < iX - (radius)) || (screenPos.y < iY - (radius)))
  32. continue;
  33.  
  34. return i;
  35. }
  36.  
  37. return -1;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement