Originally posted by Logic81
void DrawBorderBox(float x, float y, float width, float height, float size, float* sColor)
{
DrawShader(x - width / 2, y, width, size, sColor, "white"); //top
DrawShader(x - width / 2, y + height, width, size, sColor, "white"); //bottom
DrawShader(x - width / 2, y, size, height, sColor, "white"); //left
DrawShader(x + width / 2, y, size, height, sColor, "white"); //right
}
void DrawFillBox(float x, float y, float width, float height, float size, Color sColorz)
{
float modShad3[4] = { sColorz.r, sColorz.g, sColorz.b, sColorz.a - 0.7 };
DrawShader(x - width / 2, y, width, height, modShad3, "white"); //top
}
float* cCtF(Color acolor)
{
float myColor[4] = { acolor.r, acolor.g, acolor.b, acolor.a };
return myColor;
}
Color FtC(float acolor[4])
{
Color rCol = { acolor[0], acolor[1], acolor[2], acolor[3] };
return rCol;
}
void DrawESP(int x, int y, float distance, Color sColor){
int width = 18100/distance;
int height = 36000/distance;
DrawBorderBox(x, y, width, height, 1, cCtF(sColor));
}
void DrawEBox(int x, int y, float distance, Color sbColor){
int width = 18100/distance;
int height = 36000/distance;
DrawFillBox(x, y, width, height, 1, sbColor);
}
float yMod(float yTarget, float ySelf)
{
float rYMod;
rYMod = (ySelf - yTarget) * 0.19;
return rYMod;
}
void draw_line(float x1, float y1, float x2, float y2, Color col, void * shader, float size)
{
float x, y, angle, l1, l2, h1;
h1 = (y2 - y1);
l1 = (x2 - x1);
l2 = sqrt(l1 * l1 + h1 * h1);
x = (x1 + ((l1 - l2) / 2));
y = (y1 + (h1 / 2));
angle = Atan(h1 / l1) * 180 / 3.14159265358979323846;
R_AddCmdDrawStretchPicRotateXY(x, y, l2, size, 0.0f, 0.0f, 0.0f, 0.0f, angle, (float*)&col, shader);
}
void DrawBone(int Entity, char* from, char* to, Color Color)
{
Vector2 FromCoords, ToCoords;
if (WorldPosToScreenPos(0, &GetTagPos(Entity, from), &FromCoords) && WorldPosToScreenPos(0, &GetTagPos(Entity, to), &ToCoords))
draw_line(FromCoords.x, FromCoords.y, ToCoords.x, ToCoords.y, Color, Material_RegisterHandle("white", 0, 0, 0), 1);
}
void DoAllBones(int i, Color ESPColor)
{
DrawBone(i, "j_knee_le", "pelvis", ESPColor);
DrawBone(i, "j_elbow_ri", "j_wrist_ri", ESPColor);
DrawBone(i, "j_neck", "j_elbow_ri", ESPColor);
DrawBone(i, "j_ankle_ri", "j_knee_ri", ESPColor);
DrawBone(i, "j_elbow_le", "j_wrist_le", ESPColor);
DrawBone(i, "j_ankle_le", "j_knee_le", ESPColor);
DrawBone(i, "j_knee_ri", "pelvis", ESPColor);
DrawBone(i, "pelvis", "j_neck", ESPColor);
DrawBone(i, "j_neck", "j_elbow_le", ESPColor);
DrawBone(i, "j_neck", "j_head", ESPColor);
}
void MakeLines(Vector3 Origin, float X1, float Y1, float Z1, float X2, float Y2, float Z2, Color sColor)
{
Vector2 Screen1, Screen2;
Vector3 Origin1(Origin.x + X1, Origin.y + Y1, (Origin.z + Z1) - 50);
Vector3 Origin2(Origin.x + X2, Origin.y + Y2, (Origin.z + Z2) - 50);
if (WorldPosToScreenPos(0, &Origin1, &Screen1))
{
if (WorldPosToScreenPos(0, &Origin2, &Screen2))
{
draw_line(Screen1.x, Screen1.y, Screen2.x, Screen2.y, sColor, Material_RegisterHandle("white", 0, 0, 0), 1);
}
}
}
void DrawSnapLine(int i, Color sColor, float x, float y){
draw_line(x,y,slX,slY,sColor,Material_RegisterHandle("white",0,0,0), 1);
}
float d3x = 35;
float d3y = 245;
bool nIsVisible()
{
if (AimTarget_isTargetVisible(0, Centity(NearstPlayer)))
return true;
else
return false;
}
char getCurrentWeapon(int playerID)
{
int goToInt = GetPointer(GLOBAL_CLIENT_PTR_ADDR) + 0x55AB3 + (0x990 * playerID);
return *(char*)goToInt;
}
void DrawESPText(int textType, int Client, float vx, float vy, Color scoller)
{
cgs* cg_s = Get_cgs();
float uColor[4] = { scoller.r, scoller.g, scoller.b, scoller.a};
char boolBuff[256];
Snprintf(boolBuff, sizeof(boolBuff), "%f", Distance3D(GetTagPos(LocalPlayer, "j_neck"), GetTagPos(Client, "j_neck")));
const char * BoolText = boolBuff;
switch (textType)
{
case 0:
DrawText(gClis(Client), "fonts/720/normalfont", vx + ((18100/Distance3D(GetPlayerOrigin(LocalPlayer), GetPlayerOrigin(Client)))/2), vy, 0.4, uColor);
break;
case 1:
DrawText(BoolText, "fonts/720/normalfont", vx + ((18100/Distance3D(GetPlayerOrigin(LocalPlayer), GetPlayerOrigin(Client)))/2), vy, 0.4, uColor);
break;
case 2:
DrawText(convWep(getCurrentWeapon(Client)), "fonts/720/normalfont", vx + ((18100/Distance3D(GetPlayerOrigin(LocalPlayer), GetPlayerOrigin(Client)))/2), vy, 0.4, uColor);
break;
}
}
void targText()
{
cgs* cg_s = Get_cgs();
char* tText;
if (cDraw)
{
char tBuff[3096];
Snprintf(
tBuff, 2048, "Target Info\nName: %s\nWeapon: %s\nDistace: %f\nIs Visible: %s",
gClis(NearstPlayer), convWep(getCurrentWeapon(NearstPlayer)),
Distance3D(GetPlayerOrigin(NearstPlayer), GetPlayerOrigin(LocalPlayer)),
nIsVisible()?"true":"false"
);
if (tBuff != "")
tText = tBuff;
else
tText = "Target Info\nerror";
cDraw = false;
}
else
{
tText = "Target Info\nN/A";
}
DrawText(tText, "fonts/720/normalfont", d3x + 5, d3y + 25, 0.45, mTextColor);
}
void BoxAroundPlayer(Vector3 Center, float W, float H, Color sColor, int toe, int target, float x, float y, float distance)
{
if (toe == 1)
{
DrawESP(x, y, distance, sColor);
}
else if (toe == 2)
{
DrawESP(x, y, distance, cBlack);
Color saColor = sColor;
DrawEBox(x, y, distance, saColor);
}
else if (toe == 0)
{
MakeLines(Center, -W, -W, 0, W, -W, 0, sColor);
MakeLines(Center, -W, -W, 0, -W, -W, H, sColor);
MakeLines(Center, W, -W, 0, W, -W, H, sColor);
MakeLines(Center, -W, -W, H, W, -W, H, sColor);
MakeLines(Center, -W, -W, 0, -W, W, 0, sColor);
MakeLines(Center, W, W, 0, W, -W, 0, sColor);
MakeLines(Center, W, W, 0, -W, W, 0, sColor);
MakeLines(Center, -W, W, 0, -W, W, H, sColor);
MakeLines(Center, W, W, 0, W, W, H, sColor);
MakeLines(Center, -W, -W, H, -W, W, H, sColor);
MakeLines(Center, W, W, H, W, -W, H, sColor);
MakeLines(Center, W, W, H, -W, W, H, sColor);
}
}
void DrawGlobalESP()
{
Vector2 Screen;
cgs* cg_s = Get_cgs();
for (int i = 0; i < 12; ++i)
{
Vector3 Origin = GetTagPos(i, "j_neck");
Origin.z -= 50;
if(WorldPosToScreenPos(0, &Origin, &Screen) && i != *(int*)(cg_t(0)) && clientIsAlive(i) && entityIsClient(i))
{
float correctY = Screen.y - 36000/Distance3D(GetPlayerOrigin(LocalPlayer), GetPlayerOrigin(i));
if (boneESP)
{
if (CG_IsEntityFriendlyNotEnemy(0, Centity(i)) && TeamCheck)
{
if (FriendESP)
DoAllBones(i, bESP);
}
else
{
DoAllBones(i, bESP);
}
}
if (EnemyESP)
{
if (!CG_IsEntityFriendlyNotEnemy(0, Centity(i)))
{
if (AimTarget_isTargetVisible(0, Centity(i)))
{
BoxAroundPlayer(GetTagPos(i, "j_neck"), 13, 60, vESP, ESPTYPE, i, Screen.x, correctY, Distance3D(GetPlayerOrigin(i), GetPlayerOrigin(LocalPlayer)));
}
else
{
BoxAroundPlayer(GetTagPos(i, "j_neck"), 13, 60, eESP, ESPTYPE, i, Screen.x, correctY, Distance3D(GetPlayerOrigin(i), GetPlayerOrigin(LocalPlayer)));
}
}
}
if (FriendESP)
{
if (CG_IsEntityFriendlyNotEnemy(0, Centity(i)) && TeamCheck)
{
BoxAroundPlayer(GetTagPos(i, "j_neck"), 13, 60, fESP, ESPTYPE, i, Screen.x, correctY, Distance3D(GetPlayerOrigin(i), GetPlayerOrigin(LocalPlayer)));
}
}
if (NameESP)
{
if (CG_IsEntityFriendlyNotEnemy(0, Centity(i)) && TeamCheck)
{
if (FriendESP)
DrawESPText(0, i, Screen.x+15, Screen.y-5, fESP);
}
else
{
if (AimTarget_isTargetVisible(0, Centity(i)))
{
DrawESPText(0, i, Screen.x+15, Screen.y-5, vESP);
}
else
{
DrawESPText(0, i, Screen.x+15, Screen.y-5, eESP);
}
}
}
if (distanceESP)
{
if (CG_IsEntityFriendlyNotEnemy(0, Centity(i)) && TeamCheck)
{
if (FriendESP)
DrawESPText(1, i, Screen.x+15, Screen.y+5, fESP);
}
else
{
if (AimTarget_isTargetVisible(0, Centity(i)))
{
DrawESPText(1, i, Screen.x+15, Screen.y+5, vESP);
}
else
{
DrawESPText(1, i, Screen.x+15, Screen.y+5, eESP);
}
}
}
if (weapESP)
{
if (CG_IsEntityFriendlyNotEnemy(0, Centity(i)) && TeamCheck)
{
if (FriendESP)
DrawESPText(2, i, Screen.x+15, Screen.y+15, fESP);
}
else
{
if (AimTarget_isTargetVisible(0, Centity(i)))
{
DrawESPText(2, i, Screen.x+15, Screen.y+15, vESP);
}
else
{
DrawESPText(2, i, Screen.x+15, Screen.y+15, eESP);
}
}
}
if (lineESP)
{
if (AimTarget_isTargetVisible(0, Centity(i)))
{
if (!CG_IsEntityFriendlyNotEnemy(0, Centity(i)) && TeamCheck)
{
DrawSnapLine(i, vESP, Screen.x, Screen.y);
}
else if (CG_IsEntityFriendlyNotEnemy(0, Centity(i))) {
if (FriendESP)
DrawSnapLine(i, fESP, Screen.x, Screen.y);
}
}
else
{
if (!CG_IsEntityFriendlyNotEnemy(0, Centity(i)) && TeamCheck)
{
DrawSnapLine(i, eESP, Screen.x, Screen.y);
}
else if (CG_IsEntityFriendlyNotEnemy(0, Centity(i))) {
if (FriendESP)
DrawSnapLine(i, fESP, Screen.x, Screen.y);
}
}
}
}
}
}