-
Notifications
You must be signed in to change notification settings - Fork 7
/
mm_attribute_addcond_on_cond.sp
78 lines (67 loc) · 2.06 KB
/
mm_attribute_addcond_on_cond.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 <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>
#if defined __stocksoup_tf_tempents_stocks_included
#endinput
#endif
#define __stocksoup_tf_tempents_stocks_included
int g_TFCond = 0;
float g_TFCond_duration = 0.0;
int g_TFCond_addcond = 0;
int g_TFCond_removecond = 0;
bool ActiveHasAddCondStatPlayer(int attacker)
{
char stat_buffer[256];
if (!TF2CustAttr_GetString(attacker, "OnCondAdd-addcond", stat_buffer, sizeof(stat_buffer))) {
return false;
}
g_TFCond = ReadIntVar(stat_buffer, "oncond", -1);
g_TFCond_duration = ReadFloatVar(stat_buffer, "duration", 5.0);
g_TFCond_addcond = ReadIntVar(stat_buffer, "addcond", -1);
// g_bmod_disciplinary = ReadIntVar(stat_buffer, "bmod-disciplinary", 0);
return true;
}
public void TF2_OnConditionAdded(int client, TFCond condition)
{
if(ActiveHasAddCondStatPlayer(client))
{
// PrintToChatAll("Condition was %i , g_TFCOND was %i", condition, g_TFCond);
if (condition == g_TFCond)
{
TF2_AddCondition(client, g_TFCond_addcond, g_TFCond_duration);
}
}
}
bool ActiveHasRemoveCondStatPlayer(int attacker)
{
char stat_buffer[256];
if (!TF2CustAttr_GetString(attacker, "OnCondRemoved-addcond", stat_buffer, sizeof(stat_buffer))) {
return false;
}
g_TFCond = ReadIntVar(stat_buffer, "oncond", -1);
g_TFCond_duration = ReadFloatVar(stat_buffer, "duration", 5.0);
g_TFCond_removecond = ReadIntVar(stat_buffer, "addcond", -1);
// g_bmod_disciplinary = ReadIntVar(stat_buffer, "bmod-disciplinary", 0);
return true;
}
public void TF2_OnConditionRemoved(int client, TFCond condition)
{
if(ActiveHasRemoveCondStatPlayer(client))
{
if (condition == g_TFCond)
{
TF2_AddCondition(client, g_TFCond_addcond, g_TFCond_duration);
}
}
}