-
Notifications
You must be signed in to change notification settings - Fork 10
/
l4d2_mapcontrol.sp
123 lines (104 loc) · 2.5 KB
/
l4d2_mapcontrol.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
#pragma semicolon 1
#include <sourcemod>
char sg_l4d2Map[48];
char sg_mode[24];
int ig_coop;
public Plugin myinfo =
{
name = "MapControl",
author = "HMBSbige",
description = "L4D2 Coop Map Control",
version = "1.0",
url = "https://github.com/HMBSbige/SouceModPlugins"
};
public void OnPluginStart()
{
HookEvent("finale_win", Event_FinalWin, EventHookMode_PostNoCopy);
}
public void OnMapStart()
{
ig_coop = 0;
GetCurrentMap(sg_l4d2Map, sizeof(sg_l4d2Map) - 1);
GetConVarString(FindConVar("mp_gamemode"), sg_mode, sizeof(sg_mode)-1);
if (!strcmp(sg_mode, "coop", true))
{
ig_coop = 1;
}
if (!strcmp(sg_mode, "realism", true))
{
ig_coop = 1;
}
}
public Action HxTimerNextMap(Handle timer)
{
if (StrContains(sg_l4d2Map, "c1m", true) != -1)
{
ServerCommand("changelevel c2m1_highway");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c2m", true) != -1)
{
ServerCommand("changelevel c3m1_plankcountry");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c3m", true) != -1)
{
ServerCommand("changelevel c4m1_milltown_a");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c4m", true) != -1)
{
ServerCommand("changelevel c5m1_waterfront");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c5m", true) != -1)
{
ServerCommand("changelevel c6m1_riverbank");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c6m", true) != -1)
{
ServerCommand("changelevel c7m1_docks");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c7m", true) != -1)
{
ServerCommand("changelevel c8m1_apartment");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c8m", true) != -1)
{
ServerCommand("changelevel c9m1_alleys");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c9m", true) != -1)
{
ServerCommand("changelevel c10m1_caves");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c10m", true) != -1)
{
ServerCommand("changelevel c11m1_greenhouse");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c11m", true) != -1)
{
ServerCommand("changelevel c12m1_hilltop");
return Plugin_Continue;
}
if (StrContains(sg_l4d2Map, "c12m", true) != -1)
{
ServerCommand("changelevel c13m1_alpinecreek");
return Plugin_Continue;
}
ServerCommand("changelevel c2m1_highway");
return Plugin_Continue;
}
public void Event_FinalWin(Event event, const char [] name, bool dontBroadcast)
{
if (ig_coop)
{
PrintToChatAll("\x03[提示]\x01 75 秒后换图...");
CreateTimer(75.0, HxTimerNextMap, _, TIMER_FLAG_NO_MAPCHANGE);
}
}