Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "game.h"
- #define TerHax_MaxTargets 8
- typedef dynent* (*cla_iscl)(const vec &from,const vec &to,fpsent *at,float &dist);
- typedef struct { float x, y, z; } TerHax_Pos;
- typedef struct { float p, y, r; } TerHax_Ang;
- typedef struct { TerHax_Pos pos; bool alive; } TerHax_Obj;
- class TerroristHax
- {
- private:
- bool ena_aimbot;
- bool ena_triggerbot;
- bool has_lock;
- float max_dist;
- fpsent *source;
- fpsent *target;
- TerHax_Ang ang2trgt;
- public:
- TerroristHax()
- {
- printf("[$$$] TerroristHax ::: Initalizing\n");
- ena_aimbot = true;
- ena_triggerbot = true;
- has_lock = false;
- max_dist = 5000.0f;
- source = 0;
- target = 0;
- memset(&ang2trgt, 0, sizeof(TerHax_Ang));
- }
- void printstuff()
- {
- static bool initd = false;
- static bool aim;
- static bool trig;
- static float dist;
- if (!initd)
- {
- initd = true;
- aim = false;
- trig = false;
- dist = 0.0f;
- }
- if (ena_aimbot != aim) {
- printf("[$$$] TerroristHax :: Aimbot %s\n", ena_aimbot?"enabled":"disabled");
- aim = ena_aimbot;
- }
- if (ena_triggerbot != trig) {
- printf("[$$$] TerroristHax :: Triggerbot %s\n", ena_aimbot?"enabled":"disabled");
- trig = ena_triggerbot;
- }
- if (max_dist != dist) {
- printf("[$$$] TerroristHax :: Max Dist = %f\n", max_dist);
- dist = max_dist;
- }
- }
- ~TerroristHax()
- {
- printf("[$$$] TerroristHax ::: DeInitalizing\n");
- }
- bool PosVis(TerHax_Pos *from, TerHax_Pos *to)
- {
- vec vecFrom, vecTo, vecHit;
- vecFrom.x = from->x;
- vecFrom.y = from->y;
- vecFrom.z = from->z;
- vecTo.x = to->x;
- vecTo.y = to->y;
- vecTo.z = to->z;
- return raycubelos(vecFrom, vecTo, vecHit);
- }
- bool TriggerBotAttack(cla_iscl iscl, float isdist, fpsent *ply)
- {
- if (!ena_triggerbot) return false;
- dynent *o = iscl(ply->o, worldpos, ply, isdist);
- fpsent *e = (fpsent*)o; vec vecHitpos;
- if (!o || o->type != ENT_PLAYER) return false;
- if (strcmp(ply->team, e->team) == 0) return false;
- if (o->state == CS_DEAD) return false;
- if (!raycubelos(ply->headpos(), e->headpos(), vecHitpos)) return false;
- return true;
- }
- void SelectTarget(fpsent *hudply, vector <fpsent*> players)
- {
- if (!ena_aimbot) return;
- if (!has_lock)
- {
- int i = 0; vec vecHitpos;
- float t = max_dist, dX, dY, dZ, dist;
- for (i = 0; i < players.length(); i++)
- {
- if (players[i]->state != CS_ALIVE) continue;
- if (!raycubelos(hudply->headpos(), players[i]->headpos(), vecHitpos)) continue;
- vec head0 = players[i]->headpos();
- vec head1 = hudply->headpos();
- dX = head0.x - head1.x;
- dY = head0.y - head1.y;
- dZ = head0.z - head1.z;
- dist = sqrt((dX*dX) + (dY*dY) + (dZ*dZ));
- if (dist < t)
- {
- target = players[i];
- source = hudply;
- printf("target: clientnum %d dist %f\n", target->clientnum, dist);
- has_lock = true;
- t = dist;
- }
- }
- }
- else
- {
- vec vecHitpos;
- if (target->state != CS_ALIVE) has_lock = false;
- if (!raycubelos(source->headpos(), target->headpos(), vecHitpos)) has_lock = false;
- }
- }
- TerHax_Ang* Ang2Target()
- {
- if (!ena_aimbot) return 0;
- if (has_lock && target)
- {
- vec head0 = target->headpos();
- vec head1 = source->headpos();
- float dX = head0.x - head1.x;
- float dY = head0.y - head1.y;
- float dZ = head0.z - head1.z;
- float dist = sqrt((dX*dX) + (dY*dY) + (dZ*dZ));
- ang2trgt.p = asin(dZ / dist) / RAD;
- ang2trgt.y = -(float)atan2(dX, dY) / PI * 180.0f;
- printf("has_lock. ang (%f, %f, 0)\n", ang2trgt.p, ang2trgt.y);
- ang2trgt.r = 0.0f;
- return &ang2trgt;
- }
- return 0;
- }
- };
- TerroristHax terroristhax;
- class CLaimbot
- {
- private:
- bool triggerbot;
- fpsent *local;
- fpsent *target;
- float ann_0; //enemy dist / 5000
- float ann_1; //attacking you
- float ann_2; //health / maxhealth
- float ann_3; //armor / maxarmor
- float ann_4; //clip / maxclip
- PVOID annptrs[5];
- public:
- CLaimbot()
- {
- triggerbot = true;
- local = 0;
- target = 0;
- printf("***** Initalized CLaimbot *****\n");
- ann_0 = 1.0f; ann_1 = 1.0f;
- ann_2 = 0.5f; ann_3 = 0.5f;
- ann_4 = 0.5f;
- annptrs[0] = &ann_0;
- annptrs[1] = &ann_1;
- annptrs[2] = &ann_2;
- annptrs[3] = &ann_3;
- annptrs[4] = &ann_4;
- printf("***** CLaimbot annptrs @ 0x%08X *****\n", (DWORD)&annptrs[0]);
- }
- ~CLaimbot()
- {
- printf("***** DeInitalized CLaimbot *****\n");
- }
- bool FindBestTarget(cla_iscl iscl, float isdist, fpsent *ply, vector<fpsent*> players)
- {
- bool attack = false;
- vec vecHitpos;
- local = ply;
- /*if (local->attacking && !local->k_up) local->k_up = true;
- else if (!local->attacking && local->k_up) local->k_up = false;*/
- float maxDist = 99999999;
- loopv(players)
- {
- if (strcmp(players[i]->team, local->team) == 0)
- continue;
- if (players[i]->state == CS_DEAD)
- continue;
- if (!raycubelos(local->headpos(), players[i]->headpos(), vecHitpos))
- continue;
- float dist = local->o.dist(players[i]->o);
- if (triggerbot)
- {
- dynent *o = iscl(local->o, worldpos, local, isdist);
- if (o && o->type == ENT_PLAYER) attack = true;
- }
- ann_0 = dist / 5000.0f;
- if (ann_0 > 1.0f) ann_0 = 1.0f;
- if (ann_0 < 0.0f) ann_0 = 0.0f;
- ann_1 = 0.0f;
- if (players[i]->attacking)
- {
- dynent *o = iscl(players[i]->o, worldpos, players[i], isdist);
- if (o && o->type == ENT_PLAYER)
- {
- vec *hp0 = &o->headpos();
- vec *hp1 = &local->headpos();
- if ((hp0->x == hp1->x) && (hp0->y == hp1->y) && (hp0->z == hp1->z))
- ann_1 = 1.0f;
- }
- }
- ann_2 = (float)local->health / (float)local->maxhealth;
- if (ann_2 > 1.0f) ann_2 = 1.0f;
- ann_3 = (float)local->armour / 250.0f;
- if (ann_3 > 1.0f) ann_3 = 1.0f;
- ann_4 = (float)local->ammo[local->gunselect] / 25.0f;
- if (ann_4 > 1.0f) ann_4 = 1.0f;
- if (dist < maxDist)
- {
- if (!target || target->state != CS_ALIVE)
- {
- target = players[i];
- maxDist = dist;
- }
- }
- }
- return attack;
- }
- void GetPitchYaw(float *pitch, float *yaw)
- {
- if (!target || (target->state != CS_ALIVE)) return;
- vec *vecLocal = &local->headpos();
- vec *vecTarget = &target->headpos();
- float dist = vecLocal->dist(*vecTarget);
- float dX = vecTarget->x-vecLocal->x;
- float dY = vecTarget->y-vecLocal->y;
- float dZ = vecTarget->z-vecLocal->z;
- /*float dist = vecTarget->dist(*vecLocal);
- float dX = vecLocal->x - vecTarget->x;
- float dY = vecLocal->y - vecTarget->y;
- float dZ = vecLocal->z - vecTarget->z;*/
- *pitch = asin(dZ / dist) / RAD;
- *yaw = -(float)atan2(dX, dY) / PI * 180;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement