it shouldnt do that .. in line 351: if ($e_degree_from_me[j].abs < 15) .. this 15 is fov limit(15degreeses from left and right).
inaccurate? .. i got 4 headshost in row with m1g(long distance).
Code:
#pragma once
#ifdef LAVA_EXPORTS
#define LAVA_API __declspec(dllexport)
#else
#define LAVA_API __declspec(dllimport)
#endif
#include <Windows.h>
#ifdef __cplusplus
extern "C" {
#endif
LAVA_API void write_crap(HANDLE hangle, int addr, char* write, int degreey_has_to_be, char *write2);
LAVA_API long c_get_enemy_degreey1(int degreey_has_to_be, char *f_opposite, char *f_H, int from_head);
LAVA_API long c_get_enemy_degreey2(int degreey_has_to_be, char *f_opposite, char *f_H, int from_head);
LAVA_API long c_get_enemy_degree(char *f_opposite, char *f_H);
LAVA_API void draw_rect(HDC hddc, int x, int y);
LAVA_API void draw_line(HDC hddc, char *f_degree, int Hyp, int xxx, int yyy);
#ifdef __cplusplus
}
#endif
#include <stdio.h>
#include <math.h>
char buffer[33];
#define PI 3.14159265
void write_crap(HANDLE hangle, int addr, char* write, int degreey_has_to_be, char *write2) {
float f_write = atof(write);
float f_write2 = atof(write2);
//sprintf(write, "%f", f_write);
//MessageBoxA(0, write, "", 0);
f_write2 = (((1.396263361 * 2) / degreey_has_to_be) * (f_write2 > degreey_has_to_be ? degreey_has_to_be : f_write2)) - 1.396263361;
if (f_write < 6.283091667 && f_write > -6.283091667 && f_write2 < 1.396263361 && f_write2 > -1.396263361) {
WriteProcessMemory(hangle, (LPVOID)(addr + 0x4C4), &f_write, sizeof(f_write), 0);
WriteProcessMemory(hangle, (LPVOID)(addr + 0x4C8), &f_write2, sizeof(f_write2), 0);
}
}
long c_get_enemy_degreey1(int degreey_has_to_be, char *f_opposite, char *f_H, int from_head) {
//char ret_val[33];
float opposite = atof(f_opposite);
float H = atof(f_H);
float enemy_degree = (degreey_has_to_be / 2) - (asin(opposite / H) * 180.0 / PI) + (from_head / H) + (asin(opposite / H) * 180.0 / PI / H);
//sprintf(ret_val, "%f", enemy_degree);
long ret_val = (long)(enemy_degree * 10000);
return ret_val;
}
long c_get_enemy_degreey2(int degreey_has_to_be, char *f_opposite, char *f_H, int from_head) {
//char ret_val[33];
float opposite = atof(f_opposite);
float H = atof(f_H);
float enemy_degree = (degreey_has_to_be / 2) + (asin(opposite / H) * 180.0 / PI) + (from_head / H) - (asin(opposite / H) * 180.0 / PI / H);
//sprintf(ret_val, "%f", enemy_degree);
long ret_val = (long)(enemy_degree * 10000);
return ret_val;
}
long c_get_enemy_degree(char *f_opposite, char *f_H) {
float opposite = atof(f_opposite);
float H = atof(f_H);
float enemy_degree = (asin(opposite / H) * 180.0 / PI);
long ret_val = (long)(enemy_degree * 10000);
return ret_val;
}
HBRUSH greenBrush = NULL;
void draw_rect(HDC hddc, int x, int y) {
if (greenBrush == NULL) greenBrush = CreateSolidBrush(RGB(0, 255, 0));
RECT rect = {x, y, x +2, y +2};
FillRect(hddc, &rect, greenBrush);
}
void drawLine(HDC hddc, int x1, int y1, int x2, int y2) {
HPEN pen, oldPen;
pen = CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
oldPen = (HPEN)SelectObject(hddc, pen);
MoveToEx(hddc, x1, y1, NULL);
LineTo(hddc, x2, y2);
SelectObject(hddc, oldPen);
DeleteObject(pen);
}
void draw_line(HDC hddc, char *f_degree, int Hyp, int xxx, int yyy) {
float degree = atof(f_degree);
if (degree <= 90) {
float adjacent = Hyp * cos(degree * PI / 180.0);
float opposite = Hyp * sin(degree * PI / 180.0);
drawLine(hddc, xxx, yyy, xxx - opposite, yyy + adjacent);
} else if (degree <= 180) {
float adjacent = Hyp * cos((degree - 90) * PI / 180.0);
float opposite = Hyp * sin((degree - 90) * PI / 180.0);
drawLine(hddc, xxx, yyy, xxx - adjacent, yyy - opposite);
} else if (degree <= 270) {
float adjacent = Hyp * cos((degree - 180) * PI / 180.0);
float opposite = Hyp * sin((degree - 180) * PI / 180.0);
drawLine(hddc, xxx, yyy, xxx + opposite, yyy - adjacent);
} else if (degree <= 360) {
float adjacent = Hyp * cos((degree - 270) * PI / 180.0);
float opposite = Hyp * sin((degree - 270) * PI / 180.0);
drawLine(hddc, xxx, yyy, xxx + adjacent, yyy + opposite);
}
}