forked from KaylinOwO/projectnacl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriggerbot.cpp
More file actions
95 lines (68 loc) · 1.81 KB
/
Triggerbot.cpp
File metadata and controls
95 lines (68 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "Triggerbot.h"
#include "Util.h"
CTriggerbot gTrigger;
bool didHit = false;
int iDelay = 0;
void CTriggerbot::Run(CBaseEntity* pLocal, CUserCmd* pCommand)
{
if (pLocal->GetLifeState() != LIFE_ALIVE)
return;
if (GAME_TF2)
{
CBaseCombatWeapon* pWep = pLocal->GetActiveWeapon();
if (backstab.value)
if (pLocal->szGetClass() == "Spy" && pWep->GetSlot() == 2 && pWep->CanBackStab())
pCommand->buttons |= IN_ATTACK;
}
if (!enabled.value)
return;
if (!Util->IsKeyPressedMisc(key.value))
return;
Vector vAim;
gInts.Engine->GetViewAngles(vAim); //We use getviewangles so that this can work with anti-aim
Vector vForward;
AngleVectors(vAim, &vForward);
if (GAME_TF2)
{
CBaseCombatWeapon* pWep = pLocal->GetActiveWeapon();
auto pClass = pWep->GetItemDefinitionIndex();
if (pWep->GetSlot() == 2)
vForward = vForward * 8 + pLocal->GetEyePosition();
else if (pLocal->szGetClass() == "Pyro" && pClass != 1178 && pWep->GetSlot() == 0)
vForward = vForward * 17 + pLocal->GetEyePosition();
else
vForward = vForward * 9999 + pLocal->GetEyePosition();
}
else
vForward = vForward * 9999 + pLocal->GetEyePosition();
Ray_t ray;
trace_t trace;
CTraceFilter filt;
filt.pSkip = pLocal;
ray.Init(pLocal->GetEyePosition(), vForward);
gInts.EngineTrace->TraceRay(ray, 0x46004003, &filt, &trace);
if (!trace.m_pEnt)
return;
if (trace.hitgroup < 1)
return;
if (GAME_TF2)
if (cloaked.value && trace.m_pEnt->GetCond() & TFCond_Cloaked)
return;
if (trace.m_pEnt->GetTeamNum() == pLocal->GetTeamNum())
return;
if (headonly.value && trace.hitbox != 0)
return;
if (!delay.value)
pCommand->buttons |= IN_ATTACK;
else
{
if (trace.hitbox > -1)
didHit = true;
if (iDelay >= delay.value && didHit)
{
iDelay = 0;
pCommand->buttons |= IN_ATTACK;
}
iDelay++;
}
}