-
Notifications
You must be signed in to change notification settings - Fork 0
/
jumpstats.sp
78 lines (65 loc) · 1.68 KB
/
jumpstats.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
71
72
73
74
75
76
77
78
#include <sourcemod>
#include <sdktools>
#define MAX_TICKS 20
new bool:g_sEnable[MAXPLAYERS+1];
new bool:g_cEnable[MAXPLAYERS+1];
new g_iTicks[MAXPLAYERS+1];
new String:sWeapon[MAXPLAYERS+1][64];
public OnPluginStart()
{
RegConsoleCmd("sm_f", Command_Jumpstats, "jumpstats");
}
public Action:Command_Jumpstats(client, args)
{
if(g_sEnable[client])
{
g_sEnable[client]=false;
PrintToChat(client, "점프 타이밍 측정을 비활성화 합니다.");
}
else
{
g_sEnable[client]=true;
PrintToChat(client, "점프 타이밍을 측정합니다.");
}
}
public OnClientPutInServer(client)
{
g_sEnable[client] = false;
PrintToChat(client, "\x05type !f to enable jumpstats.");
}
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
if(g_sEnable[client] && IsClientInGame(client) && IsPlayerAlive(client) && !IsFakeClient(client))
{
if(g_iTicks[client] >= MAX_TICKS)
{
g_iTicks[client] = 0;
g_cEnable[client] = false;
}
if(!(GetEntityFlags(client) & FL_ONGROUND) && g_cEnable[client] == false)
{
return Plugin_Continue;
}
if((buttons & IN_JUMP) && (g_cEnable[client] == false))
{
return Plugin_Continue;
}
GetClientWeapon(client, sWeapon[client], 64);
if (buttons & IN_ATTACK && StrEqual(sWeapon[client], "weapon_flashbang"))
{
g_iTicks[client] = 0;
g_cEnable[client] = true;
}
if(!(buttons & IN_ATTACK) && g_cEnable[client] == true)
{
if(buttons & IN_JUMP)
{
g_cEnable[client] = false;
PrintToChat(client, "%dms", g_iTicks[client] * 10); // 100tick/1s = 1tick/0.01s = 1tick/10ms
return Plugin_Continue;
}
g_iTicks[client]++;
}
}
return Plugin_Continue;
}