-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwarmod.sp
5733 lines (5091 loc) · 158 KB
/
warmod.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
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <geoip>
#include <cstrike>
#include <socket>
#include <steamtools>
#include <warmod>
#include <basecomm>
#undef REQUIRE_PLUGIN
#include <adminmenu>
#include <autoupdate>
/* player info */
new g_player_list[MAXPLAYERS + 1];
new bool:g_premium_list[MAXPLAYERS + 1] = false;
new String:g_premium_prefix[MAXPLAYERS + 1][MAX_PARAM_SIZE];
new bool:g_cancel_list[MAXPLAYERS + 1];
new String:user_damage[MAXPLAYERS + 1][DMG_MSG_SIZE];
new g_scores[2][2];
new g_scores_overtime[2][256][2];
new g_overtime_count = 0;
new g_last_scores[2] = -1;
new g_last_maxrounds;
new String:g_last_names[2][64] = {DEFAULT_T_NAME, DEFAULT_CT_NAME};
new g_i_ragdolls = -1;
new g_i_account = -1;
new g_i_frags = -1;
/* miscellaneous */
new String:g_map[64];
new Float:g_match_start;
/* stats */
new bool:g_log_warmod_dir = false;
new String:g_log_filename[128];
new Handle:g_log_file = INVALID_HANDLE;
new String:weapon_list[][] = {"ak47","m4a1","awp","deagle","mp5navy","aug","p90","famas","galil","scout","g3sg1","hegrenade","usp", "glock","m249","m3","elite","fiveseven","mac10","p228","sg550","sg552","tmp","ump45","xm1014","knife","smokegrenade","flashbang"};
new weapon_stats[MAXPLAYERS + 1][NUM_WEAPONS][LOG_HIT_NUM];
new clutch_stats[MAXPLAYERS + 1][CLUTCH_NUM];
new String:last_weapon[MAXPLAYERS + 1][64];
new bool:g_planted = false;
new Handle:g_stats_trace_timer = INVALID_HANDLE;
/* forwards */
new Handle:g_f_on_lo3 = INVALID_HANDLE;
new Handle:g_f_on_half_time = INVALID_HANDLE;
new Handle:g_f_on_reset_half = INVALID_HANDLE;
new Handle:g_f_on_reset_match = INVALID_HANDLE;
new Handle:g_f_on_end_match = INVALID_HANDLE;
/* cvars */
new Handle:g_h_lw_enabled = INVALID_HANDLE;
new Handle:g_h_lw_address = INVALID_HANDLE;
new Handle:g_h_lw_port = INVALID_HANDLE;
new Handle:g_h_lw_bindaddress = INVALID_HANDLE;
new Handle:g_h_lw_group_name = INVALID_HANDLE;
new Handle:g_h_lw_group_password = INVALID_HANDLE;
new Handle:g_h_force_camera = INVALID_HANDLE;
new Handle:g_h_fade_to_black = INVALID_HANDLE;
new Handle:g_h_active = INVALID_HANDLE;
new Handle:g_h_stats_enabled = INVALID_HANDLE;
new Handle:g_h_stats_method = INVALID_HANDLE;
new Handle:g_h_stats_trace_enabled = INVALID_HANDLE;
new Handle:g_h_stats_trace_delay = INVALID_HANDLE;
new Handle:g_h_rcon_only = INVALID_HANDLE;
new Handle:g_h_global_chat = INVALID_HANDLE;
new Handle:g_h_stv_chat = INVALID_HANDLE;
new Handle:g_h_locked = INVALID_HANDLE;
new Handle:g_h_min_ready = INVALID_HANDLE;
new Handle:g_h_max_players = INVALID_HANDLE;
new Handle:g_h_match_config = INVALID_HANDLE;
new Handle:g_h_live_config = INVALID_HANDLE;
new Handle:g_h_knife_config = INVALID_HANDLE;
new Handle:g_h_end_config = INVALID_HANDLE;
new Handle:g_h_half_time_config = INVALID_HANDLE;
new Handle:g_h_round_money = INVALID_HANDLE;
new Handle:g_h_night_vision = INVALID_HANDLE;
new Handle:g_h_bomb_frags = INVALID_HANDLE;
new Handle:g_h_defuse_frags = INVALID_HANDLE;
new Handle:g_h_ingame_scores = INVALID_HANDLE;
new Handle:g_h_max_rounds = INVALID_HANDLE;
new Handle:g_h_warm_up_grens = INVALID_HANDLE;
new Handle:g_h_knife_hegrenade = INVALID_HANDLE;
new Handle:g_h_knife_flashbang = INVALID_HANDLE;
new Handle:g_h_knife_smokegrenade = INVALID_HANDLE;
new Handle:g_h_req_names = INVALID_HANDLE;
new Handle:g_h_show_info = INVALID_HANDLE;
new Handle:g_h_live_override = INVALID_HANDLE;
new Handle:g_h_live_override_knife = INVALID_HANDLE;
new Handle:g_h_auto_ready = INVALID_HANDLE;
new Handle:g_h_auto_swap = INVALID_HANDLE;
new Handle:g_h_auto_swap_delay = INVALID_HANDLE;
new Handle:g_h_half_auto_ready = INVALID_HANDLE;
new Handle:g_h_auto_knife = INVALID_HANDLE;
new Handle:g_h_auto_kick_team = INVALID_HANDLE;
new Handle:g_h_auto_kick_delay = INVALID_HANDLE;
new Handle:g_h_score_mode = INVALID_HANDLE;
new Handle:g_h_overtime = INVALID_HANDLE;
new Handle:g_h_overtime_mr = INVALID_HANDLE;
new Handle:g_h_overtime_money = INVALID_HANDLE;
new Handle:g_h_auto_record = INVALID_HANDLE;
new Handle:g_h_save_file_dir = INVALID_HANDLE;
new Handle:g_h_prefix_logs = INVALID_HANDLE;
new Handle:g_h_play_out = INVALID_HANDLE;
new Handle:g_h_damage = INVALID_HANDLE;
new Handle:g_h_remove_hint_text = INVALID_HANDLE;
new Handle:g_h_remove_gren_sound = INVALID_HANDLE;
new Handle:g_h_body_delay = INVALID_HANDLE;
new Handle:g_h_body_remove = INVALID_HANDLE;
new Handle:g_h_deathcam_remove = INVALID_HANDLE;
new Handle:g_h_deathcam_delay = INVALID_HANDLE;
new Handle:g_h_warmup_respawn = INVALID_HANDLE;
new Handle:g_h_status = INVALID_HANDLE;
new Handle:g_h_upload_results = INVALID_HANDLE;
new Handle:g_h_table_name = INVALID_HANDLE;
new Handle:g_h_t = INVALID_HANDLE;
new Handle:g_h_ct = INVALID_HANDLE;
new Handle:g_h_notify_version = INVALID_HANDLE;
new Handle:g_h_t_score = INVALID_HANDLE;
new Handle:g_h_ct_score = INVALID_HANDLE;
new Handle:g_h_mp_startmoney = INVALID_HANDLE;
/* ready system */
new Handle:g_m_ready_up = INVALID_HANDLE;
new bool:g_ready_enabled = false;
/* switches */
new bool:g_active = true;
new bool:g_match = false;
new bool:g_live = false;
new bool:g_playing_out = false;
new bool:g_first_half = true;
new bool:g_overtime = false;
new bool:g_t_money = false;
new bool:g_t_score = false;
new bool:g_t_knife = true;
new bool:g_t_had_knife = false;
new bool:g_round_end = false;
/* livewire */
new Handle:g_h_lw_socket = INVALID_HANDLE;
new bool:g_lw_connecting = false;
new bool:g_lw_connected = false;
/* modes */
new g_overtime_mode = 0;
/* teams */
new String:g_t_name[64];
new String:g_t_name_escaped[64]; // pre-escaped for warmod logs
new String:g_ct_name[64];
new String:g_ct_name_escaped[64]; // pre-escaped for warmod logs
/* admin menu */
new Handle:g_h_menu = INVALID_HANDLE;
/* deathcam */
new Handle:g_deathcam_delays[MAXPLAYERS + 1] = INVALID_HANDLE;
public Plugin:myinfo = {
name = "GameTech WarMod",
author = "Twelve-60",
description = WM_DESCRIPTION,
version = WM_VERSION,
url = "http://www.gametech.com.au/warmod/"
};
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
RegPluginLibrary("warmod");
return APLRes_Success;
}
public OnPluginStart()
{
LoadTranslations("warmod.phrases");
LoadTranslations("common.phrases");
new Handle:topmenu;
if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
{
OnAdminMenuReady(topmenu);
}
g_f_on_lo3 = CreateGlobalForward("OnLiveOn3", ET_Ignore);
g_f_on_half_time = CreateGlobalForward("OnHalfTime", ET_Ignore);
g_f_on_reset_half = CreateGlobalForward("OnResetHalf", ET_Ignore);
g_f_on_reset_match = CreateGlobalForward("OnResetMatch", ET_Ignore);
g_f_on_end_match = CreateGlobalForward("OnEndMatch", ET_Ignore);
RegConsoleCmd("score", ConsoleScore);
RegConsoleCmd("wm_version", WMVersion);
RegConsoleCmd("say", SayChat);
RegConsoleCmd("say_team", SayChat);
RegConsoleCmd("buy", RestrictBuy);
RegConsoleCmd("jointeam", ChooseTeam);
RegConsoleCmd("spectate", ChooseTeam);
RegConsoleCmd("wm_readylist", ReadyList);
RegConsoleCmd("wmrl", ReadyList);
RegConsoleCmd("wm_cash", AskTeamMoney);
RegAdminCmd("last_score", LastMatch, ADMFLAG_CUSTOM1, "Displays the score of the last match to the console");
RegAdminCmd("last", LastMatch, ADMFLAG_CUSTOM1, "Displays the score of the last match to the console");
RegAdminCmd("notlive", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("nl", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("cancelhalf", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("ch", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("cancelmatch", CancelMatch, ADMFLAG_CUSTOM1, "Declares match not live and restarts round");
RegAdminCmd("cm", CancelMatch, ADMFLAG_CUSTOM1, "Declares match not live and restarts round");
RegAdminCmd("readyup", ReadyToggle, ADMFLAG_CUSTOM1, "Starts or stops the ReadyUp System");
RegAdminCmd("ru", ReadyToggle, ADMFLAG_CUSTOM1, "Starts or stops the ReadyUp System");
RegAdminCmd("t", ChangeT, ADMFLAG_CUSTOM1, "Team starting terrorists - Designed for score purposes");
RegAdminCmd("ct", ChangeCT, ADMFLAG_CUSTOM1, "Team starting counter-terrorists - Designed for score purposes");
RegAdminCmd("swap", SwapAll, ADMFLAG_CUSTOM1, "Swap all players to the opposite team");
RegAdminCmd("pwd", ChangePassword, ADMFLAG_PASSWORD, "Set or display the sv_password console variable");
RegAdminCmd("pw", ChangePassword, ADMFLAG_PASSWORD, "Set or display the sv_password console variable");
RegAdminCmd("active", ActiveToggle, ADMFLAG_CUSTOM1, "Toggle the wm_active console variable");
RegAdminCmd("minready", ChangeMinReady, ADMFLAG_CUSTOM1, "Set or display the wm_min_ready console variable");
RegAdminCmd("maxrounds", ChangeMaxRounds, ADMFLAG_CUSTOM1, "Set or display the wm_max_rounds console variable");
RegAdminCmd("knife", KnifeOn3, ADMFLAG_CUSTOM1, "Remove all weapons except knife and lo3");
RegAdminCmd("ko3", KnifeOn3, ADMFLAG_CUSTOM1, "Remove all weapons except knife and lo3");
RegAdminCmd("cancelknife", CancelKnife, ADMFLAG_CUSTOM1, "Declares knife not live and restarts round");
RegAdminCmd("ck", CancelKnife, ADMFLAG_CUSTOM1, "Declares knife not live and restarts round");
RegAdminCmd("forceallready", ForceAllReady, ADMFLAG_CUSTOM1, "Forces all players to become ready");
RegAdminCmd("far", ForceAllReady, ADMFLAG_CUSTOM1, "Forces all players to become ready");
RegAdminCmd("forceallunready", ForceAllUnready, ADMFLAG_CUSTOM1, "Forces all players to become unready");
RegAdminCmd("faur", ForceAllUnready, ADMFLAG_CUSTOM1, "Forces all players to become unready");
RegAdminCmd("lo3", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count");
RegAdminCmd("forcestart", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count");
RegAdminCmd("fs", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count");
RegAdminCmd("forceend", ForceEnd, ADMFLAG_CUSTOM1, "Ends the match regardless of status");
RegAdminCmd("fe", ForceEnd, ADMFLAG_CUSTOM1, "Ends the match regardless of status");
RegAdminCmd("readyon", ReadyOn, ADMFLAG_CUSTOM1, "Turns on or restarts the ReadyUp System");
RegAdminCmd("ron", ReadyOn, ADMFLAG_CUSTOM1, "Turns on or restarts the ReadyUp System");
RegAdminCmd("readyoff", ReadyOff, ADMFLAG_CUSTOM1, "Turns off the ReadyUp System if enabled");
RegAdminCmd("roff", ReadyOff, ADMFLAG_CUSTOM1, "Turns off the ReadyUp System if enabled");
RegAdminCmd("wm_debug_create_table", CreateTable, ADMFLAG_ROOT, "Testing purposes only, connects to the WarMod database and creates a match results table (if it does not already exist)");
RegAdminCmd("lw_reconnect", LiveWire_ReConnect, ADMFLAG_ROOT, "Reconnects LiveWire if lw_enabled is 1");
g_h_active = CreateConVar("wm_active", "1", "Enable or disable WarMod as active", FCVAR_NOTIFY);
g_h_lw_enabled = CreateConVar("lw_enabled", "1", "Enable or disable LiveWire", FCVAR_NOTIFY);
g_h_lw_address = CreateConVar("lw_address", "stream.livewire.gametech.com.au", "Sets the ip/host that LiveWire will use to connect", FCVAR_NOTIFY);
g_h_lw_port = CreateConVar("lw_port", "12012", "Sets the port that LiveWire will use to connect", FCVAR_NOTIFY, true, 1.0);
g_h_lw_bindaddress = CreateConVar("lw_bindaddress", "", "Optional setting to specify which ip LiveWire will bind to (for servers with multiple ips) - blank = automatic/primary", FCVAR_NOTIFY);
g_h_lw_group_name = CreateConVar("lw_group_name", "", "Sets the group name that LiveWire will use", FCVAR_PROTECTED|FCVAR_DONTRECORD);
g_h_lw_group_password = CreateConVar("lw_group_password", "", "Sets the group password that LiveWire will use", FCVAR_PROTECTED|FCVAR_DONTRECORD);
g_h_stats_enabled = CreateConVar("wm_stats_enabled", "1", "Enable or disable statistical logging", FCVAR_NOTIFY);
g_h_stats_method = CreateConVar("wm_stats_method", "2", "Sets the stats logging method: 0 = UDP stream/server logs, 1 = WarMod logs, 2 = both", FCVAR_NOTIFY, true, 0.0);
g_h_stats_trace_enabled = CreateConVar("wm_stats_trace", "0", "Enable or disable updating all player positions, every wm_stats_trace_delay seconds", FCVAR_NOTIFY);
g_h_stats_trace_delay = CreateConVar("wm_stats_trace_delay", "5", "The ammount of time between sending player position updates", FCVAR_NOTIFY, true, 0.0);
g_h_rcon_only = CreateConVar("wm_rcon_only", "0", "Enable or disable admin commands to be only executed via RCON or console");
g_h_global_chat = CreateConVar("wm_global_chat", "1", "Enable or disable the global chat command (@ prefix in messagemode)");
g_h_stv_chat = CreateConVar("wm_tv_chat", "1", "Enable or disable the players chat being relayed to Source TV");
g_h_locked = CreateConVar("wm_lock_teams", "1", "Enable or disable locked teams when a match is running", FCVAR_NOTIFY);
g_h_min_ready = CreateConVar("wm_min_ready", "10", "Sets the minimum required ready players to Live on 3", FCVAR_NOTIFY);
g_h_max_players = CreateConVar("wm_max_players", "10", "Sets the maximum players allowed on both teams combined, others will be forced to spectator (0 = unlimited)", FCVAR_NOTIFY, true, 0.0);
g_h_match_config = CreateConVar("wm_match_config", "warmod/ruleset_mr15.cfg", "Sets the match config to load on Live on 3");
g_h_live_config = CreateConVar("wm_live_config", "warmod/on_match_lo3.cfg", "Sets the Live on 3 config");
g_h_knife_config = CreateConVar("wm_knife_config", "warmod/on_match_ko3.cfg", "Sets the Knife on 3 config");
g_h_end_config = CreateConVar("wm_reset_config", "warmod/on_match_end.cfg", "Sets the config to load at the end/reset of a match");
g_h_half_time_config = CreateConVar("wm_half_time_config", "warmod/on_match_half_time.cfg", "Sets the config to load at half time of a match (including overtime)");
g_h_round_money = CreateConVar("wm_round_money", "1", "Enable or disable a client's team mates money to be displayed at the start of a round (to him only)", FCVAR_NOTIFY);
g_h_night_vision = CreateConVar("wm_block_nightvision", "1", "Enable or disable blocking nightvision", FCVAR_NOTIFY);
g_h_bomb_frags = CreateConVar("wm_bomb_frags", "0", "Enable or disable a player getting 3 points for their bomb explosion", FCVAR_NOTIFY);
g_h_defuse_frags = CreateConVar("wm_defuse_frags", "0", "Enable or disable a player getting 3 points for defusing the bomb", FCVAR_NOTIFY);
g_h_ingame_scores = CreateConVar("wm_ingame_scores", "1", "Enable or disable ingame scores to be showed at the end of each round", FCVAR_NOTIFY);
g_h_max_rounds = CreateConVar("wm_max_rounds", "15", "Sets maxrounds before auto team switch", FCVAR_NOTIFY);
g_h_warm_up_grens = CreateConVar("wm_block_warm_up_grenades", "0", "Enable or disable grenade blocking in warmup", FCVAR_NOTIFY);
g_h_knife_hegrenade = CreateConVar("wm_knife_hegrenade", "0", "Enable or disable giving a player a hegrenade on Knife on 3", FCVAR_NOTIFY);
g_h_knife_flashbang = CreateConVar("wm_knife_flashbang", "0", "Sets how many flashbangs to give a player on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 2.0);
g_h_knife_smokegrenade = CreateConVar("wm_knife_smokegrenade", "0", "Enable or disable giving a player a smokegrenade on Knife on 3", FCVAR_NOTIFY);
g_h_req_names = CreateConVar("wm_require_names", "0", "Enable or disable the requirement of set team names for lo3", FCVAR_NOTIFY);
g_h_show_info = CreateConVar("wm_show_info", "1", "Enable or disable the display of the Ready System to players", FCVAR_NOTIFY);
g_h_live_override = CreateConVar("wm_live_override", "1", "Enable or disable the override of the execution of wm_live_config and instead uses it's own (wait command fix)", FCVAR_NOTIFY);
g_h_live_override_knife = CreateConVar("wm_live_override_knife", "1", "Enable or disable the override of the execution of wm_knife_config and instead uses it's own (wait command fix)", FCVAR_NOTIFY);
g_h_auto_ready = CreateConVar("wm_auto_ready", "1", "Enable or disable the ready system being automatically enabled on map change", FCVAR_NOTIFY);
g_h_auto_swap = CreateConVar("wm_auto_swap", "1", "Enable or disable the automatic swapping of teams at half time", FCVAR_NOTIFY);
g_h_auto_swap_delay = CreateConVar("wm_auto_swap_delay", "3", "Time to wait before swapping teams at half time", 0, true, 0.0);
g_h_half_auto_ready = CreateConVar("wm_half_auto_ready", "1", "Enable or disable the ready system being automatically enabled at end of half", FCVAR_NOTIFY);
g_h_auto_knife = CreateConVar("wm_auto_knife", "0", "Enable or disable the knife round before going live", FCVAR_NOTIFY);
g_h_auto_kick_team = CreateConVar("wm_auto_kick_team", "0", "Enable or disable the automatic kicking of the losing team", FCVAR_NOTIFY);
g_h_auto_kick_delay = CreateConVar("wm_auto_kick_delay", "10", "Sets the seconds to wait before kicking the losing team", FCVAR_NOTIFY, true, 0.0);
g_h_score_mode = CreateConVar("wm_score_mode", "1", "Sets score mode: 1 = Best Of, 2 = First To (based on wm_max_rounds)", FCVAR_NOTIFY);
g_h_overtime = CreateConVar("wm_overtime", "1", "Sets overtime mode: 0 = off, 1 = Maxrounds (based on wm_overtime_max_rounds), 2 = Sudden Death", FCVAR_NOTIFY);
g_h_overtime_mr = CreateConVar("wm_overtime_max_rounds", "3", "Sets overtime maxrounds", FCVAR_NOTIFY, true, 0.0);
g_h_overtime_money = CreateConVar("wm_overtime_start_money", "10000", "Sets overtime startmoney", FCVAR_NOTIFY, true, 0.0);
g_h_auto_record = CreateConVar("wm_auto_record", "1", "Enable or disable auto SourceTV demo record on Live on 3", FCVAR_NOTIFY);
g_h_save_file_dir = CreateConVar("wm_save_dir", "warmod", "Directory to store SourceTV demos and WarMod logs");
g_h_prefix_logs = CreateConVar("wm_prefix_logs", "1", "Enable or disable the prefixing of \"_\" to uncompleted match SourceTV demos and WarMod logs", FCVAR_NOTIFY);
g_h_play_out = CreateConVar("wm_play_out", "0", "Enable or disable teams required to play out the match even after a winner has been decided", FCVAR_NOTIFY);
g_h_damage = CreateConVar("wm_damage", "1", "Sets player console damage mode: 0 = removed, 1 = on death, 2 = delayed until end of the round", FCVAR_NOTIFY);
g_h_remove_hint_text = CreateConVar("wm_remove_help_hints", "1", "Enable or disable the removal of the help hints", FCVAR_NOTIFY);
g_h_remove_gren_sound = CreateConVar("wm_remove_grenade_sound", "0", "Enable or disable the \"Fire in the Hole\" sound when throwing grenades", FCVAR_NOTIFY);
g_h_body_remove = CreateConVar("wm_remove_ragdoll", "1", "Enable or disable the removal of ragdolls after wm_remove_ragdoll_delay seconds of time after death", FCVAR_NOTIFY);
g_h_body_delay = CreateConVar("wm_remove_ragdoll_delay", "2", "The ammount of time to wait before removing corpses", FCVAR_NOTIFY, true, 0.0);
g_h_deathcam_remove = CreateConVar("wm_remove_deathcam", "1", "Enable or disable the switching of views after wm_remove_deathcam_delay seconds of time after death", FCVAR_NOTIFY);
g_h_deathcam_delay = CreateConVar("wm_remove_deathcam_delay", "1.4", "The ammount of time to wait before switching a players view after death", FCVAR_NOTIFY, true, 1.4);
g_h_warmup_respawn = CreateConVar("wm_warmup_respawn", "0", "Enable or disable the respawning of players in warmup", FCVAR_NOTIFY);
g_h_status = CreateConVar("wm_status", "0", "WarMod automatically updates this value to the corresponding match status code", FCVAR_NOTIFY);
g_h_upload_results = CreateConVar("wm_upload_results", "0", "Enable or disable the uploading of match results via MySQL", FCVAR_NOTIFY);
g_h_table_name = CreateConVar("wm_table_name", "wm_results", "The MySQL table name to store match results in");
g_h_t = CreateConVar("wm_t", DEFAULT_T_NAME, "Team starting terrorists, designed for score and demo naming purposes", FCVAR_NOTIFY);
g_h_ct = CreateConVar("wm_ct", DEFAULT_CT_NAME, "Team starting counter-terrorists, designed for score and demo naming purposes", FCVAR_NOTIFY);
g_h_t_score = CreateConVar("wm_t_score", "0", "WarMod automatically updates this value to the Terrorist's total score", FCVAR_NOTIFY);
g_h_ct_score = CreateConVar("wm_ct_score", "0", "WarMod automatically updates this value to the Counter-Terrorist's total score", FCVAR_NOTIFY);
g_h_notify_version = CreateConVar("wm_notify_version", WM_VERSION, WM_DESCRIPTION, FCVAR_NOTIFY|FCVAR_REPLICATED);
g_h_mp_startmoney = FindConVar("mp_startmoney");
g_i_account = FindSendPropOffs("CCSPlayer", "m_iAccount");
g_i_ragdolls = FindSendPropOffs("CCSPlayer","m_hRagdoll");
HookConVarChange(g_h_active, OnActiveChange);
HookConVarChange(g_h_req_names, OnReqNameChange);
HookConVarChange(g_h_min_ready, OnMinReadyChange);
HookConVarChange(g_h_stats_trace_enabled, OnStatsTraceChange);
HookConVarChange(g_h_stats_trace_delay, OnStatsTraceDelayChange);
HookConVarChange(g_h_auto_ready, OnAutoReadyChange);
HookConVarChange(g_h_max_rounds, OnMaxRoundChange);
HookConVarChange(g_h_overtime_mr, OnMaxRoundChange);
HookConVarChange(g_h_lw_enabled, OnLiveWireChange);
HookConVarChange(g_h_t, OnTChange);
HookConVarChange(g_h_ct, OnCTChange);
HookUserMessage(GetUserMessageId("HintText"), MessageHandler, true);
HookUserMessage(GetUserMessageId("SendAudio"), MessageHandler, true);
HookUserMessage(GetUserMessageId("TextMsg"), MessageHandler, true);
HookEvent("round_start", Event_Round_Start);
HookEvent("round_end", Event_Round_End);
HookConVarChange(FindConVar("mp_restartgame"), Event_Round_Restart);
HookEvent("round_freeze_end", Event_Round_Freeze_End);
HookEvent("player_blind", Event_Player_Blind);
HookEvent("player_hurt", Event_Player_Hurt);
HookEvent("player_death", Event_Player_Death);
HookEvent("player_changename", Event_Player_Name);
HookEvent("player_disconnect", Event_Player_Disc_Pre, EventHookMode_Pre);
HookEvent("player_team", Event_Player_Team);
HookEvent("player_team", Event_Player_Team_Pre, EventHookMode_Pre);
HookEvent("bomb_pickup", Event_Bomb_PickUp);
HookEvent("bomb_dropped", Event_Bomb_Dropped);
HookEvent("bomb_beginplant", Event_Bomb_Plant_Begin);
HookEvent("bomb_abortplant", Event_Bomb_Plant_Abort);
HookEvent("bomb_planted", Event_Bomb_Planted);
HookEvent("bomb_exploded", Event_Bomb_Exploded);
HookEvent("bomb_begindefuse", Event_Bomb_Defuse_Begin);
HookEvent("bomb_abortdefuse", Event_Bomb_Defuse_Abort);
HookEvent("bomb_defused", Event_Bomb_Defused);
HookEvent("weapon_fire", Event_Weapon_Fire);
HookEvent("flashbang_detonate", Event_Detonate_Flash);
HookEvent("smokegrenade_detonate", Event_Detonate_Smoke);
HookEvent("hegrenade_detonate", Event_Detonate_HeGrenade);
HookEvent("item_pickup", Event_Item_Pickup);
CreateTimer(15.0, HelpText, 0, TIMER_REPEAT);
CreateTimer(15.0, CheckNames, 0, TIMER_REPEAT);
CreateTimer(600.0, LiveWire_Check, 0, TIMER_REPEAT);
CreateTimer(1800.0, LiveWire_Ping, _, TIMER_REPEAT);
}
public OnAllPluginsLoaded()
{
if (LibraryExists("pluginautoupdate"))
{
AutoUpdate_AddPlugin("autoupdate.warmod.gametech.com.au", "/cstrike/update.xml", WM_VERSION);
}
}
public OnPluginEnd()
{
if (LibraryExists("pluginautoupdate"))
{
AutoUpdate_RemovePlugin();
}
}
public Action:LiveWire_ReConnect(client, args)
{
if (GetConVarBool(g_h_lw_enabled))
{
LiveWire_Disconnect();
LiveWire_Connect();
}
else
{
ReplyToCommand(client, "%sLiveWire not enabled!", CHAT_PREFIX);
}
return Plugin_Handled;
}
LiveWire_Connect()
{
if (!g_lw_connecting)
{
g_h_lw_socket = SocketCreate(SOCKET_TCP, OnSocketError);
new String:address[256];
GetConVarString(g_h_lw_address, address, sizeof(address));
new port = GetConVarInt(g_h_lw_port);
// bind socket to ip address - used for servers with multiple ips
new String:bindaddress[32];
GetConVarString(g_h_lw_bindaddress, bindaddress, sizeof(bindaddress));
if (StrEqual(bindaddress, ""))
{
new octets[4];
Steam_GetPublicIP(octets);
Format(bindaddress, sizeof(bindaddress), "%d.%d.%d.%d", octets[0], octets[1], octets[2], octets[3]);
}
// TODO: validate as ip?
PrintToServer("<LiveWire> Binding socket to \"%s\"", bindaddress);
SocketBind(g_h_lw_socket, bindaddress, 0);
PrintToServer("<LiveWire> Connecting to \"%s:%d\"", address, port);
SocketConnect(g_h_lw_socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, address, port);
g_lw_connecting = true;
}
}
LiveWire_Send(const String:format[], any:...)
{
decl String:event[1024];
// format arguments
VFormat(event, sizeof(event), format, 2);
if (GetConVarBool(g_h_lw_enabled) && g_lw_connected)
{
// add a newline to each event
StrCat(event, sizeof(event), "\n");
// send to socket
SocketSend(g_h_lw_socket, event);
}
}
LiveWire_Disconnect()
{
g_lw_connecting = false;
// check if connected
if (g_lw_connected)
{
g_lw_connected = false;
// close socket
CloseHandle(g_h_lw_socket);
}
}
public OnSocketConnected(Handle:socket, any:arg)
{
g_lw_connecting = false;
g_lw_connected = true;
PrintToServer("<LiveWire> Connected");
new String:username[64];
new String:password[512];
GetConVarString(g_h_lw_group_name, username, sizeof(username));
GetConVarString(g_h_lw_group_password, password, sizeof(password));
new hostIP = GetConVarInt(FindConVar("hostip"));
new String:ipAddress[32];
// convert ip address to standard dotted notation
Format(ipAddress, sizeof(ipAddress), "%d.%d.%d.%d", hostIP >>> 24, 0xFF & (hostIP >>> 16), 0xFF & (hostIP >>> 8), 0xFF & hostIP);
EscapeString(username, sizeof(username));
EscapeString(password, sizeof(password));
LogLiveWireEvent("{\"event\": \"server_status\", \"game\": \"css\", \"version\": \"%s\", \"ip\": \"%s\", \"port\": %d, \"username\": \"%s\", \"password\": \"%s\", \"unixTime\": %d}", WM_VERSION, ipAddress, GetConVarInt(FindConVar("hostport")), username, password, GetTime());
LogPlayers(true);
}
public OnSocketReceive(Handle:socket, String:receiveData[], const dataSize, any:arg)
{
/* do nothing */
}
public OnSocketDisconnected(Handle:socket, any:arg)
{
g_lw_connecting = false;
g_lw_connected = false;
CloseHandle(socket);
PrintToServer("<LiveWire> Disconnected");
}
public OnSocketError(Handle:socket, const errorType, const errorNum, any:hFile)
{
g_lw_connecting = false;
g_lw_connected = false;
LogError("GameTech LiveWire - Socket error %d (errno %d)", errorType, errorNum);
CloseHandle(socket);
}
public OnMapStart()
{
// store current map
GetCurrentMap(g_map, sizeof(g_map));
StringToLower(g_map, sizeof(g_map));
// reset plugin version cvar
SetConVarStringHidden(g_h_notify_version, WM_VERSION);
if (LibraryExists("pluginautoupdate") && !GetConVarBool(FindConVar("sv_lan")))
{
// check for warmod updates
ServerCommand("sm_autoupdate_download warmod");
}
if (GetConVarBool(g_h_lw_enabled) && !g_lw_connected)
{
// connect to livewire
LiveWire_Connect();
}
if (GetConVarBool(g_h_stats_trace_enabled))
{
// start trace timer
g_stats_trace_timer = CreateTimer(GetConVarFloat(g_h_stats_trace_delay), Stats_Trace, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
// reset any matches
ResetMatch(true);
// reset timers
ResetSwitchCameraTimers(false);
}
public OnMapEnd()
{
// reset timers
ResetSwitchCameraTimers(false);
}
public OnLibraryRemoved(const String:name[])
{
if (StrEqual(name, "adminmenu"))
{
g_h_menu = INVALID_HANDLE;
}
}
public OnAdminMenuReady(Handle:topmenu)
{
if (topmenu == g_h_menu)
{
return;
}
g_h_menu = topmenu;
new TopMenuObject:new_menu = AddToTopMenu(g_h_menu, "WarModCommands", TopMenuObject_Category, MenuHandler, INVALID_TOPMENUOBJECT);
if (new_menu == INVALID_TOPMENUOBJECT)
{
return;
}
// add menu items
AddToTopMenu(g_h_menu, "forcestart", TopMenuObject_Item, MenuHandler, new_menu, "forcestart", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "readyup", TopMenuObject_Item, MenuHandler, new_menu, "readyup", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "knife", TopMenuObject_Item, MenuHandler, new_menu, "knife", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "cancelhalf", TopMenuObject_Item, MenuHandler, new_menu, "cancelhalf", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "cancelmatch", TopMenuObject_Item, MenuHandler, new_menu, "cancelmatch", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "forceallready", TopMenuObject_Item, MenuHandler, new_menu, "forceallready", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "forceallunready", TopMenuObject_Item, MenuHandler, new_menu, "forceallunready", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "toggleactive", TopMenuObject_Item, MenuHandler, new_menu, "toggleactive", ADMFLAG_CUSTOM1);
}
public OnClientConnected(client)
{
if (!GetConVarBool(g_h_lw_enabled)) {
return;
}
new count = 0;
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientConnected(i))
{
count++;
}
}
if (count == 1)
{
// reconnect livewire on first player join, server seems to go to sleep
// when there are no players in the server (e.g. server start)
LiveWire_ReConnect(0, 0);
}
}
public OnClientPostAdminCheck(client)
{
if (client == 0)
{
return;
}
new String:ip_address[32];
GetClientIP(client, ip_address, sizeof(ip_address));
if (!IsFakeClient(client))
{
// check player for gametech premium status
new String:player_name[64];
GetClientName(client, player_name, sizeof(player_name));
new String:auth_id[32];
GetClientAuthString(client, auth_id, sizeof(auth_id));
new HTTPRequestHandle:request = Steam_CreateHTTPRequest(HTTPMethod_POST, QUERY_URL);
Steam_SetHTTPRequestGetOrPostParameter(request, "command", "player_status");
Steam_SetHTTPRequestGetOrPostParameter(request, "name", player_name);
Steam_SetHTTPRequestGetOrPostParameter(request, "uniqueId", auth_id);
Steam_SetHTTPRequestGetOrPostParameter(request, "ipAddress", ip_address);
Steam_SendHTTPRequest(request, OnPremiumCheckComplete, GetClientUserId(client));
}
if (!IsActive(0, true))
{
// warmod is disabled
return;
}
if (GetConVarBool(g_h_stats_enabled) && client != 0)
{
new String:log_string[384];
CS_GetLogString(client, log_string, sizeof(log_string));
new String:country[2];
GeoipCode2(ip_address, country);
EscapeString(ip_address, sizeof(ip_address));
LogEvent("{\"event\": \"player_connect\", \"player\": %s, \"address\": \"%s\", \"country\": \"%s\"}", log_string, ip_address, country);
}
}
public OnPremiumCheckComplete(HTTPRequestHandle:request, bool:requestSuccessful, HTTPStatusCode:statusCode, any:userId)
{
new client = GetClientOfUserId(userId);
if (client == 0 || !requestSuccessful || statusCode != HTTPStatusCode_OK)
{
Steam_ReleaseHTTPRequest(request);
return;
}
new size = Steam_GetHTTPResponseBodySize(request);
new String:data[size];
Steam_GetHTTPResponseBodyData(request, data, size);
new numParams = 2;
new String:params[numParams][MAX_PARAM_SIZE];
ExplodeString(data, ";", params, numParams, MAX_PARAM_SIZE);
new bool:premium = !!StringToInt(params[0]);
g_premium_list[client] = premium;
strcopy(g_premium_prefix[client], MAX_PARAM_SIZE, params[1]);
if (premium)
{
WM_PrintToChat(client, "GameTech Premium Features Loaded");
}
Steam_ReleaseHTTPRequest(request);
}
public OnClientPutInServer(client)
{
// reset client state
user_damage[client][0] = '\0';
g_player_list[client] = PLAYER_DISC;
g_cancel_list[client] = false;
}
public OnClientDisconnect(client)
{
// reset client state
g_player_list[client] = PLAYER_DISC;
g_premium_list[client] = false;
g_premium_prefix[client] = "";
g_cancel_list[client] = false;
user_damage[client][0] = '\0';
// log player stats
LogPlayerStats(client);
if (!IsActive(client, true))
{
// warmod is disabled
return;
}
if (g_ready_enabled && !g_live)
{
// display ready system
ShowInfo(client, true, false, 0);
}
}
public Action:OnClientCommand(client, args)
{
if (!IsActive(client, true))
{
// warmod is disabled
return Plugin_Continue;
}
if (g_h_force_camera == INVALID_HANDLE)
{
// get camera mode
g_h_force_camera = FindConVar("mp_forcecamera");
}
if (client > 0 && !IsFakeClient(client) && IsClientObserver(client) && GetClientTeam(client) > 1 && g_h_force_camera != INVALID_HANDLE && GetConVarInt(g_h_force_camera) == 1)
{
// client is spectating, control who they watch!
new String:arg[256];
GetCmdArg(0, arg, sizeof(arg));
if (StrEqual(arg, "spec_prev"))
{
if (GetNumAlive(GetClientTeam(client)) > 1)
{
SpecPrev(client);
}
return Plugin_Handled;
}
else if (StrEqual(arg, "spec_next"))
{
if (GetNumAlive(GetClientTeam(client)) > 1)
{
SpecNext(client);
}
return Plugin_Handled;
}
}
return Plugin_Continue;
}
ResetMatch(bool:silent)
{
if (g_match)
{
Call_StartForward(g_f_on_reset_match);
Call_Finish();
if (GetConVarBool(g_h_stats_enabled))
{
new String:event_name[] = "match_reset";
LogSimpleEvent(event_name, sizeof(event_name));
}
// end of log
new String:event_name[] = "log_end";
LogSimpleEvent(event_name, sizeof(event_name));
// execute relevant server config
new String:end_config[128];
GetConVarString(g_h_end_config, end_config, sizeof(end_config));
ServerCommand("exec %s", end_config);
}
if (g_log_file != INVALID_HANDLE)
{
// close log file
FlushFile(g_log_file);
CloseHandle(g_log_file);
g_log_file = INVALID_HANDLE;
}
// reset state
g_match = false;
g_live = false;
g_first_half = true;
g_t_money = false;
g_t_score = false;
g_t_knife = false;
g_t_had_knife = false;
g_playing_out = false;
SetAllCancelled(false);
ReadyChangeAll(0, false, true);
ResetMatchScores();
ResetTeams();
g_overtime = false;
g_overtime_count = 0;
UpdateStatus();
// stop tv recording after 10 seconds
CreateTimer(10.0, StopRecord);
if (GetConVarBool(g_h_auto_ready))
{
// enable ready system
ReadySystem(true);
ShowInfo(0, true, false, 0);
// update status code
UpdateStatus();
}
else if (g_ready_enabled)
{
// disable ready system
ReadySystem(false);
ShowInfo(0, false, false, 1);
}
if (!silent)
{
// message display to players
for (new x = 1; x <= 3; x++)
{
PrintToChatAll("%s%t", CHAT_PREFIX, "Match Reset");
}
// restart round
ServerCommand("mp_restartgame 1");
}
}
ResetHalf(bool:silent)
{
if (g_match)
{
Call_StartForward(g_f_on_reset_half);
Call_Finish();
if (GetConVarBool(g_h_stats_enabled))
{
new String:event_name[] = "match_half_reset";
LogSimpleEvent(event_name, sizeof(event_name));
}
}
// reset half state
g_live = false;
g_t_money = false;
g_t_score = false;
g_t_knife = false;
g_playing_out = false;
SetAllCancelled(false);
ReadyChangeAll(0, false, true);
ResetHalfScores();
UpdateStatus();
if (GetConVarBool(g_h_auto_ready))
{
// display ready system
ReadySystem(true);
ShowInfo(0, true, false, 0);
UpdateStatus();
}
else
{
// disable ready system
ReadySystem(false);
ShowInfo(0, false, false, 1);
}
if (!silent)
{
// display message for players
for (new x = 1; x <= 3; x++)
{
PrintToChatAll("%s%t", CHAT_PREFIX, "Half Reset");
}
// restart round
ServerCommand("mp_restartgame 1");
}
}
ResetTeams()
{
// set team names to default
g_t_name = DEFAULT_T_NAME;
g_t_name_escaped = g_t_name;
EscapeString(g_t_name_escaped, sizeof(g_t_name_escaped));
g_ct_name = DEFAULT_CT_NAME;
g_ct_name_escaped = g_ct_name;
EscapeString(g_ct_name_escaped, sizeof(g_ct_name_escaped));
SetConVarStringHidden(g_h_t, DEFAULT_T_NAME);
SetConVarStringHidden(g_h_ct, DEFAULT_CT_NAME);
}
ResetMatchScores()
{
// reset match scores
g_scores[SCORE_T][SCORE_FIRST_HALF] = 0;
g_scores[SCORE_T][SCORE_SECOND_HALF] = 0;
g_scores[SCORE_CT][SCORE_FIRST_HALF] = 0;
g_scores[SCORE_CT][SCORE_SECOND_HALF] = 0;
// reset overtime scores
for (new i = 0; i <= g_overtime_count; i++)
{
g_scores_overtime[SCORE_T][i][SCORE_FIRST_HALF] = 0;
g_scores_overtime[SCORE_T][i][SCORE_SECOND_HALF] = 0;
g_scores_overtime[SCORE_CT][i][SCORE_FIRST_HALF] = 0;
g_scores_overtime[SCORE_CT][i][SCORE_SECOND_HALF] = 0;
}
}
ResetHalfScores()
{
// reset scores for the current half
if (!g_overtime)
{
// not overtime
if (g_first_half)
{
// first half
g_scores[SCORE_T][SCORE_FIRST_HALF] = 0;
g_scores[SCORE_CT][SCORE_FIRST_HALF] = 0;
}
else
{
// second half
g_scores[SCORE_T][SCORE_SECOND_HALF] = 0;
g_scores[SCORE_CT][SCORE_SECOND_HALF] = 0;
}
}
else
{
// overtime
if (g_first_half)
{
// first half overtime
g_scores_overtime[SCORE_T][g_overtime_count][SCORE_FIRST_HALF] = 0;
g_scores_overtime[SCORE_CT][g_overtime_count][SCORE_FIRST_HALF] = 0;
}
else
{
// second half overtime
g_scores_overtime[SCORE_T][g_overtime_count][SCORE_SECOND_HALF] = 0;
g_scores_overtime[SCORE_CT][g_overtime_count][SCORE_SECOND_HALF] = 0;
}
}
}
public Action:ReadyToggle(client, args)
{
if (!IsActive(client, false))
{
// warmod is disabled
return Plugin_Handled;
}
if (!IsAdminCmd(client, false))
{
// not allowed, rcon only
return Plugin_Handled;
}
if (IsLive(client, false))
{
// match is live
return Plugin_Handled;
}
// change ready state
ReadyChangeAll(client, false, true);
SetAllCancelled(false);
if (!IsReadyEnabled(client, true))
{
// display ready system
ReadySystem(true);
ShowInfo(client, true, false, 0);
if (client != 0)
{
PrintToConsole(client, "<WarMod> %t", "Ready System Enabled");
}
else
{
PrintToServer("<WarMod> %T", "Ready System Enabled", LANG_SERVER);
}
// check if anyone is ready
CheckReady();
}
else
{
// disable ready system
ShowInfo(client, false, false, 1);
ReadySystem(false);
if (client != 0)
{