-
Notifications
You must be signed in to change notification settings - Fork 7
/
ability_dewill.sp
147 lines (106 loc) · 3.12 KB
/
ability_dewill.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
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <sm_logger>
#include <berobot_constants>
#include <berobot>
#include <tf_custom_attributes>
#define PLUGIN_VERSION "1.0"
#define ROBOT_NAME "Dewill"
#include <sdktools>
#include <sdkhooks>
#include <tf2>
#include <tf2_stocks>
public Plugin:myinfo =
{
name = "[TF2] The DEWILL rapid fire ability",
author = "HiGPS | Bmod.TF",
description = "Ability for Dewill",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}
bool g_button_held[MAXPLAYERS + 1] = {false, ...};
float g_duration = 6.0;
float FireModeTimer = -1.0;
// float g_currenttime;
bool g_FireMode = false;
float g_skill;
float g_skill_cooldown = 12.0;
float g_skill_time;
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 )
{
g_button_held[client] = true;
}
if( GetEntProp( client, Prop_Data, "m_afButtonReleased" ) & IN_ATTACK3 )
{
g_button_held[client] = false;
}
g_skill = GetEngineTime();
DrawHUD(client);
}
return Plugin_Continue;
}
void EnterRapidFireMode(int client)
{
g_skill_time = g_duration;
PrintCenterText(client, "Entering Firing mode");
g_FireMode = true;
FireModeTimer = GetEngineTime() + g_duration;
TF2_AddCondition(client, TFCond_RuneHaste, g_duration);
TF2Attrib_AddCustomPlayerAttribute(client, "move speed penalty", 0.01);
int Weapon1 = GetPlayerWeaponSlot(client, TFWeaponSlot_Primary);
if(IsValidEntity(Weapon1))
{
TF2Attrib_SetByName(Weapon1, "fire rate bonus", 0.35);
TF2Attrib_SetByName(Weapon1, "major increased jump height", 0.0);
}
}
void ResetWeapon(int client)
{
g_FireMode = false;
TF2Attrib_AddCustomPlayerAttribute(client, "move speed penalty", 0.5);
TF2_AddCondition(client, TFCond_SpeedBuffAlly, 0.1);
g_skill_time = g_skill + g_skill_cooldown;
int Weapon1 = GetPlayerWeaponSlot(client, TFWeaponSlot_Primary);
if(IsValidEntity(Weapon1))
{
TF2Attrib_SetByName(Weapon1, "fire rate bonus", 0.85);
TF2Attrib_SetByName(Weapon1, "major increased jump height", 1.0);
}
}
void DrawHUD(int client)
{
char sHUDText[128];
int iCountDown = RoundToCeil(g_skill_time - g_skill);
int iCountDownFiring = RoundToCeil(FireModeTimer - g_skill);
Format(sHUDText, sizeof(sHUDText), "Rapid Fire: %i ",iCountDown);
if(iCountDown <= 0)
{
if (g_FireMode){
Format(sHUDText, sizeof(sHUDText), "Rapid Fire! %i", iCountDownFiring);
SetHudTextParams(0.85, 0.6, 0.1, 255, 69, 0, 255);
}else{
Format(sHUDText, sizeof(sHUDText), "Rapid Fire Ready!\nUse Special Attack to Activate!");
SetHudTextParams(0.85, 0.6, 0.1, 0, 255, 0, 255);
}
}else {
SetHudTextParams(0.85, 0.6, 0.1, 255, 0, 0, 255);
}
if (g_button_held[client] && iCountDown <= 0 && !g_FireMode)
{
if (FireModeTimer <= GetEngineTime() || FireModeTimer == -1.0)
{
EnterRapidFireMode(client);
}
}
if (FireModeTimer <= GetEngineTime() && g_FireMode)
{
ResetWeapon(client);
}
ShowHudText(client, -3, sHUDText);
}