-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTGPHeight.sp
77 lines (62 loc) · 1.39 KB
/
TGPHeight.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
#include <sourcemod>
#include <sdktools>
#define MAX_BUTTONS 25
#define IN_JUMP (1 << 1)
new g_LastButtons[MAXPLAYERS+1];
Handle ti;
float loc[MAXPLAYERS + 1][3];
public Plugin myinfo =
{
name = "",
author = "AfricanSpaceJesus",
description = "",
version = "0.5",
url = "http://steamcommunity.com/id/swagattack835/"
};
public void OnPluginStart()
{
}
public OnClientDisconnect_Post(client)
{
g_LastButtons[client] = 0;
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
for (new i = 0; i < MAX_BUTTONS; i++)
{
new button = (1 << i);
if ((buttons & button))
{
if (!(g_LastButtons[client] & button))
{
OnButtonPress(client, button);
}
}
else if ((g_LastButtons[client] & button))
{
OnButtonRelease(client, button);
}
}
g_LastButtons[client] = buttons;
return Plugin_Continue;
}
OnButtonPress(client, button)
{
if(button== IN_JUMP)
{
ti= CreateTimer(0.1, incHeight, client, TIMER_REPEAT);
}
}
OnButtonRelease(client, button)
{
if(button== IN_JUMP)
{
KillTimer(ti, true);
}
}
public Action incHeight(Handle timer, int client)
{
GetClientAbsOrigin(client, loc[client]);
loc[client][2] += 1.0;
TeleportEntity(client, loc[client], NULL_VECTOR, NULL_VECTOR);
}