-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACS%20v1.2.2.sp
1168 lines (994 loc) · 47.7 KB
/
ACS%20v1.2.2.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
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//////////////////////////////////////////
// Automatic Campaign Switcher for L4D2 //
// Version 1.2.2 //
// Compiled May 21, 2011 //
// Programmed by Chris Pringle //
//////////////////////////////////////////
/*==================================================================================================
This plugin was written in response to the server kicking everyone if the vote is not passed
at the end of the campaign. It will automatically switch to the appropriate map at all the
points a vote would be automatically called, by the game, to go to the lobby or play again.
ACS also includes a voting system in which people can vote for their favorite campaign/map
on a finale or scavenge map. The winning campaign/map will become the next map the server
loads.
Supported Game Modes in Left 4 Dead 2
Coop
Realism
Versus
Team Versus
Scavenge
Team Scavenge
Mutation 1-20
Community 1-5
Change Log
v1.2.3 (May 30, 2018) - Added the rest of the campaigns for all modes except for Scavenge
v1.2.2 (May 21, 2011) - Added message for new vote winner when a player disconnects
- Fixed the sound to play to all the players in the game
- Added a max amount of coop finale map failures cvar
- Changed the wait time for voting ad from round_start to the
player_left_start_area event
- Added the voting sound when the vote menu pops up
v1.2.1 (May 18, 2011) - Fixed mutation 15 (Versus Survival)
v1.2.0 (May 16, 2011) - Changed some of the text to be more clear
- Added timed notifications for the next map
- Added a cvar for how to advertise the next map
- Added a cvar for the next map advertisement interval
- Added a sound to help notify players of a new vote winner
- Added a cvar to enable/disable sound notification
- Added a custom wait time for coop game modes
v1.1.0 (May 12, 2011) - Added a voting system
- Added error checks if map is not found when switching
- Added a cvar for enabling/disabling voting system
- Added a cvar for how to advertise the voting system
- Added a cvar for time to wait for voting advertisement
- Added all current Mutation and Community game modes
v1.0.0 (May 5, 2011) - Initial Release
===================================================================================================*/
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "v1.2.2"
//Define the number of campaigns and maps in rotation
#define NUMBER_OF_CAMPAIGNS 13 /* CHANGE TO MATCH THE TOTAL NUMBER OF CAMPAIGNS */
#define NUMBER_OF_SCAVENGE_MAPS 13 /* CHANGE TO MATCH THE TOTAL NUMBER OF SCAVENGE MAPS */
//Define the wait time after round before changing to the next map in each game mode
#define WAIT_TIME_BEFORE_SWITCH_COOP 7.0
#define WAIT_TIME_BEFORE_SWITCH_VERSUS 6.0
#define WAIT_TIME_BEFORE_SWITCH_SCAVENGE 11.0
//Define Game Modes
#define GAMEMODE_UNKNOWN -1
#define GAMEMODE_COOP 0
#define GAMEMODE_VERSUS 1
#define GAMEMODE_SCAVENGE 2
#define GAMEMODE_SURVIVAL 3
#define DISPLAY_MODE_DISABLED 0
#define DISPLAY_MODE_HINT 1
#define DISPLAY_MODE_CHAT 2
#define DISPLAY_MODE_MENU 3
#define SOUND_NEW_VOTE_START "ui/Beep_SynthTone01.wav"
#define SOUND_NEW_VOTE_WINNER "ui/alert_clink.wav"
//Global Variables
new g_iGameMode; //Integer to store the gamemode
new g_iRoundEndCounter; //Round end event counter for versus
new g_iCoopFinaleFailureCount; //Number of times the Survivors have lost the current finale
new g_iMaxCoopFinaleFailures = 5; //Amount of times Survivors can fail before ACS switches in coop
new bool:g_bFinaleWon; //Indicates whether a finale has be beaten or not
//Campaign and map strings/names
new String:g_strCampaignFirstMap[NUMBER_OF_CAMPAIGNS][32]; //Array of maps to switch to
new String:g_strCampaignLastMap[NUMBER_OF_CAMPAIGNS][32]; //Array of maps to switch from
new String:g_strCampaignName[NUMBER_OF_CAMPAIGNS][32]; //Array of names of the campaign
new String:g_strScavengeMap[NUMBER_OF_SCAVENGE_MAPS][32]; //Array of scavenge maps
new String:g_strScavengeMapName[NUMBER_OF_SCAVENGE_MAPS][32]; //Name of scaveenge maps
//Voting Variables
new bool:g_bVotingEnabled = true; //Tells if the voting system is on
new g_iVotingAdDisplayMode = DISPLAY_MODE_HINT; //The way to advertise the voting system
new Float:g_fVotingAdDelayTime = 1.0; //Time to wait before showing advertising
new bool:g_bVoteWinnerSoundEnabled = true; //Sound plays when vote winner changes
new g_iNextMapAdDisplayMode = DISPLAY_MODE_HINT; //The way to advertise the next map
new Float:g_fNextMapAdInterval = 600.0; //Interval for ACS next map advertisement
new bool:g_bClientShownVoteAd[MAXPLAYERS + 1]; //If the client has seen the ad already
new bool:g_bClientVoted[MAXPLAYERS + 1]; //If the client has voted on a map
new g_iClientVote[MAXPLAYERS + 1]; //The value of the clients vote
new g_iWinningMapIndex; //Winning map/campaign's index
new g_iWinningMapVotes; //Winning map/campaign's number of votes
new Handle:g_hMenu_Vote[MAXPLAYERS + 1] = INVALID_HANDLE; //Handle for each players vote menu
//Console Variables (CVars)
new Handle:g_hCVar_VotingEnabled = INVALID_HANDLE;
new Handle:g_hCVar_VoteWinnerSoundEnabled = INVALID_HANDLE;
new Handle:g_hCVar_VotingAdMode = INVALID_HANDLE;
new Handle:g_hCVar_VotingAdDelayTime = INVALID_HANDLE;
new Handle:g_hCVar_NextMapAdMode = INVALID_HANDLE;
new Handle:g_hCVar_NextMapAdInterval = INVALID_HANDLE;
new Handle:g_hCVar_MaxFinaleFailures = INVALID_HANDLE;
/*======================================================================================
################## A C S M A P S T R I N G S #################
========================================================================================
### ###
### *** EDIT THESE STRINGS TO CHANGE THE MAP ROTATIONS TO YOUR LIKING *** ###
### ###
========================================================================================
### ###
### Note: The order these strings are stored is important, so make ###
### sure these match up or it will not work properly. ###
### ###
### Make all three of the string variables match, for example: ###
### ###
### Format(g_strCampaignFirstMap[1], 32, "c1m1_hotel"); ###
### Format(g_strCampaignLastMap[1], 32, "c1m4_atrium"); ###
### Format(g_strCampaignName[1], 32, "Dead Center"); ###
### ###
### Notice, all of the strings corresponding with [1] in the array match. ###
### ###
======================================================================================*/
SetupMapStrings()
{
//The following three variables are for all game modes except Scavenge.
//*IMPORTANT* Before editing these change NUMBER_OF_CAMPAIGNS near the top
//of this plugin to match the total number of campaigns or it will not
//loop through all of them when the check is made to change the campaign.
//First Maps of the Campaign
Format(g_strCampaignFirstMap[0], 32, "c8m1_apartment");
Format(g_strCampaignFirstMap[1], 32, "c1m1_hotel");
Format(g_strCampaignFirstMap[2], 32, "c7m1_docks");
Format(g_strCampaignFirstMap[3], 32, "c6m1_riverbank");
Format(g_strCampaignFirstMap[4], 32, "c2m1_highway");
Format(g_strCampaignFirstMap[5], 32, "c3m1_plankcountry");
Format(g_strCampaignFirstMap[6], 32, "c4m1_milltown_a");
Format(g_strCampaignFirstMap[7], 32, "c5m1_waterfront");
Format(g_strCampaignFirstMap[8], 32, "c13m1_alpinecreek");
Format(g_strCampaignFirstMap[9], 32, "c10m1_caves");
Format(g_strCampaignFirstMap[10],32,"C12m1_hilltop");
Format(g_strCampaignFirstMap[11],32,"c11m1_greenhouse");
Format(g_strCampaignFirstMap[12],32,"c9m1_alleys");
//Last Maps of the Campaign
Format(g_strCampaignLastMap[0], 32, "c8m5_rooftop");
Format(g_strCampaignLastMap[1], 32, "c1m4_atrium");
Format(g_strCampaignLastMap[2], 32, "c7m3_port");
Format(g_strCampaignLastMap[3], 32, "c6m3_port");
Format(g_strCampaignLastMap[4], 32, "c2m5_concert");
Format(g_strCampaignLastMap[5], 32, "c3m4_plantation");
Format(g_strCampaignLastMap[6], 32, "c4m5_milltown_escape");
Format(g_strCampaignLastMap[7], 32, "c5m5_bridge");
Format(g_strCampaignLastMap[8], 32, "c13m4_cutthroatcreek");
Format(g_strCampaignLastMap[9], 32, "c10m5_houseboat");
Format(g_strCampaignLastMap[10],32, "C12m5_cornfield");
Format(g_strCampaignLastMap[11],32, "c11m5_runway");
Format(g_strCampaignLastMap[12],32, "c9m2_lots");
//Campaign Names
Format(g_strCampaignName[0], 32, "No Mercy");
Format(g_strCampaignName[1], 32, "Dead Center");
Format(g_strCampaignName[2], 32, "The Sacrifice");
Format(g_strCampaignName[3], 32, "The Passing");
Format(g_strCampaignName[4], 32, "Dark Carnival");
Format(g_strCampaignName[5], 32, "Swamp Fever");
Format(g_strCampaignName[6], 32, "Hard Rain");
Format(g_strCampaignName[7], 32, "The Parish");
Format(g_strCampaignName[8], 32, "Cold Stream");
Format(g_strCampaignName[9], 32, "Death Toll");
Format(g_strCampaignName[10],32, "Blood Harvest");
Format(g_strCampaignName[11],32, "Dead Air");
Format(g_strCampaignName[12],32, "Crash Course");
//The following string variables are only for Scavenge
//*IMPORTANT* Before editing these change NUMBER_OF_SCAVENGE_MAPS
//near the top of this plugin to match the total number of scavenge
//maps, or it will not loop through all of them when changing maps.
//Scavenge Maps
Format(g_strScavengeMap[0], 32, "c8m1_apartment");
Format(g_strScavengeMap[1], 32, "c8m5_rooftop");
Format(g_strScavengeMap[2], 32, "c1m4_atrium");
Format(g_strScavengeMap[3], 32, "c7m1_docks");
Format(g_strScavengeMap[4], 32, "c7m2_barge");
Format(g_strScavengeMap[5], 32, "c6m1_riverbank");
Format(g_strScavengeMap[6], 32, "c6m2_bedlam");
Format(g_strScavengeMap[7], 32, "c6m3_port");
Format(g_strScavengeMap[8], 32, "c2m1_highway");
Format(g_strScavengeMap[9], 32, "c3m1_plankcountry");
Format(g_strScavengeMap[10], 32, "c4m1_milltown_a");
Format(g_strScavengeMap[11], 32, "c4m2_sugarmill_a");
Format(g_strScavengeMap[12], 32, "c5m2_park");
//Scavenge Map Names
Format(g_strScavengeMapName[0], 32, "Apartments");
Format(g_strScavengeMapName[1], 32, "Rooftop");
Format(g_strScavengeMapName[2], 32, "Mall Atrium");
Format(g_strScavengeMapName[3], 32, "Brick Factory");
Format(g_strScavengeMapName[4], 32, "Barge");
Format(g_strScavengeMapName[5], 32, "Riverbank");
Format(g_strScavengeMapName[6], 32, "Underground");
Format(g_strScavengeMapName[7], 32, "Port");
Format(g_strScavengeMapName[8], 32, "Motel");
Format(g_strScavengeMapName[9], 32, "Plank Country");
Format(g_strScavengeMapName[10], 32, "Milltown");
Format(g_strScavengeMapName[11], 32, "Sugar Mill");
Format(g_strScavengeMapName[12], 32, "Park");
}
/*======================================================================================
##################### P L U G I N I N F O ####################
======================================================================================*/
public Plugin:myinfo =
{
name = "Automatic Campaign Switcher (ACS)",
author = "Chris Pringle",
description = "Automatically switches to the next campaign when the previous campaign is over",
version = PLUGIN_VERSION,
url = "http://forums.alliedmods.net/showthread.php?t=156392"
}
/*======================================================================================
################# O N P L U G I N S T A R T #################
======================================================================================*/
public OnPluginStart()
{
//Get the strings for all of the maps that are in rotation
SetupMapStrings();
//Create custom console variables
CreateConVar("acs_version", PLUGIN_VERSION, "Version of Automatic Campaign Switcher (ACS) on this server", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
g_hCVar_VotingEnabled = CreateConVar("acs_voting_system_enabled", "1", "Enables players to vote for the next map or campaign [0 = DISABLED, 1 = ENABLED]", FCVAR_PLUGIN, true, 0.0, true, 1.0);
g_hCVar_VoteWinnerSoundEnabled = CreateConVar("acs_voting_sound_enabled", "1", "Determines if a sound plays when a new map is winning the vote [0 = DISABLED, 1 = ENABLED]", FCVAR_PLUGIN, true, 0.0, true, 1.0);
g_hCVar_VotingAdMode = CreateConVar("acs_voting_ad_mode", "1", "Sets how to advertise voting at the start of the map [0 = DISABLED, 1 = HINT TEXT, 2 = CHAT TEXT, 3 = OPEN VOTE MENU]\n * Note: This is only displayed once during a finale or scavenge map *", FCVAR_PLUGIN, true, 0.0, true, 3.0);
g_hCVar_VotingAdDelayTime = CreateConVar("acs_voting_ad_delay_time", "1.0", "Time, in seconds, to wait after survivors leave the start area to advertise voting as defined in acs_voting_ad_mode\n * Note: If the server is up, changing this in the .cfg file takes two map changes before the change takes place *", FCVAR_PLUGIN, true, 0.1, false);
g_hCVar_NextMapAdMode = CreateConVar("acs_next_map_ad_mode", "1", "Sets how the next campaign/map is advertised during a finale or scavenge map [0 = DISABLED, 1 = HINT TEXT, 2 = CHAT TEXT]", FCVAR_PLUGIN, true, 0.0, true, 2.0);
g_hCVar_NextMapAdInterval = CreateConVar("acs_next_map_ad_interval", "600.0", "The time, in seconds, between advertisements for the next campaign/map on finales and scavenge maps", FCVAR_PLUGIN, true, 60.0, false);
g_hCVar_MaxFinaleFailures = CreateConVar("acs_max_coop_finale_failures", "5", "The amount of times the survivors can fail a finale in Coop before it switches to the next campaign [0 = INFINITE FAILURES]", FCVAR_PLUGIN, true, 0.0, false);
//Hook console variable changes
HookConVarChange(g_hCVar_VotingEnabled, CVarChange_Voting);
HookConVarChange(g_hCVar_VoteWinnerSoundEnabled, CVarChange_NewVoteWinnerSound);
HookConVarChange(g_hCVar_VotingAdMode, CVarChange_VotingAdMode);
HookConVarChange(g_hCVar_VotingAdDelayTime, CVarChange_VotingAdDelayTime);
HookConVarChange(g_hCVar_NextMapAdMode, CVarChange_NewMapAdMode);
HookConVarChange(g_hCVar_NextMapAdInterval, CVarChange_NewMapAdInterval);
HookConVarChange(g_hCVar_MaxFinaleFailures, CVarChange_MaxFinaleFailures);
//Hook the game events
//HookEvent("round_start", Event_RoundStart);
HookEvent("player_left_start_area", Event_PlayerLeftStartArea);
HookEvent("round_end", Event_RoundEnd);
HookEvent("finale_win", Event_FinaleWin);
HookEvent("scavenge_match_finished", Event_ScavengeMapFinished);
HookEvent("player_disconnect", Event_PlayerDisconnect);
//Register custom console commands
RegConsoleCmd("mapvote", MapVote);
RegConsoleCmd("mapvotes", DisplayCurrentVotes);
}
/*======================================================================================
########## C V A R C A L L B A C K F U N C T I O N S ###########
======================================================================================*/
//Callback function for the cvar for voting system
public CVarChange_Voting(Handle:hCVar, const String:strOldValue[], const String:strNewValue[])
{
//If the value was not changed, then do nothing
if(StrEqual(strOldValue, strNewValue) == true)
return;
//If the value was changed, then set it and display a message to the server and players
if (StringToInt(strNewValue) == 1)
{
g_bVotingEnabled = true;
PrintToServer("[ACS] ConVar changed: Voting System ENABLED");
PrintToChatAll("[ACS] ConVar changed: Voting System ENABLED");
}
else
{
g_bVotingEnabled = false;
PrintToServer("[ACS] ConVar changed: Voting System DISABLED");
PrintToChatAll("[ACS] ConVar changed: Voting System DISABLED");
}
}
//Callback function for enabling or disabling the new vote winner sound
public CVarChange_NewVoteWinnerSound(Handle:hCVar, const String:strOldValue[], const String:strNewValue[])
{
//If the value was not changed, then do nothing
if(StrEqual(strOldValue, strNewValue) == true)
return;
//If the value was changed, then set it and display a message to the server and players
if (StringToInt(strNewValue) == 1)
{
g_bVoteWinnerSoundEnabled = true;
PrintToServer("[ACS] ConVar changed: New vote winner sound ENABLED");
PrintToChatAll("[ACS] ConVar changed: New vote winner sound ENABLED");
}
else
{
g_bVoteWinnerSoundEnabled = false;
PrintToServer("[ACS] ConVar changed: New vote winner sound DISABLED");
PrintToChatAll("[ACS] ConVar changed: New vote winner sound DISABLED");
}
}
//Callback function for how the voting system is advertised to the players at the beginning of the round
public CVarChange_VotingAdMode(Handle:hCVar, const String:strOldValue[], const String:strNewValue[])
{
//If the value was not changed, then do nothing
if(StrEqual(strOldValue, strNewValue) == true)
return;
//If the value was changed, then set it and display a message to the server and players
switch(StringToInt(strNewValue))
{
case 0:
{
g_iVotingAdDisplayMode = DISPLAY_MODE_DISABLED;
PrintToServer("[ACS] ConVar changed: Voting display mode: DISABLED");
PrintToChatAll("[ACS] ConVar changed: Voting display mode: DISABLED");
}
case 1:
{
g_iVotingAdDisplayMode = DISPLAY_MODE_HINT;
PrintToServer("[ACS] ConVar changed: Voting display mode: HINT TEXT");
PrintToChatAll("[ACS] ConVar changed: Voting display mode: HINT TEXT");
}
case 2:
{
g_iVotingAdDisplayMode = DISPLAY_MODE_CHAT;
PrintToServer("[ACS] ConVar changed: Voting display mode: CHAT TEXT");
PrintToChatAll("[ACS] ConVar changed: Voting display mode: CHAT TEXT");
}
case 3:
{
g_iVotingAdDisplayMode = DISPLAY_MODE_MENU;
PrintToServer("[ACS] ConVar changed: Voting display mode: OPEN VOTE MENU");
PrintToChatAll("[ACS] ConVar changed: Voting display mode: OPEN VOTE MENU");
}
}
}
//Callback function for the cvar for voting display delay time
public CVarChange_VotingAdDelayTime(Handle:hCVar, const String:strOldValue[], const String:strNewValue[])
{
//If the value was not changed, then do nothing
if(StrEqual(strOldValue, strNewValue) == true)
return;
//Get the new value
new Float:fDelayTime = StringToFloat(strNewValue);
//If the value was changed, then set it and display a message to the server and players
if (fDelayTime > 0.1)
{
g_fVotingAdDelayTime = fDelayTime;
PrintToServer("[ACS] ConVar changed: Voting advertisement delay time changed to %f", fDelayTime);
PrintToChatAll("[ACS] ConVar changed: Voting advertisement delay time changed to %f", fDelayTime);
}
else
{
g_fVotingAdDelayTime = 0.1;
PrintToServer("[ACS] ConVar changed: Voting advertisement delay time changed to 0.1");
PrintToChatAll("[ACS] ConVar changed: Voting advertisement delay time changed to 0.1");
}
}
//Callback function for how ACS and the next map is advertised to the players during a finale
public CVarChange_NewMapAdMode(Handle:hCVar, const String:strOldValue[], const String:strNewValue[])
{
//If the value was not changed, then do nothing
if(StrEqual(strOldValue, strNewValue) == true)
return;
//If the value was changed, then set it and display a message to the server and players
switch(StringToInt(strNewValue))
{
case 0:
{
g_iNextMapAdDisplayMode = DISPLAY_MODE_DISABLED;
PrintToServer("[ACS] ConVar changed: Next map advertisement display mode: DISABLED");
PrintToChatAll("[ACS] ConVar changed: Next map advertisement display mode: DISABLED");
}
case 1:
{
g_iNextMapAdDisplayMode = DISPLAY_MODE_HINT;
PrintToServer("[ACS] ConVar changed: Next map advertisement display mode: HINT TEXT");
PrintToChatAll("[ACS] ConVar changed: Next map advertisement display mode: HINT TEXT");
}
case 2:
{
g_iNextMapAdDisplayMode = DISPLAY_MODE_CHAT;
PrintToServer("[ACS] ConVar changed: Next map advertisement display mode: CHAT TEXT");
PrintToChatAll("[ACS] ConVar changed: Next map advertisement display mode: CHAT TEXT");
}
}
}
//Callback function for the interval that controls the timer that advertises ACS and the next map
public CVarChange_NewMapAdInterval(Handle:hCVar, const String:strOldValue[], const String:strNewValue[])
{
//If the value was not changed, then do nothing
if(StrEqual(strOldValue, strNewValue) == true)
return;
//Get the new value
new Float:fDelayTime = StringToFloat(strNewValue);
//If the value was changed, then set it and display a message to the server and players
if (fDelayTime > 60.0)
{
g_fNextMapAdInterval = fDelayTime;
PrintToServer("[ACS] ConVar changed: Next map advertisement interval changed to %f", fDelayTime);
PrintToChatAll("[ACS] ConVar changed: Next map advertisement interval changed to %f", fDelayTime);
}
else
{
g_fNextMapAdInterval = 60.0;
PrintToServer("[ACS] ConVar changed: Next map advertisement interval changed to 60.0");
PrintToChatAll("[ACS] ConVar changed: Next map advertisement interval changed to 60.0");
}
}
//Callback function for the amount of times the survivors can fail a coop finale map before ACS switches
public CVarChange_MaxFinaleFailures(Handle:hCVar, const String:strOldValue[], const String:strNewValue[])
{
//If the value was not changed, then do nothing
if(StrEqual(strOldValue, strNewValue) == true)
return;
//Get the new value
new iMaxFailures = StringToInt(strNewValue);
//If the value was changed, then set it and display a message to the server and players
if (iMaxFailures > 0)
{
g_iMaxCoopFinaleFailures = iMaxFailures;
PrintToServer("[ACS] ConVar changed: Max Coop finale failures changed to %f", iMaxFailures);
PrintToChatAll("[ACS] ConVar changed: Max Coop finale failures changed to %f", iMaxFailures);
}
else
{
g_iMaxCoopFinaleFailures = 0;
PrintToServer("[ACS] ConVar changed: Max Coop finale failures changed to 0");
PrintToChatAll("[ACS] ConVar changed: Max Coop finale failures changed to 0");
}
}
/*======================================================================================
################# E V E N T S #################
======================================================================================*/
public OnMapStart()
{
//Execute config file
decl String:strFileName[64];
Format(strFileName, sizeof(strFileName), "Automatic_Campaign_Switcher_%s", PLUGIN_VERSION);
AutoExecConfig(true, strFileName);
//Set all the menu handles to invalid
CleanUpMenuHandles();
//Set the game mode
FindGameMode();
//Precache sounds
PrecacheSound(SOUND_NEW_VOTE_START);
PrecacheSound(SOUND_NEW_VOTE_WINNER);
//Display advertising for the next campaign or map
if(g_iNextMapAdDisplayMode != DISPLAY_MODE_DISABLED)
CreateTimer(g_fNextMapAdInterval, Timer_AdvertiseNextMap, _, TIMER_FLAG_NO_MAPCHANGE);
g_iRoundEndCounter = 0; //Reset the round end counter on every map start
g_iCoopFinaleFailureCount = 0; //Reset the amount of Survivor failures
g_bFinaleWon = false; //Reset the finale won variable
ResetAllVotes(); //Reset every player's vote
}
//Event fired when the Survivors leave the start area
public Action:Event_PlayerLeftStartArea(Handle:hEvent, const String:strName[], bool:bDontBroadcast)
{
if(g_bVotingEnabled == true && OnFinaleOrScavengeMap() == true)
CreateTimer(g_fVotingAdDelayTime, Timer_DisplayVoteAdToAll, _, TIMER_FLAG_NO_MAPCHANGE);
return Plugin_Continue;
}
//Event fired when the Round Ends
public Action:Event_RoundEnd(Handle:hEvent, const String:strName[], bool:bDontBroadcast)
{
//Check to see if on a finale map, if so change to the next campaign after two rounds
if(g_iGameMode == GAMEMODE_VERSUS && OnFinaleOrScavengeMap() == true)
{
g_iRoundEndCounter++;
if(g_iRoundEndCounter >= 4) //This event must be fired on the fourth time Round End occurs.
CheckMapForChange(); //This is because it fires twice during each round end for
//some strange reason, and versus has two rounds in it.
}
//If in Coop and on a finale, check to see if the surviors have lost the max amount of times
else if(g_iGameMode == GAMEMODE_COOP && OnFinaleOrScavengeMap() == true &&
g_iMaxCoopFinaleFailures > 0 && g_bFinaleWon == false &&
++g_iCoopFinaleFailureCount >= g_iMaxCoopFinaleFailures)
{
CheckMapForChange();
}
return Plugin_Continue;
}
//Event fired when a finale is won
public Action:Event_FinaleWin(Handle:hEvent, const String:strName[], bool:bDontBroadcast)
{
g_bFinaleWon = true; //This is used so that the finale does not switch twice if this event
//happens to land on a max failure count as well as this
//Change to the next campaign
if(g_iGameMode == GAMEMODE_COOP)
CheckMapForChange();
return Plugin_Continue;
}
//Event fired when a map is finished for scavenge
public Action:Event_ScavengeMapFinished(Handle:hEvent, const String:strName[], bool:bDontBroadcast)
{
//Change to the next Scavenge map
if(g_iGameMode == GAMEMODE_SCAVENGE)
ChangeScavengeMap();
return Plugin_Continue;
}
//Event fired when a player disconnects from the server
public Action:Event_PlayerDisconnect(Handle:hEvent, const String:strName[], bool:bDontBroadcast)
{
new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if(iClient < 1)
return Plugin_Continue;
//Reset the client's votes
g_bClientVoted[iClient] = false;
g_iClientVote[iClient] = -1;
//Check to see if there is a new vote winner
SetTheCurrentVoteWinner();
return Plugin_Continue;
}
/*======================================================================================
################# F I N D G A M E M O D E #################
======================================================================================*/
//Find the current gamemode and store it into this plugin
FindGameMode()
{
//Get the gamemode string from the game
decl String:strGameMode[20];
GetConVarString(FindConVar("mp_gamemode"), strGameMode, sizeof(strGameMode));
//Set the global gamemode int for this plugin
if(StrEqual(strGameMode, "coop"))
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "realism"))
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode,"versus"))
g_iGameMode = GAMEMODE_VERSUS;
else if(StrEqual(strGameMode, "teamversus"))
g_iGameMode = GAMEMODE_VERSUS;
else if(StrEqual(strGameMode, "scavenge"))
g_iGameMode = GAMEMODE_SCAVENGE;
else if(StrEqual(strGameMode, "teamscavenge"))
g_iGameMode = GAMEMODE_SCAVENGE;
else if(StrEqual(strGameMode, "survival"))
g_iGameMode = GAMEMODE_SURVIVAL;
else if(StrEqual(strGameMode, "mutation1")) //Last Man On Earth
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation2")) //Headshot!
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation3")) //Bleed Out
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation4")) //Hard Eight
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation5")) //Four Swordsmen
g_iGameMode = GAMEMODE_COOP;
//else if(StrEqual(strGameMode, "mutation6")) //Nothing here
// g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation7")) //Chainsaw Massacre
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation8")) //Ironman
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation9")) //Last Gnome On Earth
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation10")) //Room For One
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation11")) //Healthpackalypse!
g_iGameMode = GAMEMODE_VERSUS;
else if(StrEqual(strGameMode, "mutation12")) //Realism Versus
g_iGameMode = GAMEMODE_VERSUS;
else if(StrEqual(strGameMode, "mutation13")) //Follow the Liter
g_iGameMode = GAMEMODE_SCAVENGE;
else if(StrEqual(strGameMode, "mutation14")) //Gib Fest
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation15")) //Versus Survival
g_iGameMode = GAMEMODE_SURVIVAL;
else if(StrEqual(strGameMode, "mutation16")) //Hunting Party
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation17")) //Lone Gunman
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "mutation18")) //Bleed Out Versus
g_iGameMode = GAMEMODE_VERSUS;
else if(StrEqual(strGameMode, "mutation19")) //Taaannnkk!
g_iGameMode = GAMEMODE_VERSUS;
else if(StrEqual(strGameMode, "mutation20")) //Healing Gnome
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "community1")) //Special Delivery
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "community2")) //Flu Season
g_iGameMode = GAMEMODE_COOP;
else if(StrEqual(strGameMode, "community3")) //Riding My Survivor
g_iGameMode = GAMEMODE_VERSUS;
else if(StrEqual(strGameMode, "community4")) //Nightmare
g_iGameMode = GAMEMODE_SURVIVAL;
else if(StrEqual(strGameMode, "community5")) //Death's Door
g_iGameMode = GAMEMODE_COOP;
else
g_iGameMode = GAMEMODE_UNKNOWN;
}
/*======================================================================================
################# A C S C H A N G E M A P #################
======================================================================================*/
//Check to see if the current map is a finale, and if so, switch to the next campaign
CheckMapForChange()
{
decl String:strCurrentMap[32];
GetCurrentMap(strCurrentMap,32); //Get the current map from the game
for(new iMapIndex = 0; iMapIndex < NUMBER_OF_CAMPAIGNS; iMapIndex++)
{
//Check to see if current map is last map
if(StrEqual(strCurrentMap, g_strCampaignLastMap[iMapIndex]) == true)
{
//Check to see if someone voted for a campaign, if so, then change to the winning campaign
if(g_bVotingEnabled == true && g_iWinningMapVotes > 0 && g_iWinningMapIndex >= 0)
{
if(IsMapValid(g_strCampaignFirstMap[g_iWinningMapIndex]) == true)
{
PrintToChatAll("\x03[ACS] \x05Switching campaign to the vote winner: \x04%s", g_strCampaignName[g_iWinningMapIndex]);
if(g_iGameMode == GAMEMODE_VERSUS)
CreateTimer(WAIT_TIME_BEFORE_SWITCH_VERSUS, Timer_ChangeCampaign, g_iWinningMapIndex);
else if(g_iGameMode == GAMEMODE_COOP)
CreateTimer(WAIT_TIME_BEFORE_SWITCH_COOP, Timer_ChangeCampaign, g_iWinningMapIndex);
return;
}
else
LogError("Error: %s is an invalid map name, attempting normal map rotation.", g_strCampaignFirstMap[g_iWinningMapIndex]);
}
//If no map was chosen in the vote, then go with the automatic map rotation
if(iMapIndex == NUMBER_OF_CAMPAIGNS - 1) //Check to see if its the end of the array
iMapIndex = -1; //If so, start the array over by setting to -1 + 1 = 0
if(IsMapValid(g_strCampaignFirstMap[iMapIndex + 1]) == true)
{
PrintToChatAll("\x03[ACS] \x05Switching campaign to \x04%s", g_strCampaignName[iMapIndex + 1]);
if(g_iGameMode == GAMEMODE_VERSUS)
CreateTimer(WAIT_TIME_BEFORE_SWITCH_VERSUS, Timer_ChangeCampaign, iMapIndex + 1);
else if(g_iGameMode == GAMEMODE_COOP)
CreateTimer(WAIT_TIME_BEFORE_SWITCH_COOP, Timer_ChangeCampaign, iMapIndex + 1);
}
else
LogError("Error: %s is an invalid map name, unable to switch map.", g_strCampaignFirstMap[iMapIndex + 1]);
return;
}
}
}
//Change to the next scavenge map
ChangeScavengeMap()
{
//Check to see if someone voted for a map, if so, then change to the winning map
if(g_bVotingEnabled == true && g_iWinningMapVotes > 0 && g_iWinningMapIndex >= 0)
{
if(IsMapValid(g_strScavengeMap[g_iWinningMapIndex]) == true)
{
PrintToChatAll("\x03[ACS] \x05Switching map to the vote winner: \x04%s", g_strScavengeMapName[g_iWinningMapIndex]);
CreateTimer(WAIT_TIME_BEFORE_SWITCH_SCAVENGE, Timer_ChangeScavengeMap, g_iWinningMapIndex);
return;
}
else
LogError("Error: %s is an invalid map name, attempting normal map rotation.", g_strScavengeMap[g_iWinningMapIndex]);
}
//If no map was chosen in the vote, then go with the automatic map rotation
decl String:strCurrentMap[32];
GetCurrentMap(strCurrentMap, 32); //Get the current map from the game
//Go through all maps and to find which map index it is on, and then switch to the next map
for(new iMapIndex = 0; iMapIndex < NUMBER_OF_SCAVENGE_MAPS; iMapIndex++)
{
if(StrEqual(strCurrentMap, g_strScavengeMap[iMapIndex]) == true)
{
if(iMapIndex == NUMBER_OF_SCAVENGE_MAPS - 1)//Check to see if its the end of the array
iMapIndex = -1; //If so, start the array over by setting to -1 + 1 = 0
//Make sure the map is valid before changing and displaying the message
if(IsMapValid(g_strScavengeMap[iMapIndex + 1]) == true)
{
PrintToChatAll("\x03[ACS] \x05Switching map to \x04%s", g_strScavengeMapName[iMapIndex + 1]);
CreateTimer(WAIT_TIME_BEFORE_SWITCH_SCAVENGE, Timer_ChangeScavengeMap, iMapIndex + 1);
}
else
LogError("Error: %s is an invalid map name, unable to switch map.", g_strScavengeMap[iMapIndex + 1]);
return;
}
}
}
//Change campaign to its index
public Action:Timer_ChangeCampaign(Handle:timer, any:iCampaignIndex)
{
ServerCommand("changelevel %s", g_strCampaignFirstMap[iCampaignIndex]); //Change the campaign
return Plugin_Stop;
}
//Change scavenge map to its index
public Action:Timer_ChangeScavengeMap(Handle:timer, any:iMapIndex)
{
ServerCommand("changelevel %s", g_strScavengeMap[iMapIndex]); //Change the map
return Plugin_Stop;
}
/*======================================================================================
################# A C S A D V E R T I S I N G #################
======================================================================================*/
public Action:Timer_AdvertiseNextMap(Handle:timer, any:iMapIndex)
{
//If next map advertising is enabled, display the text and start the timer again
if(g_iNextMapAdDisplayMode != DISPLAY_MODE_DISABLED)
{
DisplayNextMapToAll();
CreateTimer(g_fNextMapAdInterval, Timer_AdvertiseNextMap, _, TIMER_FLAG_NO_MAPCHANGE);
}
return Plugin_Stop;
}
DisplayNextMapToAll()
{
//If there is a winner to the vote display the winner if not display the next map in rotation
if(g_iWinningMapIndex >= 0)
{
if(g_iNextMapAdDisplayMode == DISPLAY_MODE_HINT)
{
//Display the map that is currently winning the vote to all the players using hint text
if(g_iGameMode == GAMEMODE_SCAVENGE)
PrintHintTextToAll("The next map is currently %s", g_strScavengeMapName[g_iWinningMapIndex]);
else
PrintHintTextToAll("The next campaign is currently %s", g_strCampaignName[g_iWinningMapIndex]);
}
else if(g_iNextMapAdDisplayMode == DISPLAY_MODE_CHAT)
{
//Display the map that is currently winning the vote to all the players using chat text
if(g_iGameMode == GAMEMODE_SCAVENGE)
PrintToChatAll("\x03[ACS] \x05The next map is currently \x04%s", g_strScavengeMapName[g_iWinningMapIndex]);
else
PrintToChatAll("\x03[ACS] \x05The next campaign is currently \x04%s", g_strCampaignName[g_iWinningMapIndex]);
}
}
else
{
decl String:strCurrentMap[32];
GetCurrentMap(strCurrentMap, 32); //Get the current map from the game
if(g_iGameMode == GAMEMODE_SCAVENGE)
{
//Go through all maps and to find which map index it is on, and then switch to the next map
for(new iMapIndex = 0; iMapIndex < NUMBER_OF_SCAVENGE_MAPS; iMapIndex++)
{
if(StrEqual(strCurrentMap, g_strScavengeMap[iMapIndex]) == true)
{
if(iMapIndex == NUMBER_OF_SCAVENGE_MAPS - 1) //Check to see if its the end of the array
iMapIndex = -1; //If so, start the array over by setting to -1 + 1 = 0
//Display the next map in the rotation in the appropriate way
if(g_iNextMapAdDisplayMode == DISPLAY_MODE_HINT)
PrintHintTextToAll("The next map is currently %s", g_strScavengeMapName[iMapIndex + 1]);
else if(g_iNextMapAdDisplayMode == DISPLAY_MODE_CHAT)
PrintToChatAll("\x03[ACS] \x05The next map is currently \x04%s", g_strScavengeMapName[iMapIndex + 1]);
}
}
}
else
{
//Go through all maps and to find which map index it is on, and then switch to the next map
for(new iMapIndex = 0; iMapIndex < NUMBER_OF_CAMPAIGNS; iMapIndex++)
{
if(StrEqual(strCurrentMap, g_strCampaignLastMap[iMapIndex]) == true)
{
if(iMapIndex == NUMBER_OF_CAMPAIGNS - 1) //Check to see if its the end of the array
iMapIndex = -1; //If so, start the array over by setting to -1 + 1 = 0
//Display the next map in the rotation in the appropriate way
if(g_iNextMapAdDisplayMode == DISPLAY_MODE_HINT)
PrintHintTextToAll("The next campaign is currently %s", g_strCampaignName[iMapIndex + 1]);
else if(g_iNextMapAdDisplayMode == DISPLAY_MODE_CHAT)
PrintToChatAll("\x03[ACS] \x05The next campaign is currently \x04%s", g_strCampaignName[iMapIndex + 1]);
}
}
}
}
}
/*======================================================================================
################# V O T I N G S Y S T E M #################
======================================================================================*/
/*======================================================================================
################ P L A Y E R C O M M A N D S ################
======================================================================================*/
//Command that a player can use to vote/revote for a map/campaign
public Action:MapVote(iClient, args)
{
if(g_bVotingEnabled == false)
{
PrintToChat(iClient, "\x03[ACS] \x05Voting has been disabled on this server.");
return;
}
if(OnFinaleOrScavengeMap() == false)
{
PrintToChat(iClient, "\x03[ACS] \x05Voting is only enabled on a Scavenge or finale map.");
return;
}
//Open the vote menu for the client if they arent using the server console
if(iClient < 1)
PrintToServer("You cannot vote for a map from the server console, use the in-game chat");
else
VoteMenuDraw(iClient);
}
//Command that a player can use to see the total votes for all maps/campaigns
public Action:DisplayCurrentVotes(iClient, args)
{
if(g_bVotingEnabled == false)
{
PrintToChat(iClient, "\x03[ACS] \x05Voting has been disabled on this server.");
return;
}
if(OnFinaleOrScavengeMap() == false)
{
PrintToChat(iClient, "\x03[ACS] \x05Voting is only enabled on a Scavenge or finale map.");
return;
}
decl iPlayer, iMap, iNumberOfMaps;
//Get the total number of maps for the current game mode
if(g_iGameMode == GAMEMODE_SCAVENGE)
iNumberOfMaps = NUMBER_OF_SCAVENGE_MAPS;
else
iNumberOfMaps = NUMBER_OF_CAMPAIGNS;
//Display to the client the current winning map
if(g_iWinningMapIndex != -1)
{
if(g_iGameMode == GAMEMODE_SCAVENGE)
PrintToChat(iClient, "\x03[ACS] \x05Currently winning the vote: \x04%s", g_strScavengeMapName[g_iWinningMapIndex]);
else
PrintToChat(iClient, "\x03[ACS] \x05Currently winning the vote: \x04%s", g_strCampaignName[g_iWinningMapIndex]);
}
else
PrintToChat(iClient, "\x03[ACS] \x05No one has voted yet.");
//Loop through all maps and display the ones that have votes
new iMapVotes[iNumberOfMaps];
for(iMap = 0; iMap < iNumberOfMaps; iMap++)
{
iMapVotes[iMap] = 0;
//Tally votes for the current map
for(iPlayer = 1; iPlayer <= MaxClients; iPlayer++)
if(g_iClientVote[iPlayer] == iMap)
iMapVotes[iMap]++;
//Display this particular map and its amount of votes it has to the client
if(iMapVotes[iMap] > 0)
{
if(g_iGameMode == GAMEMODE_SCAVENGE)
PrintToChat(iClient, "\x04 %s: \x05%d votes", g_strScavengeMapName[iMap], iMapVotes[iMap]);
else
PrintToChat(iClient, "\x04 %s: \x05%d votes", g_strCampaignName[iMap], iMapVotes[iMap]);
}
}
}
/*======================================================================================
############### V O T E M E N U ##############
======================================================================================*/
//Timer to show the menu to the players if they have not voted yet
public Action:Timer_DisplayVoteAdToAll(Handle:hTimer, any:iData)
{
if(g_bVotingEnabled == false || OnFinaleOrScavengeMap() == false)
return Plugin_Stop;
for(new iClient = 1;iClient <= MaxClients; iClient++)
{
if(g_bClientShownVoteAd[iClient] == false && g_bClientVoted[iClient] == false && IsClientInGame(iClient) == true && IsFakeClient(iClient) == false)
{
switch(g_iVotingAdDisplayMode)
{
case DISPLAY_MODE_MENU: VoteMenuDraw(iClient);
case DISPLAY_MODE_HINT: PrintHintText(iClient, "To vote for the next map, type: !mapvote\nTo see all the votes, type: !mapvotes");
case DISPLAY_MODE_CHAT: PrintToChat(iClient, "\x03[ACS] \x05To vote for the next map, type: \x04!mapvote\n \x05To see all the votes, type: \x04!mapvotes");
}
g_bClientShownVoteAd[iClient] = true;
}
}
return Plugin_Stop;
}
//Draw the menu for voting
public Action:VoteMenuDraw(iClient)
{
if(iClient < 1 || IsClientInGame(iClient) == false || IsFakeClient(iClient) == true)
return Plugin_Handled;
//Create the menu
g_hMenu_Vote[iClient] = CreateMenu(VoteMenuHandler);
//Give the player the option of not choosing a map
AddMenuItem(g_hMenu_Vote[iClient], "option1", "I Don't Care");
//Populate the menu with the maps in rotation for the corresponding game mode
if(g_iGameMode == GAMEMODE_SCAVENGE)
{
SetMenuTitle(g_hMenu_Vote[iClient], "Vote for the next map\n ");