-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgravityfixes.sp
More file actions
58 lines (51 loc) · 1.4 KB
/
gravityfixes.sp
File metadata and controls
58 lines (51 loc) · 1.4 KB
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
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
bool g_bLadder[MAXPLAYERS+1];
float g_fLadder[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Gravity fixes",
author = "Bara & Meitis",
version = "1.0",
description = "Fixes gravity being reset when moving up/down ladders and reset it on round start",
url = ""
};
public void OnPluginStart()
{
HookEvent("round_prestart", Event_RoundStart);
}
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
if(!IsFakeClient(client))
{
if (GetEntityMoveType(client) == MOVETYPE_LADDER)
{
g_bLadder[client] = true;
}
else
{
if (g_bLadder[client])
{
SetEntityGravity(client, g_fLadder[client]);
g_bLadder[client] = false;
}
else
{
g_fLadder[client] = GetEntityGravity(client);
}
}
}
}
public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
for (int i = 1; i <= MaxClients; i++)
{
// If we don't do this, players that had low gravity and stayed on the ladder at round end kept their low gravity
g_fLadder[i] = 1.0;
// If we don't do this, players that had low gravity the previous round keep it
if (IsClientInGame(i) && IsPlayerAlive(i)) {
SetEntityGravity(i, 1.0);
}
}
}