forked from TheDoctor0/CSGOMod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsgo_runboost.sma
68 lines (45 loc) · 1.36 KB
/
csgo_runboost.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
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "CS:GO Run Boost"
#define VERSION "1.0"
#define AUTHOR "O'Zone"
new bool:runBoost[MAX_PLAYERS + 1];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_Player_Jump, "player", "player_jump", 0);
register_touch("player", "player", "player_touch");
}
public player_touch(id, player)
{
if (!is_user_alive(id) || !is_user_alive(player)) return FMRES_IGNORED;
static Float:origin[2][3];
pev(id, pev_origin, origin[0]);
pev(player, pev_origin, origin[1]);
new Float:distance = origin[1][2] - origin[0][2];
if (distance > 51.0 && get_user_button(player) & IN_FORWARD) {
new Float:velocity[3];
entity_get_vector(player, EV_VEC_velocity, velocity);
new speed = floatround(vector_length(velocity));
if(speed >= 150) runBoost[player] = true;
} else runBoost[player] = false;
return FMRES_IGNORED;
}
public player_jump(id)
{
static buttonPressed; buttonPressed = get_pdata_int(id, 246);
if (runBoost[id] && buttonPressed & IN_JUMP) {
new Float:velocity[3];
pev(id, pev_velocity, velocity);
velocity[0] *= 1.3;
velocity[1] *= 1.3;
velocity[2] *= 1.2;
set_pev(id, pev_velocity, velocity);
set_pdata_int(id, 246, buttonPressed & ~IN_JUMP);
runBoost[id] = false;
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}