-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZFile_Core.sma
More file actions
318 lines (292 loc) · 8.31 KB
/
ZFile_Core.sma
File metadata and controls
318 lines (292 loc) · 8.31 KB
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <fun>
#include <cstrike>
#define pragma compress 1
#define PLUGIN "CSO Zombie Files First Report [BETA]"
#define VERSION "1.0"
#define AUTHOR "Mellowzy"
#define TASK_COOLDOWN_REST 102012012
#define TASK_ENERGY 121212
#define TASK_SOYSAY 2323232
#define TASK_BEGIN 29102109201
#define TASK_RESTART 12121211111
#define TASK_LOBBY 0090990909
#define TASK_MUSIC 929291002
#define TASK_CREDIT 00229192192121121121
#define TASK_COUNTDOWN 1212121212
#define TASK_HORDE 11212214
new const scenario[][] = {
"zfile/ost/PVE_Standalone_Start.mp3",
"zfile/ost/PVE_Standalone_BGM.mp3"
}
new const roundevent[][] = {
"round/roundclear.wav",
"round/roundfail.wav"
}
new bool:g_Has_Sprint[256]
new g_Tired[33], bool:Start[256]
new g_CountDown, bool:exitgate[256]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
register_logevent("Event_RoundStart", 2, "1=Round_Start")
register_message(get_user_msgid("StatusIcon"), "msgStatusIcon");
RegisterHam(Ham_Spawn, "player", "HamSPawnpost", 1)
RegisterHam(Ham_Killed, "player", "PlayerKilled", 1)
register_concmd("+fast_run", "skill_sprint_use")
register_concmd("-fast_run", "not_use_sprint")
register_clcmd("fade", "ScreenFade")
register_clcmd("clearround", "RoundComplete")
register_clcmd("lastcheckpoint", "Last_Checkpoint")
}
public plugin_precache()
{
new i;
for(i = 0; i <sizeof(scenario); i++)
precache_sound(scenario[i])
for(i = 0; i <sizeof(roundevent); i++)
precache_sound(roundevent[i])
#define MAP "standalone_alpha"
static MapName[64]; get_mapname(MapName, sizeof(MapName))
if(!equal(MapName, MAP))
{
set_fail_state("[ZFILE]: You must play in %s", MAP)
return
} else {
server_cmd("mp_timelimit 9999")
}
}
public HamSPawnpost(id)
{
entity_set_float(id, EV_FL_maxspeed, 120.0)
g_Tired[id] = 10
g_Has_Sprint[id] = false
fm_strip_user_gun(id)
playerSpawn(id)
if(task_exists(id+TASK_ENERGY)) remove_task(id+TASK_ENERGY)
if(task_exists(id+TASK_COOLDOWN_REST)) remove_task(id+TASK_COOLDOWN_REST)
if(task_exists(id+TASK_SOYSAY)) remove_task(id+TASK_SOYSAY)
if(task_exists(id+TASK_COUNTDOWN)) remove_task(id+TASK_COUNTDOWN)
}
public client_connect(id) Start[id] = false
public msgStatusIcon(msgid, msgdest, id)
{
static szIcon[8];
get_msg_arg_string(2, szIcon, 7);
if(equal(szIcon, "buyzone") && get_msg_arg_int(1))
{
set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0));
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public server_start(id)
{
id -= TASK_BEGIN
server_cmd("sv_restartround 1")
if(task_exists(id+TASK_BEGIN)) remove_task(id+TASK_BEGIN)
}
public skill_lowsprint(id)
{
if(!is_user_alive(id)) return
engfunc(EngFunc_SetClientMaxspeed, id, 120.0)
}
public client_PreThink(id)
{
if(!is_user_alive(id)) return
server_cmd("bind SHIFT +speed")
if(g_Has_Sprint[id]){
if(g_Tired[id] < 0) {
g_Has_Sprint[id] = false
Fill_Energy(id+TASK_COOLDOWN_REST)
if(task_exists(id+TASK_ENERGY)) remove_task(id+TASK_ENERGY)
} else {
g_Has_Sprint[id] = true
if(task_exists(id+TASK_COOLDOWN_REST)) remove_task(id+TASK_COOLDOWN_REST)
}
}
}
public Use_Sprint(id) g_Has_Sprint[id] = true
public skill_sprint_use(id)
{
if(!g_Has_Sprint[id])
return
engfunc(EngFunc_SetClientMaxspeed, id, 320.0)
Use_Energy(id+TASK_ENERGY)
}
public not_use_sprint(id)
{
engfunc(EngFunc_SetClientMaxspeed, id, 120.0)
if(task_exists(id+TASK_ENERGY)) remove_task(id+TASK_ENERGY)
Fill_Energy(id+TASK_COOLDOWN_REST)
}
public Use_Energy(id){
id -= TASK_ENERGY
g_Tired[id] --
set_task(1.0, "Use_Energy", id+TASK_ENERGY)
}
public Fill_Energy(id){
id -= TASK_COOLDOWN_REST
g_Tired[id] ++
set_task(1.0, "Fill_Energy", id+TASK_COOLDOWN_REST)
}
//------------------------ START ROUND --------------------------------//
public plugin_cfg()
{
server_cmd("mp_timelimit 9999")
server_cmd("mp_roundtime 20")
server_cmd("mp_freezetime 20")
server_cmd("mp_consistency 0")
}
public Event_NewRound(id)
{
server_cmd("fade")
server_cmd("spawn_npc")
set_task(21.0, "Soy_speech1", id+TASK_SOYSAY)
server_cmd("amxx pause ZFile_Ability.amxx")
PlaySound(id, scenario[0])
Start[id] = true
}
public Event_RoundStart(id)
{
StopSound(1)
server_cmd("amxx unpause ZFile_Ability.amxx")
}
public playerSpawn(id) //recommend using map standalone_alpha
{
new Float:Origin[3]
Origin[0] = 3668.0
Origin[1] = 2305.0
Origin[2] = -1898.0
if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT || cs_get_user_team(id) == CS_TEAM_T){
set_pev(id, pev_origin, Origin)
server_cmd("amxx pause ZFile_Ability.amxx")
}
}
public ScreenFade(id)
{
Stock_ScreenFade(id,255,255,255,255)
}
public PlayerKilled(id)
{
RoundFail(id)
set_task(2.5, "go_restart", id+TASK_RESTART)
}
//---------------------------- Round Status ----------------------
public RoundFail(id)
{
PlaySound(id, roundevent[1])
client_print(id, print_center, "ROUND FAIL")
}
public RoundComplete(id)
{
PlaySound(id, roundevent[0])
client_print(id, print_center, "ROUND CLEAR")
set_task(5.0, "go_lobby", id+TASK_LOBBY)
}
public go_restart(id) {
id -= TASK_RESTART
server_cmd("sv_restartround 1")
if(task_exists(id+TASK_RESTART)) remove_task(id+TASK_RESTART)
}
public go_lobby(id){
id -= TASK_LOBBY
server_cmd("sv_restartround 1")
if(task_exists(id+TASK_LOBBY)) remove_task(id+TASK_LOBBY)
}
//------------------------ SOY SPEECH ---------------------------------//
public Soy_speech1(id)
{
id -= TASK_SOYSAY
set_dhudmessage(0,255, 0, -1.0, 0.13, 0, 0.0, 2.0)
show_dhudmessage(id, "Soy : Ahh.. ouch.. My head.. Where is this place?")
set_task(3.0, "Soy_speech2", id+TASK_SOYSAY)
}
public Soy_speech2(id)
{
id -= TASK_SOYSAY
set_dhudmessage(0,255, 0, -1.0, 0.13, 0, 0.0, 2.0)
show_dhudmessage(id, "Soy : I remember talking with Dr.Rex...")
set_task(3.0, "Soy_speech3", id+TASK_SOYSAY)
}
public Soy_speech3(id)
{
id -= TASK_SOYSAY
set_dhudmessage(0,255, 0, -1.0, 0.13, 0, 0.0, 2.0)
show_dhudmessage(id, "Soy : I don't know how long i've been out, but, i should go find Dr.Rex..")
if(task_exists(id+TASK_SOYSAY)) remove_task(id+TASK_SOYSAY)
}
//-------------------------------- SCENE ----------------------------
public Last_Checkpoint(id)
{
g_CountDown = 90
PlaySound(id, scenario[1])
set_task(1.0, "horde_spawn", id+TASK_HORDE)
set_task(1.0, "Countdown_exitgate", id+TASK_COUNTDOWN)
}
public horde_spawn(id)
{
id -= TASK_HORDE
server_cmd("horde")
set_task(20.0, "horde_spawn", id+TASK_HORDE)
}
public Countdown_exitgate(id)
{
id -= TASK_COUNTDOWN
g_CountDown --
if(task_exists(id+TASK_COUNTDOWN)) remove_task(id+TASK_COUNTDOWN)
if(g_CountDown <= 0) {
set_lights("#OFF")
exitgate[id] = true
open_gate(id)
if(task_exists(id+TASK_HORDE)) remove_task(id+TASK_HORDE)
return
}
client_print(0, print_center, "Open gate in %i second(s)!", g_CountDown)
set_task(1.0, "Countdown_exitgate", id+TASK_COUNTDOWN)
}
public open_gate(id)
{
if(!exitgate[id]) return
server_cmd("object_opengate")
remove_entity_name("zfile_zombi")
if(task_exists(id+TASK_HORDE)) remove_task(id+TASK_HORDE)
set_dhudmessage(0,255, 0, -1.0, 0.13, 0, 0.0, 2.0)
show_dhudmessage(id, "Soy : Exit Open!")
if(task_exists(id+TASK_COUNTDOWN)) remove_task(id+TASK_COUNTDOWN)
}
//---------------------------------------- Stock ---------------------------------
stock PlaySound(id, const sound[])
{
if(equal(sound[strlen(sound)-4], ".mp3"))
client_cmd(id, "mp3 play ^"sound/%s^"", sound)
else
client_cmd(id, "spk ^"%s^"", sound)
}
stock StopSound(Tiposound)
{
if(Tiposound == 1)
client_cmd(0, "mp3 stop; stopsound");
else if(Tiposound == 2)
client_cmd(0, "stopsound");
}
stock Stock_ScreenFade(id,r=200,g=200,b=200,br=0)
{
if(!is_user_alive(id)) return
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), {0,0,0}, id)
write_short((1<<12) * 1900)//duration
write_short((1<<12)) //Hold
write_short(0x0000) //Type
write_byte(r) //R
write_byte(g) //G
write_byte(b) //B
write_byte(br) //B
message_end()
}