PDA

View Full Version : External ESP Using GDI



Supericy
11-23-2010, 06:52 PM
Ok, i am fairly new here and this is my first post i have made. I am working on external box ESP using the GDI library. Everything i have so far works fine, except i am having troubles converting angles to position on screen.

Current code, *SEMI* works for 1024x768, but the spot it draws box is still not 100% correct.

Local.GetPos();
Local.GetView();
for (int ESPID=1;ESPID <= 1;ESPID++)
{
Target.GetPos(ESPID);

angleX = _degree(atan(abs(Target.y-Local.y)/abs(Target.x-Local.x)));
if (Target.x < Local.x)
angleX+=180;
if ((Target.x > Local.x && Local.y > Target.y) || (Target.x < Local.x && Local.y < Target.y))
angleX = 360-angleX;

dist = sqrt((pow(Target.x-Local.x, 2)+pow(Target.y-Local.y, 2)+pow(Target.z-Local.z, 2)));
angleY = _degree(acos((Target.z-Local.z)/dist))-90;

xOFF = angleX-Local.yaw; //get angle from my crosshair
if (xOFF < -180)
xOFF+=360;
else if (xOFF > 180)
xOFF-=360;
yOFF = angleY-Local.pitch; //get angle from my crosshair

xPixel = xOFF/0.088;
yPixel = yOFF/0.099;

boxScale = (1024 * 64 / (dist * (2*tan(32.5)))); //get box size

DrawBox(HLDC, screencenter[0]-xPixel, screencenter[1]+yPixel, boxScale, boxScale*2, 0x00CD2626); //draw box
}

I was wondering if anyone could help me out, or give me some hints into the right direction.

zavc0der
11-24-2010, 03:39 AM
"Supericy: enjoy my scripts? click http://www.luascripts.be/ for much higher quality scripts!"

Must be really sick quality. Now you ask help for calculation, so you can sell your ESP :D

Are you serious ?

syntroniks
11-24-2010, 11:52 AM
You're bypassing serverplugins wrong

Supericy
11-24-2010, 12:48 PM
I don't get why people insist on trolling, it's a pretty straight-forward question and i am in need of some help. No one has anything to offer that would point me into the right direction?

Also, that website isn't mine, but a friends; I was merely trying to help him out. Also, I don't see how "scripts" have anything to do with my question, as this isn't even lua.

pingu
11-24-2010, 01:57 PM
There's a few things you're kinda doing wrong, but you have the right idea. As for your World2Screen issue, look into getting the window size ( or screen size if in fullscreen mode ) to fix your resolution issue. There's also a few general C(++) programming issues that I see. Do you mind if I see your Target struct?

Supericy
11-24-2010, 03:53 PM
There's a few things you're kinda doing wrong, but you have the right idea. As for your World2Screen issue, look into getting the window size ( or screen size if in fullscreen mode ) to fix your resolution issue. There's also a few general C(++) programming issues that I see. Do you mind if I see your Target struct?

PM'd, and as for world2screen issue, it's not necessarily a resolution based issue, but just doesn't really draw in correct spot in general.