-
Notifications
You must be signed in to change notification settings - Fork 2
/
heightcounter.sp
42 lines (32 loc) · 1.04 KB
/
heightcounter.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
#include "sourcemod"
#include "sdktools"
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{
if(IsFakeClient(client))
return Plugin_Continue;
static float prevheight[MAXPLAYERS], ground[MAXPLAYERS];
static float orig[3];
GetClientAbsOrigin(client, orig);
if(GetEntityFlags(client) & FL_ONGROUND)
{
prevheight[client] = -99999999.0;
ground[client] = orig[2];
return Plugin_Continue;
}
float height = orig[2] - ground[client];
if(height >= prevheight[client])
prevheight[client] = height;
else if(prevheight[client] != -99999999.0)
{
PeakReached(client, prevheight[client]);
}
return Plugin_Continue;
}
void PeakReached(int client, float height)
{
static Handle sync;
if(!sync)
sync = CreateHudSynchronizer();
SetHudTextParams(-1.0, 0.2, 2.0, 255, 255, 255, 255, 0, 0.0, 0.0, 0.0);
ShowSyncHudText(client, sync, "Peak height: %.2f", height);
}