forked from SilvDev/Various_Scripts_Collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
l4d2_dead_air_barricade.sp
134 lines (105 loc) · 3.66 KB
/
l4d2_dead_air_barricade.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
/*
* Dead Air Barricade
* Copyright (C) 2022 Silvers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#define PLUGIN_VERSION "1.4"
/*=======================================================================================
Plugin Info:
* Name : [L4D2] Dead Air Barricade
* Author : SilverShot
* Descrp : Removes the fire barricade from Dead Air finale.
* Link : https://forums.alliedmods.net/showthread.php?t=181516
* Plugins : https://sourcemod.net/plugins.php?exact=exact&sortby=title&search=1&author=Silvers
========================================================================================
Change Log:
1.4 (11-Dec-2022)
- Changes to fix compile warnings on SourceMod 1.11.
1.3 (05-Oct-2020)
- Fixed the plugin not working on first map load. Thanks to "aiyoaiui" for reporting.
1.2 (10-May-2020)
- Various optimizations and fixes.
1.1 (05-May-2018)
- Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.
1.0 (30-Mar-2012)
- Initial release.
======================================================================================*/
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
bool g_bValidMap;
// ====================================================================================================
// PLUGIN INFO / START / END
// ====================================================================================================
public Plugin myinfo =
{
name = "[L4D2] Dead Air Barricade",
author = "SilverShot",
description = "Removes the fire barricade from Dead Air finale.",
version = PLUGIN_VERSION,
url = "https://forums.alliedmods.net/showthread.php?t=181516"
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
EngineVersion test = GetEngineVersion();
if( test != Engine_Left4Dead2 )
{
strcopy(error, err_max, "Plugin only supports Left 4 Dead 2.");
return APLRes_SilentFailure;
}
return APLRes_Success;
}
public void OnPluginStart()
{
CreateConVar("l4d2_dead_air_barricade", PLUGIN_VERSION, "Dead Air Barricade plugin version", FCVAR_NOTIFY|FCVAR_DONTRECORD);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
}
public void OnMapStart()
{
char sMap[64];
GetCurrentMap(sMap, sizeof(sMap));
if( strcmp(sMap, "c11m5_runway") == 0 )
{
CreateTimer(5.0, TimerDelete, _, TIMER_FLAG_NO_MAPCHANGE);
g_bValidMap = true;
}
}
public void OnMapEnd()
{
g_bValidMap = false;
}
void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
if( g_bValidMap )
{
CreateTimer(5.0, TimerDelete, _, TIMER_FLAG_NO_MAPCHANGE);
}
}
Action TimerDelete(Handle timer)
{
char sName[20];
int entity = -1;
while( (entity = FindEntityByClassname(entity, "logic_relay")) != INVALID_ENT_REFERENCE )
{
GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName));
if( strcmp(sName, "ribbon_fire_relay") == 0 )
{
RemoveEntity(entity);
return Plugin_Continue;
}
}
return Plugin_Continue;
}