/
Effects.sp
2337 lines (1935 loc) · 69.6 KB
/
Effects.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
Handle g_RapidFire_Timer = INVALID_HANDLE;
bool g_bRapidFire = false;
float g_RapidFire_Rate = 0.7;
Action Chaos_RapidFire(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
cvar("weapon_accuracy_nospread", "0");
cvar("weapon_recoil_scale", "2");
g_bRapidFire = false;
StopTimer(g_RapidFire_Timer);
if(EndChaos) AnnounceChaos("Rapid Fire", -1.0, true);
}
if(NotDecidingChaos("Chaos_RapidFire")) return;
if(CurrentlyActive(g_RapidFire_Timer)) return; //will retry event in that function
g_bRapidFire = true;
cvar("weapon_accuracy_nospread", "1");
cvar("weapon_recoil_scale", "0");
float duration = GetChaosTime("Chaos_RapidFire", 25.0);
if(duration > 0) g_RapidFire_Timer = CreateTimer(duration, Chaos_RapidFire, true);
AnnounceChaos("Rapid Fire", duration);
}
Handle FakeTeleport_Timer = INVALID_HANDLE;
float FakeTelport_loc[MAXPLAYERS+1][3];
void Chaos_FakeTeleport(){
if(ClearChaos()){
StopTimer(FakeTeleport_Timer);
}
if(NotDecidingChaos("Chaos_FakeTeleport")) return;
if(CurrentlyActive(FakeTeleport_Timer)) return;
float duration = 3.0;
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
float vec[3];
GetClientAbsOrigin(i, vec);
FakeTelport_loc[i] = vec;
}
}
DoRandomTeleport();
FakeTeleport_Timer = CreateTimer(duration, Timer_ResetFakeTeleport);
}
public Action Timer_ResetFakeTeleport(Handle timer){
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
float vec[3];
vec = FakeTelport_loc[i];
TeleportEntity(i, vec, NULL_VECTOR, NULL_VECTOR);
}
}
AnnounceChaos("Fake Teleport", -1.0);
FakeTeleport_Timer = INVALID_HANDLE;
}
void Chaos_Soccerballs(){
if(ClearChaos()){
}
if(NotDecidingChaos("Chaos_Soccerballs")) return;
cvar("sv_turbophysics", "100");
char MapName[128];
GetCurrentMap(MapName, sizeof(MapName));
for(int i = 0; i < GetArraySize(g_MapCoordinates); i++){
if(GetRandomInt(0,100) <= 25){
float vec[3];
GetArrayArray(g_MapCoordinates, i, vec);
if(DistanceToClosestPlayer(vec) > 50){
int ent = CreateEntityByName("prop_physics_multiplayer");
SetEntityModel(ent, "models/props/de_dust/hr_dust/dust_soccerball/dust_soccer_ball001.mdl");
DispatchKeyValue(ent, "StartDisabled", "false");
DispatchKeyValue(ent, "Solid", "6");
DispatchKeyValue(ent, "spawnflags", "1026");
TeleportEntity(ent, vec, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(ent);
AcceptEntityInput(ent, "TurnOn", ent, ent, 0);
AcceptEntityInput(ent, "EnableCollision");
SetEntProp(ent, Prop_Data, "m_CollisionGroup", 5);
SetEntityMoveType(ent, MOVETYPE_VPHYSICS);
}
}
}
AnnounceChaos("Soccer balls", -1.0);
}
Handle g_NoCrossHair_Timer = INVALID_HANDLE;
Action Chaos_NoCrosshair(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
StopTimer(g_NoCrossHair_Timer);
for(int i = 0; i <= MaxClients; i++){
if(IsValidClient(i)){
SetEntProp(i, Prop_Send, "m_iHideHUD", 0);
}
}
if(EndChaos) AnnounceChaos("No Crosshair", -1.0, true);
}
if(NotDecidingChaos("Chaos_NoCrosshair")) return;
if(CurrentlyActive(g_NoCrossHair_Timer)) return;
for(int i = 0; i <= MaxClients; i++){
if(IsValidClient(i)){
SetEntProp(i, Prop_Send, "m_iHideHUD", HIDEHUD_CROSSHAIR);
}
}
float duration = GetChaosTime("Chaos_NoCrosshair", 25.0);
if(duration > 0) g_NoCrossHair_Timer = CreateTimer(duration, Chaos_NoCrosshair, true);
AnnounceChaos("No Crosshair", duration);
}
bool g_bLag = true;
void Chaos_FakeCrash(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_FakeCrash")) return;
AnnounceChaos("Fake Crash", -1.0);
g_bLag = true;
CreateTimer(1.0, Timer_nolag);
while(g_bLag){
if(!g_bLag) break;
}
}
public Action Timer_nolag(Handle timer){
g_bLag = false;
}
Handle g_DisableRadar_Timer = INVALID_HANDLE;
Action Chaos_DisableRadar(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
cvar("sv_disable_radar", "0");
StopTimer(g_DisableRadar_Timer);
}
if(NotDecidingChaos("Chaos_DisableRadar.NoRadar")) return;
if(CurrentlyActive(g_DisableRadar_Timer)) return;
cvar("sv_disable_radar", "1");
float duration = GetChaosTime("Chaos_DisableRadar", 20.0);
if(duration > 0) g_DisableRadar_Timer = CreateTimer(duration, Chaos_DisableRadar, true);
AnnounceChaos("No Radar", duration);
}
void Chaos_SpawnFlashbangs(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_SpawnFlashbangs")) return;
for(int i = 0; i < GetArraySize(g_MapCoordinates); i++){
if(GetRandomInt(0,100) <= 25){
float vec[3];
GetArrayArray(g_MapCoordinates, i, vec, sizeof(vec));
if(DistanceToClosestPlayer(vec) > 25){
int flash = CreateEntityByName("flashbang_projectile");
TeleportEntity(flash, vec, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(flash);
}
}
}
AnnounceChaos("Spawn Flashbangs", -1.0);
}
Handle g_SuperJump_Timer = INVALID_HANDLE;
Action Chaos_SuperJump(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
cvar("sv_jump_impulse", "301");
StopTimer(g_SuperJump_Timer);
}
if(NotDecidingChaos("Chaos_SuperJump")) return;
if(CurrentlyActive(g_SuperJump_Timer)) return;
cvar("sv_jump_impulse", "590");
float duration = GetChaosTime("Chaos_SuperJump", 20.0);
if(duration > 0.0) g_SuperJump_Timer = CreateTimer(duration, Chaos_SuperJump, true);
AnnounceChaos("Super Jump", duration);
}
Handle g_Juggernaut_Timer = INVALID_HANDLE;
char g_OriginalModels_Jugg[MAXPLAYERS + 1][PLATFORM_MAX_PATH+1];
//https://forums.alliedmods.net/showthread.php?t=307674 thanks for prop_send
bool g_bSetJuggernaut = false;
Action Chaos_Juggernaut(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
StopTimer(g_Juggernaut_Timer);
if(g_bSetJuggernaut){
g_bSetJuggernaut = false;
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
SetEntProp(i, Prop_Send, "m_bHasHelmet", false);
SetEntProp(i, Prop_Send, "m_bHasHeavyArmor", false);
SetEntProp(i, Prop_Send, "m_bWearingSuit", false);
if(GetEntProp(i, Prop_Send, "m_ArmorValue") > 100){
SetEntProp(i, Prop_Data, "m_ArmorValue", 100);
}
if(g_OriginalModels_Jugg[i][0]){
SetEntityModel(i, g_OriginalModels_Jugg[i]);
g_OriginalModels_Jugg[i] = "";
}
}
}
}
cvar("mp_weapons_allow_heavyassaultsuit", "0");
}
if(NotDecidingChaos("Chaos_Juggernaut")) return;
if(CurrentlyActive(g_Juggernaut_Timer)) return;
cvar("mp_weapons_allow_heavyassaultsuit", "1");
g_bSetJuggernaut = true;
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
GetClientModel(i, g_OriginalModels_Jugg[i], sizeof(g_OriginalModels_Jugg[]));
GivePlayerItem(i, "item_heavyassaultsuit");
}
}
float duration = GetChaosTime("Chaos_Juggernaut", 30.0);
if(duration > 0) g_Juggernaut_Timer = CreateTimer(duration, Chaos_Juggernaut, true);
AnnounceChaos("Juggernauts", duration);
}
void Chaos_SpawnExplodingBarrels(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_SpawnExplodingBarrels")) return;
for(int i = 0; i < GetArraySize(g_MapCoordinates); i++){
if(GetRandomInt(0,100) <= 25){
float vec[3];
GetArrayArray(g_MapCoordinates, i, vec, sizeof(vec));
if(DistanceToClosestPlayer(vec) > 50){
int barrel = CreateEntityByName("prop_exploding_barrel");
TeleportEntity(barrel, vec, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(barrel);
}
}
}
AnnounceChaos("Exploding Barrels", -1.0);
}
Handle g_InsaneStrafe_Timer = INVALID_HANDLE;
Action Chaos_InsaneAirSpeed(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
cvar("sv_air_max_wishspeed", "30");
cvar("sv_airaccelerate", "12");
if(g_MaxAirAcc > 0) g_MaxAirAcc--;
StopTimer(g_InsaneStrafe_Timer);
}
if(NotDecidingChaos("Chaos_InsaneAirSpeed.WishSpeed")) return;
if(CurrentlyActive(g_InsaneStrafe_Timer)) return;
cvar("sv_air_max_wishspeed", "2000");
cvar("sv_airaccelerate", "2000");
g_MaxAirAcc++;
float duration = GetChaosTime("Chaos_InsaneAirSpeed", 20.0);
if(duration > 0) g_InsaneStrafe_Timer = CreateTimer(duration, Chaos_InsaneAirSpeed, true);
AnnounceChaos("Extreme Strafe Acceleration", duration);
}
void Chaos_RespawnDead_LastLocation(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_RespawnDead_LastLocation")) return;
for(int i = 0; i <= MaxClients; i++){
if(IsValidClient(i) && !IsPlayerAlive(i)){
CS_RespawnPlayer(i);
if(g_PlayerDeathLocations[i][0] != 0.0 && g_PlayerDeathLocations[i][1] != 0.0 && g_PlayerDeathLocations[i][2] != 0.0){ //safety net for any players that joined mid round
TeleportEntity(i, g_PlayerDeathLocations[i], NULL_VECTOR, NULL_VECTOR);
}
}
}
AnnounceChaos("Resurrect players where they died", -1.0);
}
Handle g_Drugs_Timer = INVALID_HANDLE;
Action Chaos_Drugs(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
KillAllDrugs();
StopTimer(g_Drugs_Timer);
}
if(NotDecidingChaos("Chaos_Drugs")) return;
if(CurrentlyActive(g_Drugs_Timer)) return;
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) CreateDrug(i);
float duration = GetChaosTime("Chaos_Drugs", 10.0);
if(duration > 0) g_Drugs_Timer = CreateTimer(duration, Chaos_Drugs, true);
AnnounceChaos("Drugs", duration);
}
Handle g_EnemyRadar_Timer = INVALID_HANDLE;
Action Chaos_EnemyRadar(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
cvar("mp_radar_showall", "0");
StopTimer(g_EnemyRadar_Timer);
}
if(NotDecidingChaos("Chaos_EnemyRadar")) return;
if(CurrentlyActive(g_EnemyRadar_Timer)) return;
cvar("mp_radar_showall", "1");
float duration = GetChaosTime("Chaos_EnemyRadar", 25.0);
if(duration > 0) g_EnemyRadar_Timer = CreateTimer(duration, Chaos_EnemyRadar, true);
AnnounceChaos("Enemy Radar", duration);
}
void Chaos_Give100HP(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_Give100HP")) return;
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
int currenthealth = GetClientHealth(i);
SetEntityHealth(i, currenthealth + 100);
}
}
AnnounceChaos("Give all players +100 HP", -1.0);
}
void Chaos_HealAllPlayers(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_HealAllPlayers")) return;
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
SetEntityHealth(i, 100);
}
}
AnnounceChaos("Set all players health to 100", -1.0);
}
Handle g_BuyAnywhere_Timer = INVALID_HANDLE;
Action Chaos_BuyAnywhere(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
cvar("mp_buy_anywhere", "0");
cvar("mp_buytime", "20");
StopTimer(g_BuyAnywhere_Timer);
}
if(NotDecidingChaos("Chaos_BuyAnywhere")) return;
if(CurrentlyActive(g_BuyAnywhere_Timer)) return;
cvar("mp_buy_anywhere", "1");
cvar("mp_buytime", "999");
float duration = GetChaosTime("Chaos_BuyAnywhere", 20.0);
if(duration > 0.0) g_BuyAnywhere_Timer = CreateTimer(duration, Chaos_BuyAnywhere, true);
AnnounceChaos("Buy Anywhere Enabled", duration);
}
// float g_SimonSays_Duration = 10.0;
void Chaos_SimonSays(){
if(ClearChaos()){
g_bSimon_Active = false;
KillMessageTimer();
}
if(NotDecidingChaos("Chaos_SimonSays")) return;
if(CurrentlyActive(g_SimonSays_Timer)) return;
float duration = GetChaosTime("Chaos_SimonSays", 10.0);
GenerateSimonOrder(duration);
StartMessageTimer();
g_bSimon_Active = true;
}
Handle g_ExplosiveBullets_Timer = INVALID_HANDLE;
Action Chaos_ExplosiveBullets(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
StopTimer(g_ExplosiveBullets_Timer);
g_bExplosiveBullets = false;
}
if(NotDecidingChaos("Chaos_ExplosiveBullets")) return;
if(CurrentlyActive(g_ExplosiveBullets_Timer)) return;
g_bExplosiveBullets = true;
float duration = GetChaosTime("Chaos_ExplosiveBullets", 15.0);
if(duration > 0) g_ExplosiveBullets_Timer = CreateTimer(duration, Chaos_ExplosiveBullets, true);
AnnounceChaos("Explosive Bullets", duration);
}
bool g_bSpeedShooter = false;
Handle g_bSpeedShooter_Timer = INVALID_HANDLE;
//todo, if someone has speed once this ends, they still have speed
// > try saving their old speed but itll still be fucky
Action Chaos_SpeedShooter(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
StopTimer(g_bSpeedShooter_Timer);
g_bSpeedShooter = false;
if(EndChaos){
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
SetEntPropFloat(i, Prop_Send, "m_flLaggedMovementValue", 1.0);
}
}
AnnounceChaos("Speed Shooter", -1.0, true);
}
}
if(NotDecidingChaos("Chaos_SpeedShooter")) return;
if(CurrentlyActive(g_bSpeedShooter_Timer)) return;
g_bSpeedShooter = true;
float duration = GetChaosTime("Chaos_SpeedShooter", 10.0);
if(duration > 0) g_bSpeedShooter_Timer = CreateTimer(duration, Chaos_SpeedShooter, true);
AnnounceChaos("Speed Shooter", duration);
}
float zero_vector[3] = {0.0, 0.0, 0.0};
void Chaos_ResetSpawns(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_ResetSpawns")) return;
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
if(g_OriginalSpawnVec[i][0] != 0.0 && g_OriginalSpawnVec[i][1] != 0.0 && g_OriginalSpawnVec[i][2] != 0.0){
TeleportEntity(i, g_OriginalSpawnVec[i], NULL_VECTOR, zero_vector);
}
}
}
AnnounceChaos("Teleport all players back to spawn", -1.0);
}
bool g_bNoStrafe = false;
Handle g_NoStrafe_Timer = INVALID_HANDLE;
Action Chaos_DisableStrafe(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
g_bNoStrafe = false;
//todo should NOT handle it this way, figure out some override and refactor
cvar("sv_accelerate", "5.5");
cvar("sv_airaccelrate", "12");
StopTimer(g_NoStrafe_Timer);
if(EndChaos) AnnounceChaos("Normal Left/Right Movement", -1.0, true);
}
if(NotDecidingChaos("Chaos_DisableStrafe.NoLeftRight")) return;
if(CurrentlyActive(g_NoStrafe_Timer)) return;
g_bNoStrafe = true;
float duration = GetChaosTime("Chaos_DisableStrafe", 20.0);
if(duration > 0.0) g_NoStrafe_Timer = CreateTimer(duration, Chaos_DisableStrafe, true);
AnnounceChaos("Disable S / D Keys", duration);
}
bool g_bNoForwardBack = false;
Handle g_NoForwardBack_Timer = INVALID_HANDLE;
Action Chaos_DisableForwardBack(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
g_bNoForwardBack = false;
cvar("sv_accelerate", "5.5");
cvar("sv_airaccelrate", "12");
StopTimer(g_NoForwardBack_Timer);
if(EndChaos) AnnounceChaos("Normal Forward/Backward Movement", -1.0, true);
}
if(NotDecidingChaos("Chaos_DisableForwardBack")) return;
if(CurrentlyActive(g_NoForwardBack_Timer)) return;
g_bNoForwardBack = true;
float duration = GetChaosTime("Chaos_DisableForwardBack", 20.0);
if(duration > 0) g_NoForwardBack_Timer = CreateTimer(duration, Chaos_DisableForwardBack, true);
AnnounceChaos("Disable W / S Keys", duration);
}
bool g_bJumping = false;
Handle g_Jumping_Timer_Repeat = INVALID_HANDLE;
Handle g_Jumping_Timer = INVALID_HANDLE;
Action Chaos_Jumping(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
g_bJumping = false;
StopTimer(g_Jumping_Timer_Repeat);
StopTimer(g_Jumping_Timer);
}
if(NotDecidingChaos("Chaos_Jumping")) return;
if(CurrentlyActive(g_Jumping_Timer)) return;
StopTimer(g_Jumping_Timer_Repeat);
g_bJumping = true;
float duration = GetChaosTime("Chaos_Jumping", 15.0);
if(duration > 0) g_Jumping_Timer = CreateTimer(duration, Chaos_Jumping, true);
g_Jumping_Timer_Repeat = CreateTimer(0.3, Timer_ForceJump, _, TIMER_REPEAT);
AnnounceChaos("Jumping!", duration);
}
public Action Timer_ForceJump(Handle timer){
if(g_bJumping){
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
float vec[3];
GetEntPropVector(i, Prop_Data, "m_vecVelocity", vec);
if(vec[2] == 0.0) { //ensure player isnt mid jump or falling down
vec[0] = 0.0;
vec[1] = 0.0;
vec[2] = 300.0;
SetEntPropVector(i, Prop_Data, "m_vecBaseVelocity", vec);
}
}
}
}else{
StopTimer(g_Jumping_Timer_Repeat);
}
}
bool g_bDiscoFog = false;
Handle g_DiscoFog_Timer_Repeat = INVALID_HANDLE;
Handle g_DiscoFog_Timer = INVALID_HANDLE;
Action Chaos_DiscoFog(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
StopTimer(g_DiscoFog_Timer_Repeat);
StopTimer(g_DiscoFog_Timer);
g_bDiscoFog = false;
Fog_OFF();
}
if(NotDecidingChaos("Chaos_DiscoFog")) return;
if(CurrentlyActive(g_DiscoFog_Timer)) return;
DiscoFog();
g_bDiscoFog = true;
g_DiscoFog_Timer_Repeat = CreateTimer(1.0, Timer_NewFogColor, _,TIMER_REPEAT);
float duration = GetChaosTime("Chaos_DiscoFog", 25.0);
if(duration > 0) g_DiscoFog_Timer = CreateTimer(duration, Chaos_DiscoFog, true);
AnnounceChaos("Disco Fog", duration);
}
public Action Timer_NewFogColor(Handle timer){
if(g_bDiscoFog){
char color[32];
FormatEx(color, sizeof(color), "%i %i %i", GetRandomInt(0,255), GetRandomInt(0,255), GetRandomInt(0,255));
DispatchKeyValue(g_iFog, "fogcolor", color);
}else{
StopTimer(g_DiscoFog_Timer_Repeat);
}
}
Handle g_OneBuilletOneGun_Timer = INVALID_HANDLE;
bool g_bOneBulletOneGun = false;
Action Chaos_OneBulletOneGun(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
g_bOneBulletOneGun = false;
StopTimer(g_OneBuilletOneGun_Timer);
if(EndChaos) AnnounceChaos("One Bullet One Gun", -1.0, true);
}
if(NotDecidingChaos("Chaos_OneBulletOneGun")) return;
if(CurrentlyActive(g_OneBuilletOneGun_Timer)) return;
g_bOneBulletOneGun = true; //handled somehwere in events.sp
float duration = GetChaosTime("Chaos_OneBulletOneGun", 15.0);
if(duration > 0) g_OneBuilletOneGun_Timer = CreateTimer(duration, Chaos_OneBulletOneGun, true);
AnnounceChaos("One Bullet One Gun", duration);
}
float g_Earthquake_Duration = 7.0;
void Chaos_Earthquake(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_Earthquake")) return;
g_Earthquake_Duration = GetChaosTime("Chaos_Earthquake", 5.0);
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
ScreenShake(i, _, g_Earthquake_Duration);
}
}
AnnounceChaos("Earthquake", -1.0);
}
Handle g_ChickenPlayers_Timer = INVALID_HANDLE;
Action Chaos_ChickenPlayers(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
StopTimer(g_ChickenPlayers_Timer);
if(EndChaos){
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) DisableChicken(i);
}
}
if(NotDecidingChaos("Chaos_ChickenPlayers")) return;
if(CurrentlyActive(g_ChickenPlayers_Timer)) return;
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) SetChicken(i);
float duration = GetChaosTime("Chaos_ChickenPlayers", 20.0);
if(duration > 0) g_ChickenPlayers_Timer = CreateTimer(duration, Chaos_ChickenPlayers, true);
AnnounceChaos("Make all players a chicken", duration);
}
void Chaos_IgnitePlayer(bool forceAllPlayers = false){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_IgnitePlayer")) return;
int randomchance = GetRandomInt(1,100);
if(randomchance <= 25 || forceAllPlayers){
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
IgniteEntity(i, 10.0);
}
}
AnnounceChaos("Ignite All Players", -1.0);
}else{
int player = getRandomAlivePlayer();
if(player != -1 && ValidAndAlive(player)){
IgniteEntity(player, 10.0);
char msg[128];
FormatEx(msg, sizeof(msg), "Ignite {orange}%N", player);
AnnounceChaos(msg, -1.0);
}else{
Chaos_IgnitePlayer(true);
}
}
}
Handle g_LockPlayersAim_Timer = INVALID_HANDLE; //keeps track of when to end the event
bool g_bLockPlayersAim_Active = false;
float g_LockPlayersAim_Angles[MAXPLAYERS+1][3];
Action Chaos_LockPlayersAim(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
g_bLockPlayersAim_Active = false;
StopTimer(g_LockPlayersAim_Timer);
if(EndChaos) AnnounceChaos("Lock Mouse Movement", -1.0, true);
}
if(NotDecidingChaos("Chaos_LockPlayersAim.LockMouseMovement")) return;
if(CurrentlyActive(g_LockPlayersAim_Timer)) return;
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) GetClientEyeAngles(i, g_LockPlayersAim_Angles[i]);
g_bLockPlayersAim_Active = true;
float duration = GetChaosTime("Chaos_LockPlayersAim", 20.0);
if(duration > 0) g_LockPlayersAim_Timer = CreateTimer(duration, Chaos_LockPlayersAim, true);
AnnounceChaos("Lock Mouse Movement", duration);
}
Handle g_SlowSpeed_Timer = INVALID_HANDLE;
Action Chaos_SlowSpeed(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
if(EndChaos) {
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) SetEntPropFloat(i, Prop_Send, "m_flLaggedMovementValue", 1.0);
AnnounceChaos("Normal Movement Speed", -1.0, true);
}
StopTimer(g_SlowSpeed_Timer);
}
if(NotDecidingChaos("Chaos_SlowSpeed")) return;
if(CurrentlyActive(g_SlowSpeed_Timer)) return;
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) SetEntPropFloat(i, Prop_Send, "m_flLaggedMovementValue", 0.5);
float duration = GetChaosTime("Chaos_SlowSpeed", 20.0);
if(duration > 0) g_SlowSpeed_Timer = CreateTimer(duration, Chaos_SlowSpeed, true);
AnnounceChaos("0.5x Movement Speed", duration);
}
Handle g_FastSpeed_Timer = INVALID_HANDLE;
Action Chaos_FastSpeed(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
if(EndChaos){
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) SetEntPropFloat(i, Prop_Send, "m_flLaggedMovementValue", 1.0);
AnnounceChaos("Normal Movement Speed", -1.0, true);
}
StopTimer(g_FastSpeed_Timer);
}
if(NotDecidingChaos("Chaos_FastSpeed")) return;
if(CurrentlyActive(g_FastSpeed_Timer)) return;
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) SetEntPropFloat(i, Prop_Send, "m_flLaggedMovementValue", 3.0);
float duration = GetChaosTime("Chaos_FastSpeed", 20.0);
if(duration > 0) g_FastSpeed_Timer = CreateTimer(duration, Chaos_FastSpeed, true);
AnnounceChaos("3x Movement Speed", duration);
}
void Chaos_RespawnTheDead(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_RespawnTheDead")) return;
for(int i = 0; i <= MaxClients; i++){
if(IsValidClient(i) && !IsPlayerAlive(i)) CS_RespawnPlayer(i);
}
AnnounceChaos("Resurrect dead players", -1.0);
}
void Chaos_RespawnTheDead_Randomly(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_RespawnTheDead_Randomly")) return;
for(int i = 0; i <= MaxClients; i++){
if(IsValidClient(i) && !IsPlayerAlive(i)){
CS_RespawnPlayer(i);
DoRandomTeleport(i);
}
}
AnnounceChaos("Resurrect dead players in random locations", -1.0);
}
void Chaos_Bumpmines(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_Bumpmines")) return;
for(int i = 0; i <= MaxClients; i++) if(ValidAndAlive(i)) GivePlayerItem(i, "weapon_bumpmine");
AnnounceChaos("Bumpmines", -1.0);
}
Action Chaos_Spin180(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_Spin180.180Spin")) return;
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
float angs[3];
GetClientEyeAngles(i, angs);
angs[1] = angs[1] + 180;
TeleportEntity(i, NULL_VECTOR, angs, NULL_VECTOR);
}
}
AnnounceChaos("180 Spin", -1.0);
}
bool g_bPortalGuns = false;
Handle g_PortalGuns_Timer = INVALID_HANDLE;
Action Chaos_PortalGuns(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
if(EndChaos){
TeleportPlayersToClosestLocation();
AnnounceChaos("Portal Guns", -1.0, true);
}
g_bPortalGuns = false;
StopTimer(g_PortalGuns_Timer);
}
if(NotDecidingChaos("Chaos_PortalGuns")) return;
if(CurrentlyActive(g_PortalGuns_Timer)) return;
g_bPortalGuns = true;
SavePlayersLocations();
float duration = GetChaosTime("Chaos_PortalGuns", 20.0);
if(duration > 0) g_PortalGuns_Timer = CreateTimer(duration, Chaos_PortalGuns, true);
AnnounceChaos("Portal Guns", duration);
}
void Chaos_TeleportFewMeters(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_TeleportFewMeters")) return;
SavePlayersLocations();
TeleportPlayersToClosestLocation(-1, 350); //250 units of minimum teleport distance
AnnounceChaos("Teleport Players A Few Meters", -1.0);
}
Handle g_InfiniteGrenade_Timer = INVALID_HANDLE;
Action Chaos_InfiniteGrenades(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
StopTimer(g_InfiniteGrenade_Timer);
cvar("sv_infinite_ammo", "0");
if(EndChaos) AnnounceChaos("Infinite Grenades", -1.0, true);
}
if(NotDecidingChaos("Chaos_InfiniteGrenades")) return;
if(CurrentlyActive(g_InfiniteGrenade_Timer)) return;
cvar("sv_infinite_ammo", "2");
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
GivePlayerItem(i, "weapon_hegrenade");
GivePlayerItem(i, "weapon_molotov");
GivePlayerItem(i, "weapon_smokegrenade");
GivePlayerItem(i, "weapon_flashbang");
}
}
float duration = GetChaosTime("Chaos_InfiniteGrenades", 20.0);
if(duration > 0) g_InfiniteGrenade_Timer = CreateTimer(duration, Chaos_InfiniteGrenades, true);
AnnounceChaos("Infinite Grenades", duration);
}
void Chaos_Shields(){
if(ClearChaos()){ }
if(NotDecidingChaos("Chaos_Shields")) return;
char playerWeapon[62];
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
GetClientWeapon(i, playerWeapon, sizeof(playerWeapon));
int entity = CreateEntityByName("weapon_shield");
if (entity > 0) {
EquipPlayerWeapon(i, entity);
SetEntPropEnt(i, Prop_Data, "m_hActiveWeapon" , entity);
if(StrContains(playerWeapon, "knife", false) != -1){
FakeClientCommand(i, "use weapon_knife");
InstantSwitch(i, -1);
}else{
FakeClientCommand(i, "use %s", playerWeapon);
InstantSwitch(i, -1);
}
}
}
}
AnnounceChaos("Shields", -1.0);
}
Handle g_IsThisMexico_Timer = INVALID_HANDLE;
Action Chaos_IsThisMexico(Handle timer = null, bool EndChaos = false){
if(ClearChaos(EndChaos)){
Fog_OFF();
if(EndChaos) AnnounceChaos("Is This What Mexico Looks Like?", -1.0, true);
StopTimer(g_IsThisMexico_Timer);
}
if(NotDecidingChaos("Chaos_IsThisMexico.IsThisWhatMexicoLooksLike")) return;
if(CurrentlyActive(g_IsThisMexico_Timer)) return;
Mexico();
float duration = GetChaosTime("Chaos_IsThisMexico", 30.0);
if(duration > 0) g_IsThisMexico_Timer = CreateTimer(duration, Chaos_IsThisMexico, true);
AnnounceChaos("Is This What Mexico Looks Like?", duration);
}
Handle g_OneWeaponOnly_Timer = INVALID_HANDLE;
Action Chaos_OneWeaponOnly(Handle timer = null, bool EndChaos = false){
//todo; change chaos name, but its an event to pick a random weapon, and players are restricted to that weapon for the rest of the round.
if(ClearChaos(EndChaos)){
StopTimer(g_OneWeaponOnly_Timer);
g_bPlayersCanDropWeapon = true;
if(EndChaos) AnnounceChaos("Weapon Drop Re-enabled", -1.0, true);
}
if(NotDecidingChaos("Chaos_OneWeaponOnly")) return;
if(CurrentlyActive(g_OneWeaponOnly_Timer)) return;
//todo; might have to handle weapon pickups?.. (players can still buy)
g_bPlayersCanDropWeapon = false;
char randomWeapon[64];
int randomIndex = GetRandomInt(0, sizeof(g_sWeapons)-1);
randomWeapon = g_sWeapons[randomIndex];
for(int i = 0; i <= MaxClients; i++){
if(ValidAndAlive(i)){
StripPlayer(i);
GivePlayerItem(i, randomWeapon);
}
}
for(int i = 0; i < sizeof(randomWeapon); i++) randomWeapon[i] = CharToUpper(randomWeapon[i]);
char chaosMsg[128];
FormatEx(chaosMsg, sizeof(chaosMsg), "%s's Only!", randomWeapon[7]); //strip weapon_ from name;
// chaosMsg[0] = CharToUpper(chaosMsg[0]);
float duration = GetChaosTime("Chaos_OneWeaponOnly", 30.0);
if(duration > 0) g_OneWeaponOnly_Timer = CreateTimer(duration, Chaos_OneWeaponOnly, true);
AnnounceChaos(chaosMsg, duration);
}
void Chaos_AutoPlantC4(){
if(ClearChaos()){
AutoPlantRoundEnd();
}
if(
(g_PlantedSite != BOMBSITE_A) && (bombSiteB == INVALID_HANDLE) &&
(g_PlantedSite != BOMBSITE_B) && (bombSiteA == INVALID_HANDLE) &&
(g_PlantedSite != -1)
){
return;
}
if(NotDecidingChaos("Chaos_AutoPlantC4")) return;
if(g_bBombPlanted){
//todo make this a little cleaner
float newBombPosition[3];
char newBombSiteName[64];
if(g_PlantedSite == BOMBSITE_A && bombSiteB != INVALID_HANDLE){
int randomCoord = GetRandomInt(0, GetArraySize(bombSiteB)-1);
GetArrayArray(bombSiteB, randomCoord, newBombPosition);
newBombSiteName = "Bombsite B";
g_PlantedSite = BOMBSITE_B;
}else if(g_PlantedSite == BOMBSITE_B && bombSiteA != INVALID_HANDLE){
int randomCoord = GetRandomInt(0, GetArraySize(bombSiteA)-1);
GetArrayArray(bombSiteA, randomCoord, newBombPosition);
newBombSiteName = "Bombsite A";
g_PlantedSite = BOMBSITE_A;
}else if(g_PlantedSite == -1 && bombSiteA != INVALID_HANDLE && bombSiteB != INVALID_HANDLE){
if(GetRandomInt(0,100) <= 50){
int randomCoord = GetRandomInt(0, GetArraySize(bombSiteA)-1);
GetArrayArray(bombSiteA, randomCoord, newBombPosition);
newBombSiteName = "Bombsite A";
g_PlantedSite = BOMBSITE_A;
}else{
int randomCoord = GetRandomInt(0, GetArraySize(bombSiteB)-1);
GetArrayArray(bombSiteB, randomCoord, newBombPosition);
newBombSiteName = "Bombsite B";
g_PlantedSite = BOMBSITE_B;
}
}
int bombEnt = FindEntityByClassname(-1, "planted_c4");
if(g_iC4ChickenEnt != -1) bombEnt = g_iC4ChickenEnt;
// newBombPosition[2] = newBombPosition[2] - 64;
if(bombEnt != -1){
TeleportEntity(bombEnt, newBombPosition, NULL_VECTOR, NULL_VECTOR);
char AnnounceMessage[128];
FormatEx(AnnounceMessage, sizeof(AnnounceMessage), "Teleport bomb to %s", newBombSiteName);
AnnounceChaos(AnnounceMessage, -1.0);
return;
}else{
g_PlantedSite = -1; //fooked up
}
RetryEffect();
return;
}
AutoPlantC4();
CreateTimer(0.6, Timer_EnsureSpawnedAutoPlant);
}
public Action Timer_EnsureSpawnedAutoPlant(Handle timer){
if(g_PlantedSite == BOMBSITE_A){
AnnounceChaos("Auto Plant C4 at Bombsite A", -1.0);
}else if(g_PlantedSite == BOMBSITE_B){
AnnounceChaos("Auto Plant C4 at Bombsite B", -1.0);
}else{
AnnounceChaos("Auto Plant C4", -1.0);
}
}
public void Chaos_Impostors(){
//not to be confused with players into chickesn..
if(ClearChaos()){
RemoveChickens();
}
if(NotDecidingChaos("Chaos_Impostors")) return;
SpawnImpostors();
AnnounceChaos("Impostors", -1.0);
}
public void Chaos_MamaChook(){
if(ClearChaos()){
RemoveChickens();
}
if(NotDecidingChaos("Chaos_MamaChook")) return;
for(int i = 0; i < GetArraySize(g_MapCoordinates); i++){
int chance = GetRandomInt(0,100);
if(chance <= 25){
int ent = CreateEntityByName("chicken");
if(ent != -1){
float vec[3];
GetArrayArray(g_MapCoordinates, i, vec);
TeleportEntity(ent, vec, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(ent);
SetEntPropFloat(ent, Prop_Data, "m_flModelScale", 100.0);
}
break;
}
}
AnnounceChaos("Mama Chook", -1.0);
}