-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbhop.sp
70 lines (62 loc) · 1.54 KB
/
bhop.sp
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
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <shavit>
#pragma semicolon 1
float gF_TimeSinceLastJump[MAXPLAYERS];
bool gB_GiveJump[MAXPLAYERS];
public void OnPluginStart()
{
HookEvent("player_jump", OnPlayerJump);
}
public void OnPlayerJump(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
gF_TimeSinceLastJump[client] = 0.0;
}
public void OnClientPutInServer(int client)
{
gF_TimeSinceLastJump[client] = 0.0;
gB_GiveJump[client] = false;
}
public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track, int style, stylesettings_t stylesettings, int mouse[2])
{
if(stylesettings.bAutobhop)
{
if(GetEntityMoveType(client) != 0)
{
if(buttons & IN_JUMP == IN_JUMP)
{
if((GetEntityFlags(client) & FL_ONGROUND) != 0)
{
gF_TimeSinceLastJump[client] = GetEngineTime();
buttons &= ~IN_JUMP;
return Plugin_Changed;
}
}
else if(GetEngineTime() - gF_TimeSinceLastJump[client] < 0.05)
{
if(GetEntityFlags(client) & FL_ONGROUND > 0)
{
buttons |= IN_JUMP;
}
}
}
}
return Plugin_Continue;
}
stock float GetClientSpeedSq( int client )
{
float x = GetEntPropFloat( client, Prop_Send, "m_vecVelocity[0]" );
float y = GetEntPropFloat( client, Prop_Send, "m_vecVelocity[1]" );
return x*x + y*y;
}
stock float GetClientSpeed( int client )
{
float speed = SquareRoot( x*x + y*y; );
if(IsFakeClient(client))
{
speed -= 15.0;
}
return speed;
}