-
Notifications
You must be signed in to change notification settings - Fork 7
/
mm_attribute_change_demo_speed.sp
54 lines (50 loc) · 1.45 KB
/
mm_attribute_change_demo_speed.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
#include <sourcemod>
#include <tf2>
#include <tf2_stocks>
#include <sdktools_stringtables>
#include <sdktools_tempents>
#include <sdktools>
#include <tf2attributes>
#include <tf_custom_attributes>
#include <stocksoup/var_strings>
#include <berobot_constants>
#include <berobot>
#include <sdkhooks>
#if defined __stocksoup_tf_tempents_stocks_included
#endinput
#endif
#define __stocksoup_tf_tempents_stocks_included
float g_ChargingSpeed = 0.0;
TFCond g_TFCond = TFCond_Charging;
bool ActiveHasChargeSpeedStatPlayer(int client)
{
char stat_buffer[256];
if (!TF2CustAttr_GetString(client, "ChargeSpeed", stat_buffer, sizeof(stat_buffer))) {
return false;
}
// g_TFCond = ReadIntVar(stat_buffer, "oncond", -1);
g_ChargingSpeed = ReadFloatVar(stat_buffer, "speed", 350.0); // Reading the speed value here
return true;
}
public void TF2_OnConditionAdded(int client, TFCond condition)
{
if(ActiveHasChargeSpeedStatPlayer(client))
{
if (condition == g_TFCond)
{
SetEntPropFloat(client, Prop_Send, "m_flMaxspeed", g_ChargingSpeed); // Setting the speed here
TF2_AddCondition(client, TFCond_RestrictToMelee);
}
}
}
public void TF2_OnConditionRemoved(int client, TFCond condition)
{
if(ActiveHasChargeSpeedStatPlayer(client))
{
if (condition == g_TFCond)
{
TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.1);
TF2_RemoveCondition(client, TFCond_RestrictToMelee);
}
}
}