-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathability_free_damage_melee_heavy_boxing_champ_ability.sp
148 lines (120 loc) · 3.75 KB
/
ability_free_damage_melee_heavy_boxing_champ_ability.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#pragma semicolon 1
#include <sdkhooks>
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <berobot_constants>
#include <berobot>
#include <tf_custom_attributes>
#include <dhooks>
#include <tf_ontakedamage>
#include <tf2_isPlayerInSpawn>
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "[TF2] Skill for the Boxing Champ",
author = "Erofix using the code from: Pelipoika, PC Gamer, Jaster and StormishJustice",
description = "Play as the Giant Deflector Heavy from MvM",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}
bool g_button_held[MAXPLAYERS + 1] = {false, ...};
float g_Recharge[MAXPLAYERS + 1] = {0.0, ...};
float g_RechargeCooldown = 7.0;
float g_skill;
float g_dash_duration = 2.5;
float g_done_dash;
bool isready;
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])
{
if (IsRobot(client, "Boxing Champ"))
{
//0 = fireball
//PrintToChat(client, "Throwing spell!");
// if(GetEntProp(client, Prop_Data, "m_bDucking"))
// {
// // PrintToChatAll("Press");
// // g_button_held[client] = true;
// GetEntProp(client, Prop_Data, "m_bDucking"))
// }
if( GetEntProp( client, Prop_Data, "m_afButtonReleased" ) & IN_DUCK)
{
// PrintToChatAll("Release");
// g_button_held[client] = false;
if (g_Recharge[client] <= GetEngineTime() && isready && !TF2Spawn_IsClientInSpawn(client))
{
SetSpeed(client);
g_Recharge[client] = GetEngineTime() + g_RechargeCooldown;
isready = false;
}
}
if(g_done_dash + g_dash_duration > GetEngineTime())
{
// ResetSpeed(client);
}
g_skill = GetEngineTime();
DrawHUD(client);
}
return Plugin_Continue;
}
void SetSpeed(int client)
{
// TF2Attrib_AddCustomPlayerAttribute(client, "increased jump height", 0.01, 1.0);
// SetEntPropFloat(client, Prop_Send, "m_flMaxspeed", 520.0);
TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.6);
TF2_AddCondition(client, TFCond_Buffed, 1.5);
// TF2_AddCondition(client, 130, 0.5);
SetEntPropFloat(client, Prop_Send, "m_flMaxspeed", 520.0);
g_done_dash = GetEngineTime();
// setspeed = true;
}
// void ResetSpeed(int client)
// {
// TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.0);
// TF2_StunPlayer(client, 0.0, 0.0, TF_STUNFLAG_SLOWDOWN);
// setspeed = false;
// }
void DrawHUD(int client)
{
char sHUDText[128];
// char sProgress[32];
//int iPercents = RoundToCeil(float(g_Recharge[client]) / float(g_RechargeCooldown) * 100.0);
int iCountDown = RoundToCeil(g_Recharge[client] - g_skill);
// for (int j = 1; j <= 10; j++)
// {
// if (iPercents >= j * 10)StrCat(sProgress, sizeof(sProgress), CHAR_FULL);
// else StrCat(sProgress, sizeof(sProgress), CHAR_EMPTY);
// }
Format(sHUDText, sizeof(sHUDText), "Crouch Dash: %i ", iCountDown);
if(iCountDown <= 0)
{
if(!TF2Spawn_IsClientInSpawn(client))
{
Format(sHUDText, sizeof(sHUDText), "Crouch Dash Ready!");
SetHudTextParams(1.0, 0.8, 0.5, 0, 255, 0, 255);
}else
{
Format(sHUDText, sizeof(sHUDText), "Crouch Dash Ready!\nUnavailable in spawn");
SetHudTextParams(1.0, 0.8, 0.5, 255, 0, 0, 255);
}
} else {
SetHudTextParams(1.0, 0.8, 0.5, 255, 255, 255, 255);
// PrintToChatAll("Not Ready!");
}
// if (g_hud_post_time + g_hud_draw_delay <= GetEngineTime() || g_hud_post_time == 0.0)
// {
ShowHudText(client, -2, sHUDText);
// g_hud_post_time = GetEngineTime();
// }
if (!isready && iCountDown <= 0)
{
TF2_AddCondition(client, TFCond_InHealRadius, 0.5);
// PrintToChatAll("Ready!");
isready = true;
}
if (g_button_held[client] && iCountDown <= 0)
{
g_Recharge[client] = GetEngineTime() + g_RechargeCooldown;
isready = false;
}
}