-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmm_attribute_individual_gravity.sp
85 lines (66 loc) · 2.03 KB
/
mm_attribute_individual_gravity.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
79
80
81
82
83
#include <sourcemod>
#include <sdkhooks>
#include <tf2>
#include <tf2_stocks>
#include <tf2wearables>
#include <sdktools_stringtables>
#include <sdktools_tempents>
#include <sdktools>
#include <tf2attributes>
#include <tf_ontakedamage>
#include <tf_custom_attributes>
#include <stocksoup/var_strings>
#include <berobot_constants>
#include <berobot>
// #define JUMPSOUND "misc/gdoomsday_cap_spin_start.wav"
#if defined __stocksoup_tf_tempents_stocks_included
#endinput
#endif
#define __stocksoup_tf_tempents_stocks_included
float g_StandardGrav = 1.0;
float g_Gravity = 1.0;
public void OnPluginStart()
{
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
HookEvent("post_inventory_application", Event_PlayerSpawn, EventHookMode_Post);
}
// public void OnMapStart()
// {
// PRECACHESOUND(JUMPSOUND);
// }
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
CreateTimer(0.6, Timer_StatCheck, client);
}
public Action Timer_StatCheck(Handle timer, int client)
{
if (HasStats(client))
{
// PrintToChatAll("Setting grav on %N", client);
SetEntityGravity(client, g_Gravity)
}else
{
// PrintToChatAll("%N Didn't have the stat", client);
SetEntityGravity(client, g_StandardGrav);
}
}
bool HasStats(int client)
{
// int Weapon1 = GetPlayerWeaponSlot(client, TFWeaponSlot_Primary);
// PrintToChatAll("Weapon was %i", Weapon1);
// if (Weapon1 == -1)
// {
// return false;
// }
char stat_buffer[256];
if (!TF2CustAttr_GetString(client, "Player-Gravity", stat_buffer, sizeof(stat_buffer))) {
return false;
}
g_Gravity = ReadFloatVar(stat_buffer, "amount", 0.5);
// g_bmod_disciplinary = ReadIntVar(stat_buffer, "bmod-disciplinary", 0);
return true;
}
// 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])
// {
// }