-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathability_paid_damage_flames_pyro_laugh_extractor_ability.sp
194 lines (153 loc) · 4.64 KB
/
ability_paid_damage_flames_pyro_laugh_extractor_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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <sm_logger>
#include <berobot_constants>
#include <berobot>
#define PLUGIN_VERSION "1.0"
#define ROBOT_NAME "Laugh Extractor"
#define SCREAM "ambient/halloween/male_scream_10.wav"
bool g_button_held[MAXPLAYERS + 1] = false;
// float g_Recharge[MAXPLAYERS + 1] = 0.0;
// float g_RechargeCooldown = 5.0;
float g_skill;
int g_KillCount[MAXPLAYERS + 1] = {5,...};
int g_KillsNeeded = 5;
public Plugin:myinfo =
{
name = "[TF2] Laugh Extractor Ability",
author = "HiGPS | Bmod.TF",
description = "Laugh Extractor Ability",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}
public OnPluginStart()
{
for (int i = 1; i <= MAXPLAYERS; i++)
{
g_KillCount[i] = 5;
}
HookEvent("player_death", Event_Death, EventHookMode_Post);
}
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
// CreateNative("BeGiantPyro_MakeGiantPyro", Native_SetGiantPyro);
// CreateNative("BeGiantPyro_IsGiantPyro", Native_IsGiantPyro);
return APLRes_Success;
}
public Action:SetModel(client, const String:model[])
{
if (IsValidClient(client) && IsPlayerAlive(client))
{
SetVariantString(model);
AcceptEntityInput(client, "SetCustomModel");
SetEntProp(client, Prop_Send, "m_bUseClassAnimations", 1);
}
}
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, ROBOT_NAME))
{
if( GetEntProp(client, Prop_Data, "m_afButtonPressed" ) & (IN_ATTACK3|IN_USE) )
{
// PrintToChatAll("Press");
g_button_held[client] = true;
}
if( GetEntProp(client, Prop_Data, "m_afButtonReleased" ) & (IN_ATTACK3|IN_USE) )
{
// PrintToChatAll("Release");
g_button_held[client] = false;
}
//0 = Shadow Leap
//PrintToChat(client, "Throwing spell!");
// UpdateCharge(client);
g_skill = GetEngineTime();
DrawHUD(client);
}
}
// float g_hud_draw_delay = 0.1;
// float g_hud_post_time = 0.0;
bool isready;
void DrawHUD(int client)
{
char sHUDText[128];
// char sProgress[32];
//int iPercents = RoundToCeil(float(g_Recharge[client]) / float(g_RechargeCooldown) * 100.0);
int iCountDown = g_KillsNeeded- g_KillCount[client];
// 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), "Laugh Extraction:\n%i kills remain", iCountDown);
if(iCountDown <= 0)
{
Format(sHUDText, sizeof(sHUDText), "Laugh Extraction Ready!\nSpecial Attack to use!");
SetHudTextParams(1.0, 0.8, 0.5, 0, 255, 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)
{
ApplyRadialStun(client, 1.5, 500.0);
g_KillCount[client] = 0;
// g_Recharge[client] = GetEngineTime() + g_RechargeCooldown;
isready = false;
}
}
// void LaughExtract(int client)
// {
// // TFTeam iTeam = TF2_GetClientTeam(client);
// }
public Event_Death(Event event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
int victim = GetClientOfUserId(GetEventInt(event, "userid"));
if (!IsAnyRobot(victim) && IsRobot(attacker, ROBOT_NAME))
{
if(g_KillCount[attacker] <= g_KillsNeeded)
{
g_KillCount[attacker]++;
}
}
}
public void ApplyRadialStun(int hero, float flDuration, float flRadius)
{
//positions
float heroPos[3];
float playerPos[3];
int team = GetClientTeam(hero);
//Get our hero's position
GetClientAbsOrigin(hero, heroPos);
int stunflag = TF_STUNFLAGS_GHOSTSCARE;
//loop through players
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client) && IsPlayerAlive(client))
{
int cteam = GetClientTeam(client);
if (cteam == team) continue;
GetClientAbsOrigin(client, playerPos);
if (GetVectorDistance(playerPos, heroPos) <= flRadius)
{
TF2_StunPlayer(client, flDuration, 0.0, stunflag);
}
}
}
EmitSoundToAll(SCREAM, hero, SNDCHAN_ITEM, SNDLEVEL_GUNFIRE);
EmitSoundToAll(SCREAM, hero, SNDCHAN_ITEM, SNDLEVEL_GUNFIRE);
EmitSoundToAll(SCREAM, hero, SNDCHAN_ITEM, SNDLEVEL_GUNFIRE);
}