-
Notifications
You must be signed in to change notification settings - Fork 4
/
speedhack.sma
152 lines (111 loc) · 3.72 KB
/
speedhack.sma
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include <amxmodx>
#include <amxmisc>
#include <engine>
/*
Copyleft 2006
Plugin thread: http://www.amxmodx.org/forums/viewtopic.php?t=21370
SPEEDHACK
=========
Description
This plugin is allows you to move across the map at incredible speeds, as well
as lock onto other players and run right into their faces.
Commands
+speed2 - moves fast in the direction user is looking at
+speed3 - moves fast into the nearest player
CVAR amx_speedhack - enables or disables plugin (0/1)
CVAR amx_speedhack_speed - sets speed of speedhack (1-10)
CVAR amx_speedhack_radius - sets radius to detect players in for +speed3 (1-infinite)
Changelog:
Nov 7, 2005 - v1.0 - Release
Jun 8, 2006 - v1.1 - Cleaned up code, made more useful
*/
enum
{
// Player is not speedhacking
NONE = 0,
// Player is moving forward, or in the direction they're looking
FORWARD,
// Player is moving into the closest player
FOLLOW
}
new g_iSpeed[33]
new g_pSpeedhack
new g_pSpeedhackSpeed
new g_pSpeedhackRadius
public plugin_init()
{
register_plugin("Speedhack","1.1","Hawk552")
g_pSpeedhack = register_cvar("amx_speedhack","1")
g_pSpeedhackSpeed = register_cvar("amx_speedhack_speed","5")
g_pSpeedhackRadius = register_cvar("amx_speedhack_radius","99999")
register_concmd("+speed2","fnSetSpeed",ADMIN_BAN,"- turns speed on while button held")
register_concmd("-speed2","fnSetSpeed",ADMIN_BAN,"- turns speed off when +speed2 released")
register_concmd("+speed3","fnSetFollow",ADMIN_BAN,"- turns follow on while button held")
register_concmd("-speed3","fnSetFollow",ADMIN_BAN,"- turns follow off when +follow released")
}
public client_disconnect(id)
g_iSpeed[id] = false
public fnSetSpeed(id,level,cid)
{
if(!cmd_access(id,level,cid,1) || !get_pcvar_num(g_pSpeedhack))
return PLUGIN_HANDLED
new szArg[2]
read_argv(0,szArg,1)
if(szArg[0] == '+')
g_iSpeed[id] = FORWARD
else
g_iSpeed[id] = NONE
return PLUGIN_HANDLED
}
public fnSetFollow(id,level,cid)
{
if(!cmd_access(id,level,cid,1) || !get_pcvar_num(g_pSpeedhack))
return PLUGIN_HANDLED
new szArg[2]
read_argv(0,szArg,1)
if(szArg[0] == '+')
g_iSpeed[id] = FOLLOW
else
g_iSpeed[id] = NONE
return PLUGIN_HANDLED
}
public client_PreThink(id)
{
if(g_iSpeed[id] == NONE || !get_pcvar_num(g_pSpeedhack))
return PLUGIN_CONTINUE
if(g_iSpeed[id] == FORWARD)
{
new Float:vVelocity[3],vTargetOrigin[3],vUserOrigin[3],iSpeed = get_pcvar_num(g_pSpeedhackSpeed)
get_user_origin(id,vTargetOrigin,2)
get_user_origin(id,vUserOrigin,0)
vTargetOrigin[0] -= vUserOrigin[0]
vTargetOrigin[0] *= iSpeed
vTargetOrigin[1] -= vUserOrigin[1]
vTargetOrigin[1] *= iSpeed
vTargetOrigin[2] = clamp(vTargetOrigin[2],-20,0)
IVecFVec(vTargetOrigin,vVelocity)
entity_set_vector(id,EV_VEC_velocity,vVelocity)
}
else
{
new iEnt,Float:vUserOrigin[3],Float:vEntOrigin[3],Float:flRadius = get_pcvar_float(g_pSpeedhackRadius),szClassname[8],Float:vTrace[3],iSpeed = get_pcvar_num(g_pSpeedhackSpeed)
entity_get_vector(id,EV_VEC_origin,vUserOrigin)
while((iEnt = find_ent_in_sphere(iEnt,vUserOrigin,flRadius)) != 0)
{
entity_get_string(iEnt,EV_SZ_classname,szClassname,7)
if(!equali(szClassname,"player"))
continue
entity_get_vector(iEnt,EV_VEC_origin,vEntOrigin)
if(!trace_line(id,vUserOrigin,vEntOrigin,vTrace))
continue
vEntOrigin[0] -= vUserOrigin[0]
vEntOrigin[0] *= iSpeed
vEntOrigin[1] -= vUserOrigin[1]
vEntOrigin[1] *= iSpeed
vEntOrigin[2] = float(clamp(floatround(vUserOrigin[2]),-20,0))
entity_set_vector(id,EV_VEC_velocity,vEntOrigin)
break
}
}
return PLUGIN_CONTINUE
}