-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmm_attribute_faster_respawn.sp
69 lines (52 loc) · 1.42 KB
/
mm_attribute_faster_respawn.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
#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>
#include <tf2utils>
#if defined __stocksoup_tf_tempents_stocks_included
#endinput
#endif
#define __stocksoup_tf_tempents_stocks_included
// bool g_cv_bDebugMode;
// float g_HitTime[MAXPLAYERS + 1] = {0.0, ...};
public void OnPluginStart()
{
HookEvent("post_inventory_application", Event_post_inventory_application, EventHookMode_Post);
}
float g_respawn_time;
// int g_weapon_id = -1
public Action Event_post_inventory_application(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
RequestFrame(CheckStat, client);
return Plugin_Continue;
}
void CheckStat(int client)
{
if(HasStat(client))
{
TF2Util_GetPlayerRespawnTimeOverride(client);
TF2Util_SetPlayerRespawnTimeOverride(client, g_respawn_time);
}else{
TF2Util_SetPlayerRespawnTimeOverride(client, -1.0);
}
}
bool HasStat(int client)
{
char stat_buffer[256];
if (!TF2CustAttr_GetString(client, "faster-respawn", stat_buffer, sizeof(stat_buffer))) {
return false;
}
g_respawn_time = ReadFloatVar(stat_buffer, "respawn", 5.0);
return true;
}