-
Notifications
You must be signed in to change notification settings - Fork 174
/
get5.sp
1485 lines (1280 loc) · 52.9 KB
/
get5.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
/**
* =============================================================================
* Get5
* Copyright (C) 2016. Sean Lewis. All rights reserved.
* =============================================================================
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "include/get5.inc"
#include "include/logdebug.inc"
#include "include/restorecvars.inc"
#include <cstrike>
#include <json> // github.com/clugg/sm-json
#include <sdktools>
#include <sourcemod>
#include <testing>
#undef REQUIRE_EXTENSIONS
#include <SteamWorks>
#define CHECK_READY_TIMER_INTERVAL 1.0
#define INFO_MESSAGE_TIMER_INTERVAL 29.0
#define DEBUG_CVAR "get5_debug"
#define MATCH_ID_LENGTH 64
#define MAX_CVAR_LENGTH 128
#define MATCH_END_DELAY_AFTER_TV 10
#define TEAM1_COLOR "{LIGHT_GREEN}"
#define TEAM2_COLOR "{PINK}"
#define TEAM1_STARTING_SIDE CS_TEAM_CT
#define TEAM2_STARTING_SIDE CS_TEAM_T
#define KNIFE_CONFIG "get5/knife.cfg"
#define DEFAULT_TAG "[{YELLOW}Get5{NORMAL}]"
#pragma semicolon 1
#pragma newdecls required
/** ConVar handles **/
ConVar g_AllowTechPauseCvar;
ConVar g_AutoLoadConfigCvar;
ConVar g_AutoReadyActivePlayers;
ConVar g_BackupSystemEnabledCvar;
ConVar g_CheckAuthsCvar;
ConVar g_DamagePrintCvar;
ConVar g_DamagePrintFormat;
ConVar g_DemoNameFormatCvar;
ConVar g_DisplayGotvVeto;
ConVar g_EndMatchOnEmptyServerCvar;
ConVar g_EventLogFormatCvar;
ConVar g_FixedPauseTimeCvar;
ConVar g_KickClientImmunity;
ConVar g_KickClientsWithNoMatchCvar;
ConVar g_LiveCfgCvar;
ConVar g_LiveCountdownTimeCvar;
ConVar g_MaxBackupAgeCvar;
ConVar g_MaxPausesCvar;
ConVar g_MaxPauseTimeCvar;
ConVar g_MessagePrefixCvar;
ConVar g_PauseOnVetoCvar;
ConVar g_PausingEnabledCvar;
ConVar g_PrettyPrintJsonCvar;
ConVar g_ReadyTeamTagCvar;
ConVar g_ResetPausesEachHalfCvar;
ConVar g_ServerIdCvar;
ConVar g_SetClientClanTagCvar;
ConVar g_SetHostnameCvar;
ConVar g_StatsPathFormatCvar;
ConVar g_StopCommandEnabledCvar;
ConVar g_TeamTimeToKnifeDecisionCvar;
ConVar g_TeamTimeToStartCvar;
ConVar g_TimeFormatCvar;
ConVar g_VetoConfirmationTimeCvar;
ConVar g_VetoCountdownCvar;
ConVar g_WarmupCfgCvar;
// Autoset convars (not meant for users to set)
ConVar g_GameStateCvar;
ConVar g_LastGet5BackupCvar;
ConVar g_VersionCvar;
// Hooked cvars built into csgo
ConVar g_CoachingEnabledCvar;
/** Series config game-state **/
int g_MapsToWin = 1; // Maps needed to win the series.
bool g_BO2Match = false;
char g_MatchID[MATCH_ID_LENGTH];
ArrayList g_MapPoolList = null;
ArrayList g_TeamAuths[MATCHTEAM_COUNT];
StringMap g_PlayerNames;
char g_TeamNames[MATCHTEAM_COUNT][MAX_CVAR_LENGTH];
char g_TeamTags[MATCHTEAM_COUNT][MAX_CVAR_LENGTH];
char g_FormattedTeamNames[MATCHTEAM_COUNT][MAX_CVAR_LENGTH];
char g_TeamFlags[MATCHTEAM_COUNT][MAX_CVAR_LENGTH];
char g_TeamLogos[MATCHTEAM_COUNT][MAX_CVAR_LENGTH];
char g_TeamMatchTexts[MATCHTEAM_COUNT][MAX_CVAR_LENGTH];
char g_MatchTitle[MAX_CVAR_LENGTH];
int g_FavoredTeamPercentage = 0;
char g_FavoredTeamText[MAX_CVAR_LENGTH];
int g_PlayersPerTeam = 5;
int g_MinPlayersToReady = 1;
int g_MinSpectatorsToReady = 0;
bool g_SkipVeto = false;
float g_VetoMenuTime = 0.0;
MatchSideType g_MatchSideType = MatchSideType_Standard;
ArrayList g_CvarNames = null;
ArrayList g_CvarValues = null;
bool g_InScrimMode = false;
bool g_HasKnifeRoundStarted = false;
/** Other state **/
Get5State g_GameState = Get5State_None;
ArrayList g_MapsToPlay = null;
ArrayList g_MapSides = null;
ArrayList g_MapsLeftInVetoPool = null;
MatchTeam g_LastVetoTeam;
Menu g_ActiveVetoMenu = null;
/** Backup data **/
bool g_WaitingForRoundBackup = false;
bool g_SavedValveBackup = false;
bool g_DoingBackupRestoreNow = false;
// Stats values
bool g_SetTeamClutching[4];
int g_RoundKills[MAXPLAYERS + 1]; // kills per round each client has gotten
int g_RoundClutchingEnemyCount[MAXPLAYERS +
1]; // number of enemies left alive when last alive on your team
bool g_TeamFirstKillDone[MATCHTEAM_COUNT];
bool g_TeamFirstDeathDone[MATCHTEAM_COUNT];
int g_PlayerKilledBy[MAXPLAYERS + 1];
float g_PlayerKilledByTime[MAXPLAYERS + 1];
int g_DamageDone[MAXPLAYERS + 1][MAXPLAYERS + 1];
int g_DamageDoneHits[MAXPLAYERS + 1][MAXPLAYERS + 1];
bool g_DamageDoneKill[MAXPLAYERS + 1][MAXPLAYERS + 1];
bool g_DamageDoneAssist[MAXPLAYERS + 1][MAXPLAYERS + 1];
bool g_DamageDoneFlashAssist[MAXPLAYERS + 1][MAXPLAYERS + 1];
bool g_PlayerRoundKillOrAssistOrTradedDeath[MAXPLAYERS + 1];
bool g_PlayerSurvived[MAXPLAYERS + 1];
KeyValues g_StatsKv;
ArrayList g_TeamScoresPerMap = null;
char g_LoadedConfigFile[PLATFORM_MAX_PATH];
char g_LoadedConfigUrl[PLATFORM_MAX_PATH];
int g_VetoCaptains[MATCHTEAM_COUNT]; // Clients doing the map vetos.
int g_TeamSeriesScores[MATCHTEAM_COUNT]; // Current number of maps won per-team.
bool g_TeamReadyOverride[MATCHTEAM_COUNT]; // Whether a team has been voluntarily force readied.
bool g_ClientReady[MAXPLAYERS + 1]; // Whether clients are marked ready.
int g_TeamSide[MATCHTEAM_COUNT]; // Current CS_TEAM_* side for the team.
int g_TeamStartingSide[MATCHTEAM_COUNT];
bool g_TeamReadyForUnpause[MATCHTEAM_COUNT];
bool g_TeamGivenStopCommand[MATCHTEAM_COUNT];
bool g_InExtendedPause;
int g_TeamPauseTimeUsed[MATCHTEAM_COUNT];
int g_TeamPausesUsed[MATCHTEAM_COUNT];
int g_PauseTimeUsed = 0;
int g_ReadyTimeWaitingUsed = 0;
char g_DefaultTeamColors[][] = {
TEAM1_COLOR,
TEAM2_COLOR,
"{NORMAL}",
"{NORMAL}",
};
char g_LastKickedPlayerAuth[64];
bool g_ForceWinnerSignal = false;
MatchTeam g_ForcedWinner = MatchTeam_TeamNone;
/** Chat aliases loaded **/
#define ALIAS_LENGTH 64
#define COMMAND_LENGTH 64
ArrayList g_ChatAliases;
ArrayList g_ChatAliasesCommands;
/** Map game-state **/
MatchTeam g_KnifeWinnerTeam = MatchTeam_TeamNone;
/** Map-game state not related to the actual gameplay. **/
char g_DemoFileName[PLATFORM_MAX_PATH];
bool g_MapChangePending = false;
bool g_MovingClientToCoach[MAXPLAYERS + 1];
bool g_PendingSideSwap = false;
Handle g_KnifeChangedCvars = INVALID_HANDLE;
Handle g_MatchConfigChangedCvars = INVALID_HANDLE;
/** Forwards **/
Handle g_OnBackupRestore = INVALID_HANDLE;
Handle g_OnDemoFinished = INVALID_HANDLE;
Handle g_OnEvent = INVALID_HANDLE;
Handle g_OnGameStateChanged = INVALID_HANDLE;
Handle g_OnGoingLive = INVALID_HANDLE;
Handle g_OnLoadMatchConfigFailed = INVALID_HANDLE;
Handle g_OnMapPicked = INVALID_HANDLE;
Handle g_OnMapResult = INVALID_HANDLE;
Handle g_OnMapVetoed = INVALID_HANDLE;
Handle g_OnSidePicked = INVALID_HANDLE;
Handle g_OnPreLoadMatchConfig = INVALID_HANDLE;
Handle g_OnRoundStatsUpdated = INVALID_HANDLE;
Handle g_OnSeriesInit = INVALID_HANDLE;
Handle g_OnSeriesResult = INVALID_HANDLE;
Handle g_OnMatchPaused = INVALID_HANDLE;
Handle g_OnMatchUnpaused = INVALID_HANDLE;
#include "get5/util.sp"
#include "get5/version.sp"
#include "get5/backups.sp"
#include "get5/chatcommands.sp"
#include "get5/debug.sp"
#include "get5/eventlogger.sp"
#include "get5/get5menu.sp"
#include "get5/goinglive.sp"
#include "get5/jsonhelpers.sp"
#include "get5/kniferounds.sp"
#include "get5/maps.sp"
#include "get5/mapveto.sp"
#include "get5/matchconfig.sp"
#include "get5/natives.sp"
#include "get5/pausing.sp"
#include "get5/readysystem.sp"
#include "get5/stats.sp"
#include "get5/teamlogic.sp"
#include "get5/tests.sp"
// clang-format off
public Plugin myinfo = {
name = "Get5",
author = "splewis",
description = "",
version = PLUGIN_VERSION,
url = "https://github.com/splewis/get5"
};
// clang-format on
/**
* Core SourceMod forwards,
*/
public void OnPluginStart() {
InitDebugLog(DEBUG_CVAR, "get5");
LogDebug("OnPluginStart version=%s", PLUGIN_VERSION);
/** Translations **/
LoadTranslations("get5.phrases");
LoadTranslations("common.phrases");
/** ConVars **/
g_AllowTechPauseCvar = CreateConVar("get5_allow_technical_pause", "1",
"Whether or not technical pauses are allowed");
g_AutoLoadConfigCvar =
CreateConVar("get5_autoload_config", "",
"Name of a match config file to automatically load when the server loads");
g_AutoReadyActivePlayers = CreateConVar(
"get5_auto_ready_active_players", "0",
"Whether to automatically mark players as ready if they kill anyone in the warmup or veto phase.");
g_BackupSystemEnabledCvar =
CreateConVar("get5_backup_system_enabled", "1", "Whether the get5 backup system is enabled");
g_DamagePrintCvar =
CreateConVar("get5_print_damage", "0", "Whether damage reports are printed on round end.");
g_DamagePrintFormat = CreateConVar(
"get5_damageprint_format",
"- [{KILL_TO}] ({DMG_TO} in {HITS_TO}) to [{KILL_FROM}] ({DMG_FROM} in {HITS_FROM}) from {NAME} ({HEALTH} HP)",
"Format of the damage output string. Available tags are in the default, color tags such as {LIGHT_RED} and {GREEN} also work. {KILL_TO} and {KILL_FROM} indicate kills, assists and flash assists as booleans, all of which are mutually exclusive.");
g_CheckAuthsCvar =
CreateConVar("get5_check_auths", "1",
"If set to 0, get5 will not force players to the correct team based on steamid");
g_DemoNameFormatCvar = CreateConVar("get5_demo_name_format", "{MATCHID}_map{MAPNUMBER}_{MAPNAME}",
"Format for demo file names, use \"\" to disable");
g_DisplayGotvVeto =
CreateConVar("get5_display_gotv_veto", "0",
"Whether to wait for map vetos to be printed to GOTV before changing map");
g_EndMatchOnEmptyServerCvar = CreateConVar(
"get5_end_match_on_empty_server", "0",
"Whether to end the match if all players disconnect before ending. No winner is set if this happens.");
g_EventLogFormatCvar =
CreateConVar("get5_event_log_format", "",
"Path to use when writing match event logs, use \"\" to disable");
g_FixedPauseTimeCvar =
CreateConVar("get5_fixed_pause_time", "0",
"If set to non-zero, this will be the fixed length of any pause");
g_KickClientImmunity = CreateConVar(
"get5_kick_immunity", "1",
"Whether or not admins with the changemap flag will be immune to kicks from \"get5_kick_when_no_match_loaded\". Set to \"0\" to disable");
g_KickClientsWithNoMatchCvar =
CreateConVar("get5_kick_when_no_match_loaded", "0",
"Whether the plugin kicks new clients when no match is loaded");
g_LiveCfgCvar =
CreateConVar("get5_live_cfg", "get5/live.cfg", "Config file to exec when the game goes live");
g_LiveCountdownTimeCvar = CreateConVar(
"get5_live_countdown_time", "10",
"Number of seconds used to count down when a match is going live", 0, true, 5.0, true, 60.0);
g_MaxBackupAgeCvar =
CreateConVar("get5_max_backup_age", "160000",
"Number of seconds before a backup file is automatically deleted, 0 to disable");
g_MaxPausesCvar =
CreateConVar("get5_max_pauses", "0", "Maximum number of pauses a team can use, 0=unlimited");
g_MaxPauseTimeCvar =
CreateConVar("get5_max_pause_time", "300",
"Maximum number of time the game can spend paused by a team, 0=unlimited");
g_MessagePrefixCvar =
CreateConVar("get5_message_prefix", DEFAULT_TAG, "The tag applied before plugin messages.");
g_ResetPausesEachHalfCvar =
CreateConVar("get5_reset_pauses_each_half", "1",
"Whether pause limits will be reset each halftime period");
g_PauseOnVetoCvar =
CreateConVar("get5_pause_on_veto", "0",
"Set 1 to Pause Match during Veto time");
g_PausingEnabledCvar = CreateConVar("get5_pausing_enabled", "1", "Whether pausing is allowed.");
g_PrettyPrintJsonCvar = CreateConVar("get5_pretty_print_json", "1",
"Whether all JSON output is in pretty-print format.");
g_ReadyTeamTagCvar =
CreateConVar("get5_ready_team_tag", "1",
"Adds [READY] [NOT READY] Tags before Team Names. 0 to disable it.");
g_ServerIdCvar = CreateConVar(
"get5_server_id", "0",
"Integer that identifies your server. This is used in temp files to prevent collisions.");
g_SetClientClanTagCvar = CreateConVar("get5_set_client_clan_tags", "1",
"Whether to set client clan tags to player ready status.");
g_SetHostnameCvar = CreateConVar(
"get5_hostname_format", "Get5: {TEAM1} vs {TEAM2}",
"Template that the server hostname will follow when a match is live. Leave field blank to disable. Valid parameters are: {MAPNUMBER}, {MATCHID}, {SERVERID}, {MAPNAME}, {TIME}, {TEAM1}, {TEAM2}");
g_StatsPathFormatCvar =
CreateConVar("get5_stats_path_format", "get5_matchstats_{MATCHID}.cfg",
"Where match stats are saved (updated each map end), set to \"\" to disable");
g_StopCommandEnabledCvar =
CreateConVar("get5_stop_command_enabled", "1",
"Whether clients can use the !stop command to restore to the last round");
g_TeamTimeToStartCvar = CreateConVar(
"get5_time_to_start", "0",
"Time (in seconds) teams have to ready up before forfeiting the match, 0=unlimited");
g_TeamTimeToKnifeDecisionCvar = CreateConVar(
"get5_time_to_make_knife_decision", "60",
"Time (in seconds) a team has to make a !stay/!swap decision after winning knife round, 0=unlimited");
g_TimeFormatCvar = CreateConVar(
"get5_time_format", "%Y-%m-%d_%H",
"Time format to use when creating file names. Don't tweak this unless you know what you're doing! Avoid using spaces or colons.");
g_VetoConfirmationTimeCvar = CreateConVar(
"get5_veto_confirmation_time", "2.0",
"Time (in seconds) from presenting a veto menu to a selection being made, during which a confirmation will be required, 0 to disable");
g_VetoCountdownCvar =
CreateConVar("get5_veto_countdown", "5",
"Seconds to countdown before veto process commences. Set to \"0\" to disable.");
g_WarmupCfgCvar =
CreateConVar("get5_warmup_cfg", "get5/warmup.cfg", "Config file to exec in warmup periods");
/** Create and exec plugin's configuration file **/
AutoExecConfig(true, "get5");
g_GameStateCvar =
CreateConVar("get5_game_state", "0", "Current game state (see get5.inc)", FCVAR_DONTRECORD);
g_LastGet5BackupCvar =
CreateConVar("get5_last_backup_file", "", "Last get5 backup file written", FCVAR_DONTRECORD);
g_VersionCvar = CreateConVar("get5_version", PLUGIN_VERSION, "Current get5 version",
FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD);
g_VersionCvar.SetString(PLUGIN_VERSION);
g_CoachingEnabledCvar = FindConVar("sv_coaching_enabled");
/** Client commands **/
g_ChatAliases = new ArrayList(ByteCountToCells(ALIAS_LENGTH));
g_ChatAliasesCommands = new ArrayList(ByteCountToCells(COMMAND_LENGTH));
AddAliasedCommand("r", Command_Ready, "Marks the client as ready");
AddAliasedCommand("ready", Command_Ready, "Marks the client as ready");
AddAliasedCommand("unready", Command_NotReady, "Marks the client as not ready");
AddAliasedCommand("notready", Command_NotReady, "Marks the client as not ready");
AddAliasedCommand("forceready", Command_ForceReadyClient, "Force marks clients team as ready");
AddAliasedCommand("tech", Command_TechPause, "Calls for a tech pause");
AddAliasedCommand("pause", Command_Pause, "Pauses the game");
AddAliasedCommand("unpause", Command_Unpause, "Unpauses the game");
AddAliasedCommand("coach", Command_SmCoach, "Marks a client as a coach for their team");
AddAliasedCommand("stay", Command_Stay,
"Elects to stay on the current team after winning a knife round");
AddAliasedCommand("swap", Command_Swap,
"Elects to swap the current teams after winning a knife round");
AddAliasedCommand("switch", Command_Swap,
"Elects to swap the current teams after winning a knife round");
AddAliasedCommand("t", Command_T, "Elects to start on T side after winning a knife round");
AddAliasedCommand("ct", Command_Ct, "Elects to start on CT side after winning a knife round");
AddAliasedCommand("stop", Command_Stop, "Elects to stop the game to reload a backup file");
/** Admin/server commands **/
RegAdminCmd(
"get5_loadmatch", Command_LoadMatch, ADMFLAG_CHANGEMAP,
"Loads a match config file (json or keyvalues) from a file relative to the csgo/ directory");
RegAdminCmd(
"get5_loadmatch_url", Command_LoadMatchUrl, ADMFLAG_CHANGEMAP,
"Loads a JSON config file by sending a GET request to download it. Requires either the SteamWorks extension.");
RegAdminCmd("get5_loadteam", Command_LoadTeam, ADMFLAG_CHANGEMAP,
"Loads a team data from a file into a team");
RegAdminCmd("get5_endmatch", Command_EndMatch, ADMFLAG_CHANGEMAP, "Force ends the current match");
RegAdminCmd("get5_addplayer", Command_AddPlayer, ADMFLAG_CHANGEMAP,
"Adds a steamid to a match team");
RegAdminCmd("get5_removeplayer", Command_RemovePlayer, ADMFLAG_CHANGEMAP,
"Removes a steamid from a match team");
RegAdminCmd("get5_addkickedplayer", Command_AddKickedPlayer, ADMFLAG_CHANGEMAP,
"Adds the last kicked steamid to a match team");
RegAdminCmd("get5_removekickedplayer", Command_RemoveKickedPlayer, ADMFLAG_CHANGEMAP,
"Removes the last kicked steamid from a match team");
RegAdminCmd("get5_creatematch", Command_CreateMatch, ADMFLAG_CHANGEMAP,
"Creates and loads a match using the players currently on the server as a Bo1");
RegAdminCmd("get5_scrim", Command_CreateScrim, ADMFLAG_CHANGEMAP,
"Creates and loads a match using the scrim template");
RegAdminCmd("sm_scrim", Command_CreateScrim, ADMFLAG_CHANGEMAP,
"Creates and loads a match using the scrim template");
RegAdminCmd("get5_ringer", Command_Ringer, ADMFLAG_CHANGEMAP,
"Adds/removes a ringer to/from the home scrim team");
RegAdminCmd("sm_ringer", Command_Ringer, ADMFLAG_CHANGEMAP,
"Adds/removes a ringer to/from the home scrim team");
RegAdminCmd("sm_get5", Command_Get5AdminMenu, ADMFLAG_CHANGEMAP, "Displays a helper menu");
RegAdminCmd("get5_forceready", Command_AdminForceReady, ADMFLAG_CHANGEMAP,
"Force readies all current teams");
RegAdminCmd("get5_forcestart", Command_AdminForceReady, ADMFLAG_CHANGEMAP,
"Force readies all current teams");
RegAdminCmd("get5_dumpstats", Command_DumpStats, ADMFLAG_CHANGEMAP,
"Dumps match stats to a file");
RegAdminCmd("get5_listbackups", Command_ListBackups, ADMFLAG_CHANGEMAP,
"Lists get5 match backups for the current matchid or a given one");
RegAdminCmd("get5_loadbackup", Command_LoadBackup, ADMFLAG_CHANGEMAP,
"Loads a get5 match backup");
RegAdminCmd("get5_debuginfo", Command_DebugInfo, ADMFLAG_CHANGEMAP,
"Dumps debug info to a file (addons/sourcemod/logs/get5_debuginfo.txt by default)");
/** Other commands **/
RegConsoleCmd("get5_status", Command_Status, "Prints JSON formatted match state info");
RegServerCmd(
"get5_test", Command_Test,
"Runs get5 tests - should not be used on a live match server since it will reload a match config to test");
/** Hooks **/
HookEvent("player_spawn", Event_PlayerSpawn);
HookEvent("cs_win_panel_match", Event_MatchOver);
HookEvent("round_prestart", Event_RoundPreStart);
HookEvent("round_freeze_end", Event_FreezeEnd);
HookEvent("round_end", Event_RoundEnd);
HookEvent("server_cvar", Event_CvarChanged, EventHookMode_Pre);
HookEvent("player_connect_full", Event_PlayerConnectFull);
HookEvent("player_disconnect", Event_PlayerDisconnect);
HookEvent("player_team", Event_OnPlayerTeam, EventHookMode_Pre);
Stats_PluginStart();
Stats_InitSeries();
AddCommandListener(Command_Coach, "coach");
AddCommandListener(Command_JoinTeam, "jointeam");
AddCommandListener(Command_JoinGame, "joingame");
/** Setup data structures **/
g_MapPoolList = new ArrayList(PLATFORM_MAX_PATH);
g_MapsLeftInVetoPool = new ArrayList(PLATFORM_MAX_PATH);
g_MapsToPlay = new ArrayList(PLATFORM_MAX_PATH);
g_MapSides = new ArrayList();
g_CvarNames = new ArrayList(MAX_CVAR_LENGTH);
g_CvarValues = new ArrayList(MAX_CVAR_LENGTH);
g_TeamScoresPerMap = new ArrayList(MATCHTEAM_COUNT);
for (int i = 0; i < sizeof(g_TeamAuths); i++) {
g_TeamAuths[i] = new ArrayList(AUTH_LENGTH);
}
g_PlayerNames = new StringMap();
/** Create forwards **/
g_OnBackupRestore = CreateGlobalForward("Get5_OnBackupRestore", ET_Ignore);
g_OnDemoFinished = CreateGlobalForward("Get5_OnDemoFinished", ET_Ignore, Param_String);
g_OnEvent = CreateGlobalForward("Get5_OnEvent", ET_Ignore, Param_String);
g_OnGameStateChanged =
CreateGlobalForward("Get5_OnGameStateChanged", ET_Ignore, Param_Cell, Param_Cell);
g_OnGoingLive = CreateGlobalForward("Get5_OnGoingLive", ET_Ignore, Param_Cell);
g_OnMapResult = CreateGlobalForward("Get5_OnMapResult", ET_Ignore, Param_String, Param_Cell,
Param_Cell, Param_Cell, Param_Cell);
g_OnLoadMatchConfigFailed =
CreateGlobalForward("Get5_OnLoadMatchConfigFailed", ET_Ignore, Param_String);
g_OnMapPicked = CreateGlobalForward("Get5_OnMapPicked", ET_Ignore, Param_Cell, Param_String);
g_OnMapVetoed = CreateGlobalForward("Get5_OnMapVetoed", ET_Ignore, Param_Cell, Param_String);
g_OnSidePicked =
CreateGlobalForward("Get5_OnSidePicked", ET_Ignore, Param_Cell, Param_String, Param_Cell);
g_OnRoundStatsUpdated = CreateGlobalForward("Get5_OnRoundStatsUpdated", ET_Ignore);
g_OnPreLoadMatchConfig =
CreateGlobalForward("Get5_OnPreLoadMatchConfig", ET_Ignore, Param_String);
g_OnSeriesInit = CreateGlobalForward("Get5_OnSeriesInit", ET_Ignore);
g_OnSeriesResult =
CreateGlobalForward("Get5_OnSeriesResult", ET_Ignore, Param_Cell, Param_Cell, Param_Cell);
g_OnMatchPaused = CreateGlobalForward("Get5_OnMatchPaused", ET_Ignore, Param_Cell, Param_Cell);
g_OnMatchUnpaused = CreateGlobalForward("Get5_OnMatchUnpaused", ET_Ignore, Param_Cell);
/** Start any repeating timers **/
CreateTimer(CHECK_READY_TIMER_INTERVAL, Timer_CheckReady, _, TIMER_REPEAT);
CreateTimer(INFO_MESSAGE_TIMER_INTERVAL, Timer_InfoMessages, _, TIMER_REPEAT);
}
public Action Timer_InfoMessages(Handle timer) {
// Handle pre-veto messages
if (g_GameState == Get5State_PreVeto) {
if (IsTeamsReady() && !IsSpectatorsReady()) {
Get5_MessageToAll("%t", "WaitingForCastersReadyInfoMessage",
g_FormattedTeamNames[MatchTeam_TeamSpec]);
} else {
Get5_MessageToAll("%t", "ReadyToVetoInfoMessage");
}
MissingPlayerInfoMessage();
}
// Handle warmup state, provided we're not waiting for a map change
if (g_GameState == Get5State_Warmup && !g_MapChangePending) {
// Backups take priority
if (!IsTeamsReady() && g_WaitingForRoundBackup) {
Get5_MessageToAll("%t", "ReadyToRestoreBackupInfoMessage");
return Plugin_Continue;
}
// Find out what we're waiting for
if (IsTeamsReady() && !IsSpectatorsReady()) {
Get5_MessageToAll("%t", "WaitingForCastersReadyInfoMessage",
g_FormattedTeamNames[MatchTeam_TeamSpec]);
} else {
if (g_MapSides.Get(GetMapNumber()) == SideChoice_KnifeRound) {
Get5_MessageToAll("%t", "ReadyToKnifeInfoMessage");
} else {
Get5_MessageToAll("%t", "ReadyToStartInfoMessage");
}
}
MissingPlayerInfoMessage();
} else if (g_DisplayGotvVeto.BoolValue && g_GameState == Get5State_Warmup && g_MapChangePending) {
Get5_MessageToAll("%t", "WaitingForGOTVVetoInfoMessage");
}
// Handle waiting for knife decision
if (g_GameState == Get5State_WaitingForKnifeRoundDecision) {
Get5_MessageToAll("%t", "WaitingForEnemySwapInfoMessage",
g_FormattedTeamNames[g_KnifeWinnerTeam]);
}
// Handle postgame
if (g_GameState == Get5State_PostGame) {
Get5_MessageToAll("%t", "WaitingForGOTVBrodcastEndingInfoMessage");
}
return Plugin_Continue;
}
public void OnClientAuthorized(int client, const char[] auth) {
SetClientReady(client, false);
g_MovingClientToCoach[client] = false;
if (StrEqual(auth, "BOT", false)) {
return;
}
if (g_GameState != Get5State_None && g_CheckAuthsCvar.BoolValue) {
MatchTeam team = GetClientMatchTeam(client);
if (team == MatchTeam_TeamNone) {
RememberAndKickClient(client, "%t", "YourAreNotAPlayerInfoMessage");
} else {
int teamCount = CountPlayersOnMatchTeam(team, client);
if (teamCount >= g_PlayersPerTeam && !g_CoachingEnabledCvar.BoolValue) {
KickClient(client, "%t", "TeamIsFullInfoMessage");
}
}
}
}
public void RememberAndKickClient(int client, const char[] format, const char[] translationPhrase) {
GetAuth(client, g_LastKickedPlayerAuth, sizeof(g_LastKickedPlayerAuth));
KickClient(client, format, translationPhrase);
}
public void OnClientPutInServer(int client) {
if (IsFakeClient(client)) {
return;
}
CheckAutoLoadConfig();
if (g_GameState <= Get5State_Warmup && g_GameState != Get5State_None) {
if (GetRealClientCount() <= 1) {
ExecCfg(g_WarmupCfgCvar);
EnsurePausedWarmup();
}
}
Stats_ResetClientRoundValues(client);
}
public void OnClientPostAdminCheck(int client) {
if (IsPlayer(client)) {
if (g_GameState == Get5State_None && g_KickClientsWithNoMatchCvar.BoolValue) {
if (!g_KickClientImmunity.BoolValue ||
!CheckCommandAccess(client, "get5_kickcheck", ADMFLAG_CHANGEMAP)) {
KickClient(client, "%t", "NoMatchSetupInfoMessage");
}
}
}
}
public void OnClientSayCommand_Post(int client, const char[] command, const char[] sArgs) {
if (StrEqual(command, "say") && g_GameState != Get5State_None) {
EventLogger_ClientSay(client, sArgs);
}
CheckForChatAlias(client, command, sArgs);
}
/**
* Full connect event right when a player joins.
* This sets the auto-pick time to a high value because mp_forcepicktime is broken and
* if a player does not select a team but leaves their mouse over one, they are
* put on that team and spawned, so we can't allow that.
*/
public Action Event_PlayerConnectFull(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
EventLogger_PlayerConnect(client);
if (client > 0) {
SetEntPropFloat(client, Prop_Send, "m_fForceTeam", 3600.0);
}
}
public Action Event_PlayerDisconnect(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
EventLogger_PlayerDisconnect(client);
// TODO: consider adding a forfeit if a full team disconnects.
if (g_EndMatchOnEmptyServerCvar.BoolValue && g_GameState >= Get5State_Warmup &&
g_GameState < Get5State_PostGame && GetRealClientCount() == 0 && !g_MapChangePending) {
g_TeamSeriesScores[MatchTeam_Team1] = 0;
g_TeamSeriesScores[MatchTeam_Team2] = 0;
EndSeries();
}
}
public void OnMapStart() {
g_MapChangePending = false;
DeleteOldBackups();
ResetReadyStatus();
LOOP_TEAMS(team) {
g_TeamGivenStopCommand[team] = false;
g_TeamReadyForUnpause[team] = false;
g_TeamPauseTimeUsed[team] = 0;
g_TeamPausesUsed[team] = 0;
g_ReadyTimeWaitingUsed = 0;
}
if (g_WaitingForRoundBackup) {
ChangeState(Get5State_Warmup);
ExecCfg(g_LiveCfgCvar);
SetMatchTeamCvars();
ExecuteMatchConfigCvars();
EnsurePausedWarmup();
}
}
public void OnConfigsExecuted() {
SetStartingTeams();
CheckAutoLoadConfig();
if (g_GameState == Get5State_PostGame) {
ChangeState(Get5State_Warmup);
}
if (g_GameState == Get5State_Warmup || g_GameState == Get5State_Veto) {
ExecCfg(g_WarmupCfgCvar);
SetMatchTeamCvars();
ExecuteMatchConfigCvars();
EnsurePausedWarmup();
}
}
public Action Timer_CheckReady(Handle timer) {
if (g_GameState == Get5State_None) {
return Plugin_Continue;
}
if (g_DoingBackupRestoreNow) {
LogDebug("Timer_CheckReady: Waiting for restore");
return Plugin_Continue;
}
CheckTeamNameStatus(MatchTeam_Team1);
CheckTeamNameStatus(MatchTeam_Team2);
UpdateClanTags();
// Handle ready checks for pre-veto state
if (g_GameState == Get5State_PreVeto) {
if (IsTeamsReady()) {
// We don't wait for spectators when initiating veto
LogDebug("Timer_CheckReady: starting veto");
ChangeState(Get5State_Veto);
ServerCommand("mp_restartgame 1");
CreateVeto();
} else {
CheckReadyWaitingTimes();
}
}
// Handle ready checks for warmup, provided we are not waiting for a map change
if (g_GameState == Get5State_Warmup && !g_MapChangePending) {
// We don't wait for spectators when restoring backups
if (IsTeamsReady() && g_WaitingForRoundBackup) {
LogDebug("Timer_CheckReady: restoring from backup");
g_WaitingForRoundBackup = false;
RestoreGet5Backup();
return Plugin_Continue;
}
// Wait for both players and spectators before going live
if (IsTeamsReady() && IsSpectatorsReady()) {
LogDebug("Timer_CheckReady: all teams ready to start");
if (g_MapSides.Get(GetMapNumber()) == SideChoice_KnifeRound) {
LogDebug("Timer_CheckReady: starting with a knife round");
StartGame(true);
} else {
LogDebug("Timer_CheckReady: starting without a knife round");
StartGame(false);
}
} else {
CheckReadyWaitingTimes();
}
}
return Plugin_Continue;
}
static void CheckReadyWaitingTimes() {
if (g_TeamTimeToStartCvar.IntValue > 0) {
g_ReadyTimeWaitingUsed++;
bool team1Forfeited = CheckReadyWaitingTime(MatchTeam_Team1);
bool team2Forfeited = CheckReadyWaitingTime(MatchTeam_Team2);
if (team1Forfeited && team2Forfeited) {
g_ForcedWinner = MatchTeam_TeamNone;
Stats_Forfeit(MatchTeam_TeamNone);
} else if (team1Forfeited) {
g_ForcedWinner = MatchTeam_Team2;
Stats_Forfeit(MatchTeam_Team1);
} else if (team2Forfeited) {
g_ForcedWinner = MatchTeam_Team1;
Stats_Forfeit(MatchTeam_Team2);
}
if (team1Forfeited || team2Forfeited) {
g_ForceWinnerSignal = true;
ChangeState(Get5State_None);
EndSeries();
}
}
}
static bool CheckReadyWaitingTime(MatchTeam team) {
if (!IsTeamReady(team) && g_GameState != Get5State_None) {
int timeLeft = g_TeamTimeToStartCvar.IntValue - g_ReadyTimeWaitingUsed;
if (timeLeft <= 0) {
Get5_MessageToAll("%t", "TeamForfeitInfoMessage", g_FormattedTeamNames[team]);
return true;
} else if (timeLeft >= 300 && timeLeft % 60 == 0) {
Get5_MessageToAll("%t", "MinutesToForfeitMessage", g_FormattedTeamNames[team], timeLeft / 60);
} else if (timeLeft < 300 && timeLeft % 30 == 0) {
Get5_MessageToAll("%t", "SecondsToForfeitInfoMessage", g_FormattedTeamNames[team], timeLeft);
} else if (timeLeft == 10) {
Get5_MessageToAll("%t", "10SecondsToForfeitInfoMessage", g_FormattedTeamNames[team],
timeLeft);
}
}
return false;
}
static void CheckAutoLoadConfig() {
if (g_GameState == Get5State_None) {
char autoloadConfig[PLATFORM_MAX_PATH];
g_AutoLoadConfigCvar.GetString(autoloadConfig, sizeof(autoloadConfig));
if (!StrEqual(autoloadConfig, "")) {
LoadMatchConfig(autoloadConfig);
}
}
}
/**
* Client and server commands.
*/
public Action Command_EndMatch(int client, int args) {
if (g_GameState == Get5State_None) {
return Plugin_Handled;
}
// Call game-ending forwards.
g_MapChangePending = false;
char mapName[PLATFORM_MAX_PATH];
GetCleanMapName(mapName, sizeof(mapName));
int team1score = CS_GetTeamScore(MatchTeamToCSTeam(MatchTeam_Team1));
int team2score = CS_GetTeamScore(MatchTeamToCSTeam(MatchTeam_Team2));
LogDebug("Calling Get5_OnMapResult(map=%s, winner=%d, team1score=%d, team2score=%d, mapnum=%d)",
mapName, MatchTeam_TeamNone, team1score, team2score, GetMapNumber() - 1);
Call_StartForward(g_OnMapResult);
Call_PushString(mapName);
Call_PushCell(MatchTeam_TeamNone);
Call_PushCell(team1score);
Call_PushCell(team2score);
Call_PushCell(GetMapNumber() - 1);
Call_Finish();
EventLogger_SeriesCancel(g_TeamSeriesScores[MatchTeam_Team1],
g_TeamSeriesScores[MatchTeam_Team2]);
LogDebug("Calling Get5_OnSeriesResult(winner=%d, team1_series_score=%d, team2_series_score=%d)",
MatchTeam_TeamNone, g_TeamSeriesScores[MatchTeam_Team1],
g_TeamSeriesScores[MatchTeam_Team2]);
Call_StartForward(g_OnSeriesResult);
Call_PushCell(MatchTeam_TeamNone);
Call_PushCell(g_TeamSeriesScores[MatchTeam_Team1]);
Call_PushCell(g_TeamSeriesScores[MatchTeam_Team2]);
Call_Finish();
ChangeState(Get5State_None);
UpdateClanTags();
Get5_MessageToAll("%t", "AdminForceEndInfoMessage");
RestoreCvars(g_MatchConfigChangedCvars);
StopRecording();
if (g_ActiveVetoMenu != null) {
g_ActiveVetoMenu.Cancel();
}
return Plugin_Handled;
}
public Action Command_LoadMatch(int client, int args) {
if (g_GameState != Get5State_None) {
ReplyToCommand(client, "Cannot load a match when a match is already loaded");
return Plugin_Handled;
}
char arg[PLATFORM_MAX_PATH];
if (args >= 1 && GetCmdArg(1, arg, sizeof(arg))) {
if (!LoadMatchConfig(arg)) {
ReplyToCommand(client, "Failed to load match config.");
}
} else {
ReplyToCommand(client, "Usage: get5_loadmatch <filename>");
}
return Plugin_Handled;
}
public Action Command_LoadMatchUrl(int client, int args) {
if (g_GameState != Get5State_None) {
ReplyToCommand(client, "Cannot load a match config with another match already loaded");
return Plugin_Handled;
}
bool steamWorksAvaliable = LibraryExists("SteamWorks");
if (!steamWorksAvaliable) {
ReplyToCommand(client,
"Cannot load matches from a url without the SteamWorks extension running");
} else {
char arg[PLATFORM_MAX_PATH];
if (args >= 1 && GetCmdArgString(arg, sizeof(arg))) {
if (!LoadMatchFromUrl(arg)) {
ReplyToCommand(client, "Failed to load match config.");
} else {
ReplyToCommand(client, "Match config loading initialized.");
}
} else {
ReplyToCommand(client, "Usage: get5_loadmatch_url <url>");
}
}
return Plugin_Handled;
}
public Action Command_DumpStats(int client, int args) {
if (g_GameState == Get5State_None) {
ReplyToCommand(client, "Cannot dump match stats with no match existing");
return Plugin_Handled;
}
char arg[PLATFORM_MAX_PATH];
if (args < 1) {
arg = "get5_matchstats.cfg";
} else {
GetCmdArg(1, arg, sizeof(arg));
}
if (DumpToFilePath(arg)) {
g_StatsKv.Rewind();
ReplyToCommand(client, "Saved match stats to %s", arg);
} else {
ReplyToCommand(client, "Failed to save match stats to %s", arg);
}
return Plugin_Handled;
}
public Action Command_Stop(int client, int args) {
if (!g_StopCommandEnabledCvar.BoolValue) {
return Plugin_Handled;
}
if (g_GameState != Get5State_Live || g_PendingSideSwap == true) {
return Plugin_Handled;
}
// Let the server/rcon always force restore.
if (client == 0) {
RestoreLastRound();
}
MatchTeam team = GetClientMatchTeam(client);
g_TeamGivenStopCommand[team] = true;
if (g_TeamGivenStopCommand[MatchTeam_Team1] && !g_TeamGivenStopCommand[MatchTeam_Team2]) {
Get5_MessageToAll("%t", "TeamWantsToReloadLastRoundInfoMessage",
g_FormattedTeamNames[MatchTeam_Team1], g_FormattedTeamNames[MatchTeam_Team2]);
} else if (!g_TeamGivenStopCommand[MatchTeam_Team1] && g_TeamGivenStopCommand[MatchTeam_Team2]) {
Get5_MessageToAll("%t", "TeamWantsToReloadLastRoundInfoMessage",
g_FormattedTeamNames[MatchTeam_Team2], g_FormattedTeamNames[MatchTeam_Team1]);
} else if (g_TeamGivenStopCommand[MatchTeam_Team1] && g_TeamGivenStopCommand[MatchTeam_Team2]) {
RestoreLastRound();
}
return Plugin_Handled;
}
public bool RestoreLastRound() {
LOOP_TEAMS(x) {
g_TeamGivenStopCommand[x] = false;
}
char lastBackup[PLATFORM_MAX_PATH];
g_LastGet5BackupCvar.GetString(lastBackup, sizeof(lastBackup));
if (!StrEqual(lastBackup, "")) {
ServerCommand("get5_loadbackup \"%s\"", lastBackup);
return true;
}
return false;
}
/**
* Game Events *not* related to the stats tracking system.
*/
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) {
if (g_GameState != Get5State_None && g_GameState < Get5State_KnifeRound) {
int client = GetClientOfUserId(event.GetInt("userid"));
CreateTimer(0.1, Timer_ReplenishMoney, client, TIMER_FLAG_NO_MAPCHANGE);
}
}
public Action Timer_ReplenishMoney(Handle timer, int client) {
if (IsPlayer(client) && OnActiveTeam(client)) {
SetEntProp(client, Prop_Send, "m_iAccount", GetCvarIntSafe("mp_maxmoney"));
}
}
public Action Event_MatchOver(Event event, const char[] name, bool dontBroadcast) {
LogDebug("Event_MatchOver");
if (g_GameState == Get5State_Live) {
// Figure out who won
int t1score = CS_GetTeamScore(MatchTeamToCSTeam(MatchTeam_Team1));
int t2score = CS_GetTeamScore(MatchTeamToCSTeam(MatchTeam_Team2));
MatchTeam winningTeam = MatchTeam_TeamNone;
if (t1score > t2score) {
winningTeam = MatchTeam_Team1;
} else if (t2score > t1score) {
winningTeam = MatchTeam_Team2;
}
// Write backup before series score increments
WriteBackup();
// Update series scores
Stats_UpdateMapScore(winningTeam);
AddMapScore();
g_TeamSeriesScores[winningTeam]++;
// Handle map end
EventLogger_MapEnd(winningTeam);
char mapName[PLATFORM_MAX_PATH];
GetCleanMapName(mapName, sizeof(mapName));