This repository has been archived by the owner on Jul 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathins_burn.sp
232 lines (195 loc) · 6.21 KB
/
ins_burn.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*-------------------------------------
This plugin is to ignite the player when they taking fire damage
The fire damage stack up the longer the player in the fire
They will have to prone to remove all fire on them
---------------------------------------*/
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public Plugin:myinfo = {
name = "[INS] Burn",
description = "Ignite player when player taking fire damage",
author = "Neko-",
version = "1.0.5",
};
enum Teams
{
TEAM_NONE = 0,
TEAM_SPECTATORS,
TEAM_SECURITY,
TEAM_INSURGENTS,
};
int g_iPlayerEquipGear;
int nArmorFireResistance = 8;
int nFireAmmoID = 114;
public OnPluginStart()
{
g_iPlayerEquipGear = FindSendPropInfo("CINSPlayer", "m_EquippedGear");
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Pre);
}
public OnMapStart()
{
CreateTimer(1.0, Timer_SpreadBurn,_ , TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
public OnClientPutInServer(client)
{
//Hook damage taken to change the damage it deals
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon, &nSubType, &nCmdNum, &nTickCount, &nSeed)
{
if(IsPlayerAlive(client))
{
//Get player stance
int nStance = GetEntProp(client, Prop_Send, "m_iCurrentStance");
//nStance = 2 (Prone)
if(nStance == 2)
{
//Remove all fire
int ent = GetEntPropEnt(client, Prop_Data, "m_hEffectEntity");
if(IsValidEdict(ent))
{
//Reset to 0.0 to remove all fire
SetEntPropFloat(ent, Prop_Data, "m_flLifetime", 0.0);
}
}
}
}
public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
decl String:weaponCheck[64];
GetEventString(event, "weapon", weaponCheck, sizeof(weaponCheck));
if(StrEqual(weaponCheck, "entityflame", false))
{
//Rename [entityflame] to [Flame] for the top right (Killfeed)
SetEventString(event, "weapon", "Flame");
}
//Remove fire when player dead
int ent = GetEntPropEnt(client, Prop_Data, "m_hEffectEntity");
if(IsValidEdict(ent))
{
SetEntPropFloat(ent, Prop_Data, "m_flLifetime", 0.0);
}
}
public Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
//Get player ArmorID
int nArmorItemID = GetEntData(client, g_iPlayerEquipGear);
if(nArmorItemID == nArmorFireResistance)
{
return Plugin_Continue;
}
decl String:sWeapon[32];
GetEventString(event, "weapon", sWeapon, sizeof(sWeapon));
//If player don't have fire resistance armor and get hurt by those weapon then burn the player
//If you're running this plugin and don't have FireResistance armor then remove that Armor check in the if statement
//If you have more custom fire weapon then add it in here to have those weapon trigger the burn on players
if((StrEqual(sWeapon, "grenade_molotov")) || (StrEqual(sWeapon, "grenade_anm14")) || (StrEqual(sWeapon, "grenade_m203_incid")) || (StrEqual(sWeapon, "grenade_gp25_incid")))
{
IgniteEntity(client, 7.0);
}
//=============================
//FIRE AMMO SECTION (START)
//Remove this section if you are not using fire ammo
//=============================
//Get weapon ID
int AttackerWeapon = GetEntPropEnt(attacker, Prop_Send, "m_hActiveWeapon");
if(AttackerWeapon < 0)
{
return Plugin_Continue;
}
//Get weapon upgrades
int m_hUpgradeSlotOffset = GetEntSendPropOffs(AttackerWeapon, "m_upgradeSlots", true);
if(m_hUpgradeSlotOffset != -1)
{
for(int i = 0; i < (4*8); i += 4)
{
int nWeaponUpgradeID = GetEntData(AttackerWeapon, m_hUpgradeSlotOffset + i);
//Burn player if there is fire ammo
if(nWeaponUpgradeID == nFireAmmoID)
{
IgniteEntity(client, 7.0);
}
}
}
//=============================
//FIRE AMMO SECTION (END)
//=============================
return Plugin_Continue;
}
public Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
//Get weapon name
decl String:sWeapon[32];
GetEdictClassname(inflictor, sWeapon, sizeof(sWeapon));
if(GetEntPropEnt(client, Prop_Send, "m_hEffectEntity") <= 0 && StrEqual(sWeapon, "entityflame"))
{
return Plugin_Handled;
}
if(StrEqual(sWeapon, "entityflame"))
{
//Per fire damage (This damage stack up if player have more than 1 fire on them)
damage = 0.5;
return Plugin_Changed;
}
return Plugin_Continue;
}
public Action:Timer_SpreadBurn(Handle:Timer)
{
for(int nPlayer = 1; nPlayer <= MaxClients; nPlayer++)
{
if(IsClientInGame(nPlayer) && IsPlayerAlive(nPlayer) && (GetClientTeam(nPlayer) != view_as<int>(TEAM_SPECTATORS)))
{
int ent = GetEntPropEnt(nPlayer, Prop_Data, "m_hEffectEntity");
if(!IsValidEdict(ent))
{
continue;
}
for(int nPlayerTarget = 1; nPlayerTarget <= MaxClients; nPlayerTarget++)
{
if(!IsClientInGame(nPlayerTarget) || !IsPlayerAlive(nPlayerTarget) || (nPlayerTarget == nPlayer))
{
continue;
}
//Get player ArmorID
int nArmorItemID = GetEntData(nPlayerTarget, g_iPlayerEquipGear);
if(nArmorItemID == nArmorFireResistance)
{
continue;
}
//Get player stance
int nStance = GetEntProp(nPlayerTarget, Prop_Send, "m_iCurrentStance");
//nStance = 2 (Prone)
if(nStance == 2)
{
continue;
}
//Already on fire
/*
int entTarget = GetEntPropEnt(nPlayerTarget, Prop_Data, "m_hEffectEntity");
if(IsValidEdict(entTarget))
{
continue;
}
*/
float fDistance = GetDistance(nPlayer, nPlayerTarget);
if(fDistance <= 95.0)
{
IgniteEntity(nPlayerTarget, 7.0);
}
}
}
}
return Plugin_Continue
}
float GetDistance(nClient, nTarget)
{
float fClientOrigin[3], fTargetOrigin[3];
GetClientAbsOrigin(nClient, fClientOrigin);
GetClientAbsOrigin(nTarget, fTargetOrigin);
return GetVectorDistance(fClientOrigin, fTargetOrigin);
}