This is a source code, for all noobs out there, don't ask how to use it!
001 // -------------------------------------------------------------------------------- //
002 // CAimbot/ESP by Capt. Micro
003 // -------------------------------------------------------------------------------- //
004 class CAimbot
005 {
006 public:
007 CAimbot();
008 ~CAimbot();
009 bool bShowRays;
010 bool bAimbot;
011 bool bFindHits;
012 bool bEsp;
013 float fMaxDist;
014 IVDebugOverlay *debugoverlay;
015 bool ReadyForUse(void);
016 void ModifyUserCmd(CUserCmd *cmd);
017 void DrawEspOverlay(void);
018 //private:
019 C_BaseEntity *target;
020 C_BaseEntity *local;
021 bool AimbotTraceRay(C_BaseEntity *ent, Vector &start, Vector &end);
022 void AimbotGetAimPos(C_BaseEntity *ent, Vector &out);
023 void AimbotGetAimAngle(C_BaseEntity *ent, QAngle &out);
024 bool IsVisibleToLocalPlayer(C_BaseEntity *ent);
025 void AimbotGetTarget(void);
026 };
027 CAimbot::CAimbot()
028 {
029 bShowRays = true;
030 bAimbot = false;
031 bFindHits = false;
032 bEsp = true;
033 fMaxDist = 4096.0f;
034 debugoverlay = 0;
035 target = 0;
036 local = 0;
037 }
038 CAimbot::~CAimbot()
039 {
040 bShowRays = false;
041 bAimbot = false;
042 bFindHits = false;
043 bEsp = false;
044 fMaxDist = 0.0f;
045 debugoverlay = 0;
046 target = 0;
047 local = 0;
048 }
049 bool CAimbot::ReadyForUse(void)
050 {
051 return (local != 0) || (debugoverlay != 0);
052 }
053 void CAimbot::ModifyUserCmd(CUserCmd *cmd)
054 {
055 if ((!bAimbot) || (target == 0) || (local == 0)) return;
056
057 QAngle aimang;
058 AimbotGetAimAngle(target, aimang);
059 cmd->viewangles = aimang;
060 }
061 bool CAimbot::AimbotTraceRay(C_BaseEntity *ent, Vector &start, Vector &end)
062 {
063 Ray_t ray;
064 trace_t trace;
065 Vector scr;
066 ray.Init(start, end);
067 UTIL_TraceRay(ray, MASK_SHOT, local->GetBaseEntity(),
068 COLLISION_GROUP_NONE, &trace);
069 bool valid = (trace.m_pEnt == ent) && (ScreenTransform(end, scr) == 0);
070 if (bShowRays && (debugoverlay != 0))
071 debugoverlay->AddLineOverlay(start, end, (valid?0:255), (valid?255:0), 0, true, 0.1f);
072 return valid;
073 }
074 void CAimbot::AimbotGetAimPos(C_BaseEntity *ent, Vector &out)
075 {
076 ent->EntityToWorldSpace(ent->CollisionProp()->OBBCenter(), &out);
077 if (ent == local->GetBaseEntity())
078 {
079 out = local->EyePosition();
080 }
081 else
082 {
083 if (bFindHits)
084 {
085 Vector lbottom, wbottom;
086 lbottom = ent->CollisionProp()->OBBMins();
087 lbottom.x = abs(lbottom.x) / 2;
088 lbottom.y = abs(lbottom.y) / 2;
089 ent->EntityToWorldSpace(lbottom, &wbottom);
090 Vector ltop, wtop;
091 ltop = ent->CollisionProp()->OBBMaxs();
092 ltop.x = abs(ltop.x) / 2;
093 ltop.y = abs(ltop.y) / 2;
094 ent->EntityToWorldSpace(ltop, &wtop);
095 Vector wscan = wtop;
096 Vector lpAimPos;
097 AimbotGetAimPos(local, lpAimPos);
098 for (; wscan.z <= wtop.z && wscan.z >= wbottom.z; wscan.z -= 1.0f)
099 {
100 if (AimbotTraceRay(ent, lpAimPos, wscan)) {
101 if (bShowRays && (debugoverlay != 0))
102 debugoverlay->AddLineOverlay(lpAimPos, wscan, 0, 255, 0, true, 0.1f);
103 out = wscan;
104 return;
105 }
106 }
107 return;
108 }
109
110 out = ent->EyePosition();
111 if (ent->BoundingRadius() >= 16) out.z -= 8;
112 }
113 }
114 bool CAimbot::IsVisibleToLocalPlayer(C_BaseEntity *ent)
115 {
116 Vector start, end;
117 AimbotGetAimPos(local, start);
118 AimbotGetAimPos(ent, end);
119 return AimbotTraceRay(ent, start, end);
120 }
121 void CAimbot::AimbotGetAimAngle(C_BaseEntity *ent, QAngle &out)
122 {
123 Vector epos, lpos;
124 AimbotGetAimPos(ent, epos);
125 AimbotGetAimPos(local, lpos);
126 VectorAngles((epos - lpos), out);
127 }
128 void CAimbot::AimbotGetTarget(void)
129 {
130 if (!bAimbot || (local == 0)) return;
131
132 C_BaseEntity *scanner[256];
133 int ent_count = UTIL_EntitiesInSphere(scanner, 256,
134 local->GetAbsOrigin(), fMaxDist, 0);
135 float closest = fMaxDist;
136 for (int i = 0; i < ent_count; i++)
137 {
138 if (target == 0 && (scanner[i] != NULL)
139 && scanner[i]->IsAlive() && scanner[i]->IsNPC()
140 && (scanner[i]->GetMoveType() != MOVETYPE_NONE)
141 && (scanner[i]->GetMoveType() != MOVETYPE_OBSERVER)
142 && IsVisibleToLocalPlayer(scanner[i]))
143 {
144 float dist = local->GetAbsOrigin().DistTo(scanner[i]->GetAbsOrigin());
145 if (dist < closest) { closest = dist; target = scanner[i]; }
146 break;
147 }
148 else if (target != 0)
149 {
150 if ((scanner[i] == target) &&
151 (!scanner[i]->IsAlive() || !scanner[i]->IsNPC()
152 || (scanner[i]->GetMoveType() == MOVETYPE_NONE)
153 || (scanner[i]->GetMoveType() == MOVETYPE_OBSERVER)
154 || !IsVisibleToLocalPlayer(scanner[i])))
155 {
156 target = 0;
157 break;
158 }
159 }
160 }
161 }
162 void CAimbot::DrawEspOverlay(void)
163 {
164 if (debugoverlay != 0)
165 {
166 debugoverlay->AddScreenTextOverlay(0.005f, 0.005f, 0.1f,
167 0, 0, 255, 200, "CAimbot/ESP");
168 debugoverlay->AddScreenTextOverlay(0.005f, 0.020f, 0.1f,
169 bAimbot?0:255, bAimbot?255:0, 0, 200, "bAimbot");
170 debugoverlay->AddScreenTextOverlay(0.005f, 0.030f, 0.1f,
171 bEsp?0:255, bEsp?255:0, 0, 200, "bEsp");
172 debugoverlay->AddScreenTextOverlay(0.005f, 0.040f, 0.1f,
173 bFindHits?0:255, bFindHits?255:0, 0, 200, "bFindHits");
174 debugoverlay->AddScreenTextOverlay(0.005f, 0.050f, 0.1f,
175 bShowRays?0:255, bShowRays?255:0, 0, 200, "bShowRays");
176 }
177
178 if (!bEsp || (debugoverlay == 0) || (local == 0)) return;
179
180 C_BaseEntity *scanner[256];
181 int ent_count = UTIL_EntitiesInSphere(scanner, 256,
182 local->GetAbsOrigin(), fMaxDist, 0);
183 for (int i = 0; i < ent_count; i++)
184 {
185 if ((scanner[i] != NULL)
186 && scanner[i]->IsAlive() && scanner[i]->IsNPC())
187 {
188 /*Vector vec;
189 AimbotGetAimPos(scanner[i], vec);
190 debugoverlay->AddTextOverlayRGB(vec, 0, 0.05f, 0, 0, 255, 200, "^");*/
191 CCollisionProperty *pCollide = scanner[i]->CollisionProp();
192 if (pCollide == 0) continue;
193 debugoverlay->AddBoxOverlay(scanner[i]->GetAbsOrigin(),
194 pCollide->OBBMins(), pCollide->OBBMaxs(),
195 scanner[i]->GetAbsAngles(), 255, 0, 0, 5, 0.1f);
196 }
197 }
198
199 if (target != 0)
200 {
201 CCollisionProperty *pCollide = target->CollisionProp();
202 debugoverlay->AddBoxOverlay(target->GetAbsOrigin(),
203 pCollide->OBBMins(), pCollide->OBBMaxs(),
204 target->GetAbsAngles(), 0, 0, 255, 10, 0.1f);
205 }
206 }
207
208
Last edited by Maui_Hawaii_USA; 05-29-2012 at 11:58 AM.
This is a source code, for all noobs out there, don't ask how to use it!
Ex Middleman
um this was made for hl2... why is it in crysis 2 forums lol?
I made this aimbot for a singleplayer mod, it buggy as fuck (crash after you leave server) and really i doubt would actually *work* in multiplayer. And if your gonna use it i guess here is how (single player ofcourse)
Code://place this where all your globals are float fSelX_CAimbot = 0.02f; float fLast_CAimbot = 0.0f; GAimbot *g_aimbot = 0; //place this in a CreateMove hook, or modify it to work with something else if (IsLocalPlayer() && !IsInVGuiInputMode() && debugoverlay) { if (g_aimbot == 0) g_aimbot = new CAimbot(); debugoverlay->AddScreenTextOverlay(0.000f, fSelX_CAimbot, 0.1f, (pCmd->buttons&IN_WALK)?255:0, 0, 0, 200, ">"); if (pCmd->buttons & IN_WALK) { if ((pCmd->buttons & IN_ZOOM) && (engine->Time() > fLast_CAimbot)) { if (fSelX_CAimbot <= 0.04f) fSelX_CAimbot += 0.01f; else fSelX_CAimbot = 0.02f; fLast_CAimbot = engine->Time() + 0.1f; } else if ((pCmd->buttons & IN_JUMP) && (engine->Time() > fLast_CAimbot)) { if (fSelX_CAimbot == 0.02f) g_aimbot->bAimbot = !g_aimbot->bAimbot; if (fSelX_CAimbot == 0.03f) g_aimbot->bEsp = !g_aimbot->bEsp; if (fSelX_CAimbot == 0.04f) g_aimbot->bFindHits = !g_aimbot->bFindHits; if (fSelX_CAimbot == 0.05f) { Msg("rays\n"); g_aimbot->bShowRays = !g_aimbot->bShowRays; } fLast_CAimbot = engine->Time() + 0.1f; } } if (g_aimbot->local == 0) g_aimbot->local = this; if (g_aimbot->debugoverlay == 0) g_aimbot->debugoverlay = debugoverlay; if (g_aimbot->local == 0) Msg("[CAimbot/ESP] local is NULL\n"); if (g_aimbot->debugoverlay == 0) Msg("[CAimbot/ESP] debugoverlay is NULL\n"); if (g_aimbot->ReadyForUse()) { g_aimbot->DrawEspOverlay(); g_aimbot.AimbotGetTarget(); g_aimbot.ModifyUserCmd(pCmd); } }
Last edited by captmicro; 06-10-2012 at 09:39 PM.
I was going to resale as a VIP and it doesn't work for Crysis 2
TY for that source ill go try it now