Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Spelchure committed Jun 9, 2020
1 parent 3c10c4f commit f3a2ee1
Show file tree
Hide file tree
Showing 4 changed files with 367 additions and 98 deletions.
1 change: 1 addition & 0 deletions CSGOInternal/Gateway.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "Hooks/Hooks.hpp"
#include "Settings/Settings.hpp"
#include "MainMenu.hpp"

extern MidFunctionHook* pMidHook;
extern AppSettings* pSettings;
extern MainMenu* pMenu;
Expand Down
83 changes: 50 additions & 33 deletions CSGOInternal/MainLoop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ MainLoop(void)
if (!iEngineClient13->IsInGame()) // Player not in game
return;

localPlayer = iEntityList->GetClientEntity(iEngineClient13->GetLocalPlayer());
int j = iEngineClient13->GetLocalPlayer();
localPlayer = (CEntityPlayer*)iEntityList->GetClientEntity(j);
float distmax = FLT_MAX;
int bestEnemy = -1;
uintptr_t clientState = 0;
Expand All @@ -95,20 +96,31 @@ MainLoop(void)
// Copy view matrix
float viewMatrixCopy[16] = { 0 };
memcpy(&viewMatrixCopy, (PBYTE)sig_dwViewMatrix, sizeof(viewMatrixCopy));


int numberOfEntites = iEntityList->NumberOfEntities(false);

// Loop in entity list
for(int i = 0; i < ENTITY_MAX_PLAYERS; i++) {
CEntityPlayer* ent = iEntityList->GetClientEntity(i);
for(int i = 0; i < numberOfEntites; i++) {
if (i == j) // Skip local
continue;

if (ent == nullptr) // Reached end of the list
break;
CEntityPlayer* ent = (CEntityPlayer*)iEntityList->GetClientEntity(i);

if (ent == nullptr) // Not valid entity
continue;

if (ent == localPlayer) // Skip local player
continue;


if (!ent->IsPlayer()) // Entity is not player
continue;

if (*ent->GetDormant()) //
continue;

if(pSettings->getBool(pSettings->bAimbot)) { // check this.
if (*ent->GetHealth() > 0 && *ent->GetTeam() != *localPlayer->GetTeam() && !(*ent->GetDormant()) &&

if (*ent->GetHealth() > 0 && *ent->GetTeam() != *localPlayer->GetTeam() &&
enemyIsVisible(ent) // Visible for us
) { // VALID ENEMY
Vector myPos;
Expand All @@ -130,40 +142,45 @@ MainLoop(void)
}


if (!IS_VALID_ENT(ent))
continue;
// if (!IS_VALID_ENT(ent))
// continue;

/* Drawing Stuff */
int my_team = *localPlayer->GetTeam();
int en_team = *ent->GetTeam();
if (my_team == en_team) // teammate
if (*ent->GetHealth() > 0) // if enemys health > 0
{
if (pSettings->getBool(pSettings->bESP_mate))
{
//mate esp
ent->DrawESP(viewMatrixCopy, D3DCOLOR_ARGB(255, 0, 255, 0));
}
if (pSettings->getBool(pSettings->bSnaplines_mate))
{
//snaplines mate
ent->DrawSnapline(viewMatrixCopy, 2, D3DCOLOR_ARGB(255, 0, 255, 0));
}
//mybe glow
}
else // enemy
{
if (pSettings->getBool(pSettings->bESP))
int my_team = *localPlayer->GetTeam();
int en_team = *ent->GetTeam();

if (my_team == en_team) // teammate
{
//enemy esp
ent->DrawESP(viewMatrixCopy, D3DCOLOR_ARGB(255, 255,0, 0));
if (pSettings->getBool(pSettings->bESP_mate))
{
//mate esp
ent->DrawESP(viewMatrixCopy, D3DCOLOR_ARGB(255, 0, 255, 0));
}
if (pSettings->getBool(pSettings->bSnaplines_mate))
{
//snaplines mate
ent->DrawSnapline(viewMatrixCopy, 2, D3DCOLOR_ARGB(255, 0, 255, 0));
}
//maybe glow
}
if (pSettings->getBool(pSettings->bSnaplines))
else // enemy
{
//enemy snaplines
ent->DrawSnapline(viewMatrixCopy, 2, D3DCOLOR_ARGB(255, 255, 0, 0));
if (pSettings->getBool(pSettings->bESP))
{
//enemy esp
ent->DrawESP(viewMatrixCopy, D3DCOLOR_ARGB(255, 255, 0, 0));
}
if (pSettings->getBool(pSettings->bSnaplines))
{
//enemy snaplines
ent->DrawSnapline(viewMatrixCopy, 2, D3DCOLOR_ARGB(255, 255, 0, 0));
}
}
}



}

Expand Down
67 changes: 3 additions & 64 deletions CSGOInternal/Source SDK/EntityPlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
*********************************************************************/
#pragma once
#include "Netvars.hpp"
#include "Interfaces.hpp"
#include "../D3D9/Drawing.hpp"

#include <string>
#pragma warning (disable : 4244)

extern uintptr_t _netvarOffsets[netvarOffsetsLength];
Expand All @@ -41,68 +42,6 @@ netvar(uintptr_t netVar)
return _netvarOffsets[netVar];
}

class CEntityPlayer {
public:
int * GetHealth() {
return (int*)((uintptr_t)this + netvar(m_iHealth));
}
int * GetTeam() {
return (int*)((uintptr_t)this + netvar(m_iTeamNum));
}
bool *GetDormant() {
return (bool*)((uintptr_t)this + sig_bDormant);
}
int8_t GetFlags() {
return *(int8_t*)((uintptr_t)this + netvar(m_fFlags));
}
int *GetFlashDuration() {
return (int*)((uintptr_t)this + netvar(m_flFlashDuration));
}
Vector * GetVecOrigin() {
return (Vector*)((uintptr_t)this + netvar(m_vecOrigin));
}
Vector * GetViewOffset(){
return (Vector*)((uintptr_t)this + netvar(m_vecViewOffset));
}
Vector * GetBonePos(int boneID) {
uint32_t boneMatrix = *(uintptr_t*)((uintptr_t)this + netvar(m_dwBoneMatrix));
static Vector3 bonePos;
bonePos.x = *(float*)(boneMatrix + 0x30 * boneID + 0x0C);
bonePos.y = *(float*)(boneMatrix + 0x30 * boneID + 0x1C);
bonePos.z = *(float*)(boneMatrix + 0x30 * boneID + 0x2C);
return &bonePos;
}
Vector2 * GetAimPunchAngles() const {
return (Vector2*)((uintptr_t)this + netvar(m_aimPunchAngle));
}
void GetViewAngles(Vector &ang) {
Vector vecOrigin = *this->GetVecOrigin();
ang = vecOrigin + *this->GetViewOffset();
}
/* DRAWING */

void DrawESP(float* v, D3DCOLOR color)
{
Vector vHead = *this->GetBonePos(8);
vHead.z += 8;
Vector vOrigin = *this->GetVecOrigin();
Vector2 vScreen, vHead2;

if(pDrawing->World2Screen(v,vOrigin, vScreen)) {
if(pDrawing->World2Screen(v,vHead,vHead2)) {
pDrawing->DrawEspBox(vScreen, vHead2, 2, color);
}
}
}

void DrawSnapline(float* v, int thick, D3DCOLOR color)
{
Vector vOrigin = *this->GetVecOrigin();
Vector2 entPos;
class IClientEntity;

if(pDrawing->World2Screen(v,vOrigin,entPos))
pDrawing->DrawLine(entPos.x, entPos.y, pDrawing->screen_w / 2, pDrawing->screen_h , thick, color);

}

};
Loading

0 comments on commit f3a2ee1

Please sign in to comment.