-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathability_boss_saxtron.sp
995 lines (782 loc) · 25.8 KB
/
ability_boss_saxtron.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
#pragma semicolon 1
#include <sourcemod>
#include <tf2_stocks>
#include <tf2attributes>
#include <sm_logger>
#include <berobot_constants>
#include <berobot>
#include <tf_custom_attributes>
#include <tf_ontakedamage>
#include <tf2_isPlayerInSpawn>
#include <sdkhooks>
#define PLUGIN_VERSION "1.0"
#define ROBOT_NAME "Saxtron"
#define ROBOT_ROLE "ZBOSS"
#define ROBOT_CLASS "Soldier"
#define ROBOT_SUBCLASS "Melee"
#define ROBOT_DESCRIPTION "Saxtron Hale: Gain +250 HP per human player"
#define ROBOT_TIPS "Crouch and look up to super jump\nCrouch and look down while jumping to weight drop"
#define ROBOT_ON_DEATH "Saxtron has great horizontal & vertical movement\nBeware of his AOE scare rage\nUse knockback to your advantage"
#define GSOLDIER "models/bots/saxtron/bot_saxtron_v2.mdl"
#define SPAWN "mvm/ambient_mp3/mvm_siren.mp3"
#define DEATH "mvm/giant_soldier/giant_soldier_explode.wav"
#define LOOP "mvm/giant_soldier/giant_soldier_loop.wav"
#define LEFTFOOT ")mvm/giant_soldier/giant_soldier_step01.wav"
#define LEFTFOOT1 ")mvm/giant_soldier/giant_soldier_step03.wav"
#define RIGHTFOOT ")mvm/giant_soldier/giant_soldier_step02.wav"
#define RIGHTFOOT1 ")mvm/giant_soldier/giant_soldier_step04.wav"
// #define GUNFIRE ")mvm/giant_soldier/giant_soldier_rocket_shoot.wav"
// #define GUNFIRE_CRIT ")mvm/giant_soldier/giant_soldier_rocket_shoot_crit.wav"
// #define GUNFIRE_EXPLOSION ")mvm/giant_soldier/giant_soldier_rocket_explode.wav"
/// Saxton Hale voicelines
#define HaleComicArmsFallSound "saxtron_h413/saxtron_h413_responce_2.wav"
#define HaleLastB "vo/announcer_am_lastmanalive"
#define HaleKSpree "saxtron_h413/saxtron_h413_responce_3.wav"
#define HaleKSpree2 "saxtron_h413/saxtron_h413_responce_4.wav" /// this line is broken and unused
#define HaleRoundStart "saxtron_h413/saxtron_h413_responce_start" /// 1-5
#define HaleJump "saxtron_h413/saxtron_h413_responce_jump" /// 1-2
#define HaleRageSound "saxtron_h413/saxtron_h413_responce_rage" /// 1-4
#define HaleKillMedic "saxtron_h413/saxtron_h413_responce_kill_medic.wav"
#define HaleKillSniper1 "saxtron_h413/saxtron_h413_responce_kill_sniper1.wav"
#define HaleKillSniper2 "saxtron_h413/saxtron_h413_responce_kill_sniper2.wav"
#define HaleKillSpy1 "saxtron_h413/saxtron_h413_responce_kill_spy1.wav"
#define HaleKillSpy2 "saxtron_h413/saxtron_h413_responce_kill_spy2.wav"
#define HaleKillEngie1 "saxtron_h413/saxtron_h413_responce_kill_eggineer1.wav"
#define HaleKillEngie2 "saxtron_h413/saxtron_h413_responce_kill_eggineer2.wav"
#define HaleKSpreeNew "saxtron_h413/saxtron_h413_responce_spree" /// 1-5
#define HaleWin "saxtron_h413/saxtron_h413_responce_win" /// 1-2
#define HaleLastMan "saxtron_h413/saxtron_h413_responce_lastman" /// 1-5
#define HaleFail "saxtron_h413/saxtron_h413_responce_fail" /// 1-3
#define HaleJump132 "saxtron_h413/saxtron_h413_132_jump_" //1-2
#define HaleStart132 "saxtron_h413/saxtron_h413_132_start_" /// 1-5
#define HaleKillDemo132 "saxtron_h413/saxtron_h413_132_kill_demo.wav"
#define HaleKillEngie132 "saxtron_h413/saxtron_h413_132_kill_engie_" /// 1-2
#define HaleKillHeavy132 "saxtron_h413/saxtron_h413_132_kill_heavy.wav"
#define HaleKillScout132 "saxtron_h413/saxtron_h413_132_kill_scout.wav"
#define HaleKillSpy132 "saxtron_h413/saxtron_h413_132_kill_spie.wav"
#define HaleKillPyro132 "saxtron_h413/saxtron_h413_132_kill_w_and_m1.wav"
#define HaleSappinMahSentry132 "saxtron_h413/saxtron_h413_132_kill_toy.wav"
#define HaleKillKSpree132 "saxtron_h413/saxtron_h413_132_kspree_" /// 1-2
#define HaleKillLast132 "saxtron_h413/saxtron_h413_132_last.wav"
#define HaleStubbed132 "saxtron_h413/saxtron_h413_132_stub_" /// 1-4
// #define HALESPEED 340.0
// #define HALE_JUMPCHARGE (25*1.0)
// #define HALERAGEDIST 800.0
// #define HALE_WEIGHDOWN_TIME 3.0
bool b_SaxtonSaid[MAXPLAYERS + 1] = {false, ...};
bool b_SaxtonSaidAll[MAXPLAYERS + 1] = {false, ...};
float g_JumpTime = 0.0;
public Plugin:myinfo =
{
name = "[TF2] Be the Giant Saxtron",
author = "HiGPS | Bmod.TF",
description = "Saxtron Ability and Voicelines",
version = PLUGIN_VERSION,
url = "www.bmod.tf"
}
public OnPluginStart()
{
// SMLoggerInit(LOG_TAGS, sizeof(LOG_TAGS), SML_ERROR, SML_FILE);
LoadTranslations("common.phrases");
// HookEvent("post_inventory_application", EventInventoryApplication, EventHookMode_Post);
AddNormalSoundHook(SaxtronSoundHook);
// RobotDefinition robot;
// robot.name = ROBOT_NAME;
// robot.role = ROBOT_ROLE;
// robot.class = "Soldier";
// robot.shortDescription = ROBOT_DESCRIPTION;
// robot.sounds.spawn = SPAWN;
// robot.sounds.loop = LOOP;
// robot.sounds.death = DEATH;
// robot.deathtip = ROBOT_ON_DEATH;
// robot.difficulty = ROBOT_DIFFICULTY_HARD;
// RestrictionsDefinition restrictions = new RestrictionsDefinition();
// // restrictions.TimeLeft = new TimeLeftRestrictionDefinition();
// // restrictions.TimeLeft.SecondsBeforeEndOfRound = 300;
// restrictions.TeamCoins = new RobotCoinRestrictionDefinition();
// restrictions.TeamCoins.Overall = 1;
// restrictions.RobotCoins = new RobotCoinRestrictionDefinition();
// restrictions.RobotCoins.PerRobot = 35.0;
// AddRobot(robot, MakeGiantSoldier, PLUGIN_VERSION, restrictions, 2);
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
HookEvent("player_death", Event_Death, EventHookMode_Post);
HookEvent("object_destroyed", ObjectDestroyed, EventHookMode_Pre);
HookEvent("teamplay_round_win", Event_teamplay_round_win, EventHookMode_Post);
}
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
CreateTimer(3.0, SaySpawnLine, client);
//EmitGameSoundToAll("Announcer.mvm_spybot_death");
return Plugin_Continue;
}
public Action SaySpawnLine (Handle timer, int client)
{
// PrintToChatAll("1 %N", client);
if (IsRobot(client, ROBOT_NAME))
{
// PrintToChatAll("2");
char start_snd[PLATFORM_MAX_PATH];
// if( !GetRandomInt(0, 1) )
Format(start_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleRoundStart, GetRandomInt(1, 5));
// else
//Format(start_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleStart132, GetRandomInt(1, 5));
SaxtronSayAll(client , start_snd);
}
}
public Action Event_teamplay_round_win(Event event, const char[] name, bool dontBroadcast)
{
int winteam = GetEventInt(event, "team");
// PrintToChatAll("Winning team was %i", winteam);
CreateTimer(3.0, team_play_win_timer, winteam);
//EmitGameSoundToAll("Announcer.mvm_spybot_death");
return Plugin_Continue;
}
public Action team_play_win_timer (Handle timer, int winteam)
{
// // HaleWin1-2 HaleFail1-3
// int client;
char szVO[PLATFORM_MAX_PATH];
for(int i = 1; i <= MaxClients; i++)
{
if (IsRobot(i,ROBOT_NAME) && IsPlayerAlive(i) && winteam == GetClientTeam(i))
{
Format(szVO, sizeof(szVO),"%s%i.wav",HaleWin, GetRandomInt(1,2));
SaxtronSay(i, szVO);
}else if (IsRobot(i,ROBOT_NAME) && IsPlayerAlive(i) && winteam != GetClientTeam(i))
{
Format(szVO, sizeof(szVO),"%s%i.wav", HaleFail, GetRandomInt(1,3));
SaxtronSay(i, szVO);
}
}
return Plugin_Continue;
}
// public void OnPluginEnd()
// {
// RemoveRobot(ROBOT_NAME);
// }
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
// CreateNative("BeGiantPyro_MakeGiantSoldier", Native_SetGiantPyro);
// CreateNative("BeGiantPyro_IsGiantPyro", Native_IsGiantPyro);
return APLRes_Success;
}
public OnMapStart()
{
PrecacheSound(HaleKSpree);
char s[PLATFORM_MAX_PATH];
int i;
for( i=1; i <= 4; i++ ) {
Format(s, PLATFORM_MAX_PATH, "%s0%i.wav", HaleLastB, i);
// (s, true);
}
PrecacheSound(HaleKillMedic);
PrecacheSound(HaleKillSniper1);
PrecacheSound(HaleKillSniper2);
PrecacheSound(HaleKillSpy1);
PrecacheSound(HaleKillSpy2);
PrecacheSound(HaleKillEngie1);
PrecacheSound(HaleKillEngie2);
PrecacheSound(HaleKillDemo132);
PrecacheSound(HaleKillHeavy132);
PrecacheSound(HaleKillScout132);
PrecacheSound(HaleKillSpy132);
PrecacheSound(HaleKillPyro132);
PrecacheSound(HaleKillDemo132);
PrecacheSound(HaleKillDemo132);
PrecacheSound(HaleKillDemo132);
PrecacheSound(HaleKillDemo132);
PrecacheSound(HaleKillDemo132);
PrecacheSound(HaleSappinMahSentry132);
PrecacheSound(HaleKillLast132);
for( i=1; i <= 5; i++ ) {
if( i <= 2 ) {
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleJump, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleWin, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleJump132, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleKillEngie132, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleKillKSpree132, i);
PrecacheSound(s);
}
if( i <= 3 ) {
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleFail, i);
PrecacheSound(s);
}
if( i <= 4 ) {
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleRageSound, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleStubbed132, i);
PrecacheSound(s);
}
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleRoundStart, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleKSpreeNew, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleLastMan, i);
PrecacheSound(s);
Format(s, PLATFORM_MAX_PATH, "%s%i.wav", HaleStart132, i);
PrecacheSound(s);
}
}
/* public EventInventoryApplication(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(g_bIsGSoldier[client])
{
g_bIsGSoldier[client] = false;
}
} */
int g_SuperJumpCharge = 0;
int g_SuperJumpChargeLimit = 125;
float g_rage[MAXPLAYERS + 1] = {0.0, ...};
float g_ragelimit = 2000.0;
// public Action:SetModel(client, const String:model[])
// {
// if (IsValidClient(client) && IsPlayerAlive(client))
// {
// SetVariantString(model);
// AcceptEntityInput(client, "SetCustomModel");
// SetEntProp(client, Prop_Send, "m_bUseClassAnimations", 1);
// }
// }
public Action:SaxtronSoundHook(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags)
{
if (!IsValidClient(entity)) return Plugin_Continue;
if (!IsRobot(entity, ROBOT_NAME)) return Plugin_Continue;
if (strncmp(sample, "player/footsteps/", 17, false) == 0)
{
if (StrContains(sample, "1.wav", false) != -1)
{
Format(sample, sizeof(sample), LEFTFOOT);
EmitSoundToAll(sample, entity);
}
else if (StrContains(sample, "3.wav", false) != -1)
{
Format(sample, sizeof(sample), LEFTFOOT1);
EmitSoundToAll(sample, entity);
}
else if (StrContains(sample, "2.wav", false) != -1)
{
Format(sample, sizeof(sample), RIGHTFOOT);
EmitSoundToAll(sample, entity);
}
else if (StrContains(sample, "4.wav", false) != -1)
{
Format(sample, sizeof(sample), RIGHTFOOT1);
EmitSoundToAll(sample, entity);
}
return Plugin_Changed;
}
// PrintToChatAll("sample %b", strncmp(sample, "vo/soldier", 10, false));
//For laughing taunt
if (strncmp(sample, "vo/soldier_LaughLong03.mp3", 26, false) == 0)
{
volume = 0.0;
//SayLaughter(entity);
SaxtronSay(entity,"saxtron_h413/saxtron_h413_responce_spree1.wav");
return Plugin_Changed;
}
if (strncmp(sample, "vo/soldier_pain", 15, false) == 0)
{
//PrintToChatAll("Found pain");
volume = 0.0;
//SayLaughter(entity);
//SaxtronSay(entity,"saxtron_h413/saxtron_h413_responce_spree1.wav");
return Plugin_Changed;
}
if (strncmp(sample, "vo/", 3, false) == 0)
{
//PrintToChatAll("Sample was %s", sample);
// ReplaceString(sample, sizeof(sample), ".wav", ".mp3", false);
// char classname[10];
// char classname_mvm[15];
// Format(classname_mvm, sizeof(classname_mvm), "%snull_mvm", classname);
//ReplaceString(sample, sizeof(sample), "null.wav", "null.wav", false);
volume = 0.0;
RequestFrame(SayVoiceLine, entity);
return Plugin_Changed;
}
if (volume == 0.0 || volume == 0.9997) return Plugin_Continue;
return Plugin_Continue;
}
void SayVoiceLine(int client)
{
if (!b_SaxtonSaid[client])
{
char szVO[PLATFORM_MAX_PATH];
int see = GetRandomInt(0,1);
if (see == 1)
{
Format(szVO, sizeof(szVO),"%s%i.wav", HaleStart132, GetRandomInt(1,5));
}else
{
Format(szVO, sizeof(szVO),"%s%i.wav", HaleLastMan, GetRandomInt(1,5));
}
see = GetRandomInt(0,3);
// see = 0;
if (see == 0)
{
Format(szVO, sizeof(szVO),"%s", HaleKillLast132);
}
SaxtronSay(client, szVO);
//b_SaxtonSaid[client] = true;
}
}
public Action TF2_OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom, CritType &critType)
{
if(!IsValidClient(victim))
return Plugin_Continue;
if(IsValidClient(attacker) && IsRobot(victim, ROBOT_NAME))
{
if (IsRobot(victim, ROBOT_NAME))
{
if(damagecustom == TF_CUSTOM_BACKSTAB)
{
char stab_snd[PLATFORM_MAX_PATH];
Format(stab_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleStubbed132, GetRandomInt(1, 4));
SaxtronSay(victim, stab_snd);
}
}
SaxtronRageIncrease(victim, damage);
}
if(IsValidClient(victim) && IsRobot(attacker, ROBOT_NAME))
{
SaxtronRageIncrease(attacker, damage);
}
return Plugin_Continue;
}
void SaxtronRageIncrease(int client, float damage)
{
if(g_rage[client] <= g_ragelimit)
{
if(damage > 250.0)
{
g_rage[client] -= damage;
g_rage[client] += 250.0;
}
g_rage[client] += damage;
}
}
public Action Event_Death(Event event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
int victim = GetClientOfUserId(GetEventInt(event, "userid"));
//EmitSoundToAll(HaleKillDemo132, attacker);
if (IsRobot(attacker, ROBOT_NAME) && IsValidClient(victim)){
KilledPlayer(attacker, victim);
}
if (IsRobot(victim, ROBOT_NAME)){
// PrintToChatAll("DEAD AS SAXTRON");
char szVO[PLATFORM_MAX_PATH];
Format(szVO, sizeof(szVO),"%s%i.wav", HaleFail, GetRandomInt(1,3));
SaxtronSay(victim, szVO);
}
return Plugin_Continue;
}
public void KilledPlayer(int attacker, int victim)
{
//event.SetString("weapon", "fists");
// if( !GetRandomInt(0, 2) ) {
char kill_snd[PLATFORM_MAX_PATH];
// TFClassType playerclass = TF2_GetPlayerClass(victim);
switch(TF2_GetPlayerClass(victim)) {
case TFClass_Scout: strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillScout132);
case TFClass_Pyro: strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillPyro132);
case TFClass_DemoMan: strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillDemo132);
case TFClass_Heavy: strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillHeavy132);
case TFClass_Medic: strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillMedic);
case TFClass_Sniper: strcopy(kill_snd, PLATFORM_MAX_PATH, GetRandomInt(0, 1) ? HaleKillSniper1 : HaleKillSniper2);
case TFClass_Spy: {
int see = GetRandomInt(0, 2);
if( see )
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillSpy1);
else if( see == 1 )
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillSpy2);
else strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillSpy132);
}
case TFClass_Engineer: {
int see = GetRandomInt(0, 3);
if( !see )
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillEngie1);
else if( see == 1 )
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillEngie2);
else Format(kill_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleKillEngie132, GetRandomInt(1, 2));
}
case TFClass_Soldier:
{
int see = GetRandomInt(0, 1);
if (see == 0){
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKSpreeNew);
Format(kill_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleKSpreeNew, GetRandomInt(1, 5));
}else if (see == 1)
{
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillKSpree132);
Format(kill_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleKillKSpree132, GetRandomInt(1, 2));
}
}
}
if( kill_snd[0] != '\0' ){
int see;
if (TF2_GetPlayerClass(victim) == TFClass_Soldier)
{
see = GetRandomInt(0,1);
}else
{
see = GetRandomInt(0, 5);
}
if (see == 0){
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKSpreeNew);
Format(kill_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleKSpreeNew, GetRandomInt(1, 5));
}else if (see == 1)
{
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleKillKSpree132);
Format(kill_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleKillKSpree132, GetRandomInt(1, 2));
}
SaxtronSay(attacker, kill_snd);
}
// SaxtronSay(attacker, kill_snd);
// SaxtronSay(attacker, kill_snd);
// SaxtronSay(attacker, kill_snd);
// SaxtronSay(attacker, kill_snd);
// EmitSoundToAll(kill_snd, attacker);
// EmitSoundToAll(kill_snd, attacker);
// }
// int iKills = 0;
// float curtime = GetGameTime();
// if( curtime <= flKillSpree )
// iKills++;
// else iKills = 0;
// if( this.iKills == 3 && GetLivingPlayers(VSH2Team_Red) != 1 ) {
// char spree_snd[PLATFORM_MAX_PATH];
// int randsound = GetRandomInt(0, 7);
// if( !randsound || randsound == 1 )
// strcopy(spree_snd, PLATFORM_MAX_PATH, HaleKSpree);
// else if( randsound < 5 && randsound > 1 )
// Format(spree_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleKSpreeNew, GetRandomInt(1, 5));
// else Format(spree_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleKillKSpree132, GetRandomInt(1, 2));
// EmitSoundToAll(spree_snd, attacker);
// EmitSoundToAll(spree_snd, attacker);
// iKills = 0;
// }
// else flKillSpree = curtime+5;
}
// public void Stabbed(int victim) {
// EmitSoundToAll(stab_snd, victim);
// EmitSoundToAll(stab_snd, victim);
// EmitSoundToAll(stab_snd, victim);
// }
public Action ObjectDestroyed(Event event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if (IsRobot(attacker, ROBOT_NAME))
{
SaxtronSay(attacker, HaleSappinMahSentry132);
}
return Plugin_Continue;
}
bool g_JumpCoolDown = false;
int g_AirTime = 0;
bool g_CanWeighDown = false;
//////////SAXTON HALE CODE FROM CHDATA
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if (IsRobot(client, ROBOT_NAME) && (client))
{
int IsJumping = GetEntProp(client, Prop_Send, "m_bJumping");
if (IsJumping == 1)
{
g_AirTime++;
}else
{
g_AirTime = 0;
}
if(g_AirTime >= 85)
{
g_CanWeighDown = true;
}else
{
g_CanWeighDown = false;
}
float currenttime = GetEngineTime();
//PrintToChatAll("%f", currenttime);
if (g_JumpTime <= currenttime && g_JumpCoolDown)
{
g_JumpCoolDown = false;
}
float ang[3];
GetClientEyeAngles(client, ang);
if (!TF2Spawn_IsClientInSpawn(client)){
DrawHaleHUD(client);
}
if (buttons & IN_ATTACK2)
{
if (IsJumping == 0)
{
if
(g_SuperJumpCharge+1 >= g_SuperJumpChargeLimit)
{
g_SuperJumpCharge = g_SuperJumpChargeLimit;
}
else
{
if(!g_JumpCoolDown) g_SuperJumpCharge++;
}
}
}
if (buttons & IN_DUCK)
{
if(IsJumping == 1)
{
// SetEntityGravity(client, 1.0);
if (g_CanWeighDown && (ang[0] > 60.0))
{
WeighDown(client, -2000.0, true);
return Plugin_Changed;
}
}
}
if (buttons & IN_RELOAD || buttons & IN_ATTACK3)
{
int IsJumping = GetEntProp(client, Prop_Send, "m_bJumping");
//TF2_RemoveCondition(client, condition);
if (!IsJumping && g_rage[client] >= g_ragelimit)
{
PerformStun(client);
SaxtronSay(client,"saxtron_h413/saxtron_h413_responce_spree1.wav");
g_rage[client] = 0.0;
}
}
// if (buttons & IN_ATTACK2 && !IsJumping && g_rage[client] >= g_ragelimit)
// {
// PerformStun(client);
// g_rage[client] = 0.0;
// }(
if(ang[0] < -33.0 && !g_JumpCoolDown && (GetEntProp( client, Prop_Data, "m_afButtonReleased" ) & IN_ATTACK2))
{
// PrintToChatAll("Button released g_Sumperjumpcharge was %i", g_SuperJumpCharge);
SuperJump(client, float(g_SuperJumpCharge), true);
}
if ((GetEntProp( client, Prop_Data, "m_afButtonReleased" ) & IN_ATTACK2) && ang[0] > -40.0)
{
g_SuperJumpCharge = 0;
}
}
return Plugin_Continue;
}
public void SuperJump(int client, float power, bool reset)
{
g_SuperJumpCharge = 0;
float vel[3]; GetEntPropVector(client, Prop_Data, "m_vecVelocity", vel);
vel[2] = 150 + power * 13.0;
// if( g_bSuperCharge ) {
// vel[2] += 2000.0;
// g_bSuperCharge = false;
// }
SetEntProp(client, Prop_Send, "m_bJumping", 1);
vel[0] *= (1+Sine(power * FLOAT_PI / 50));
vel[1] *= (1+Sine(power * FLOAT_PI / 50));
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vel);
int random = GetRandomInt(0,1);
char kill_snd[PLATFORM_MAX_PATH];
if(random == 0){
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleJump132);
Format(kill_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleJump132, GetRandomInt(1, 2));
}else
{
strcopy(kill_snd, PLATFORM_MAX_PATH, HaleJump);
Format(kill_snd, PLATFORM_MAX_PATH, "%s%i.wav", HaleJump, GetRandomInt(1, 2));
}
SaxtronSay(client,kill_snd);
// CreateTimer(7.0, JumpCoolDown);
g_JumpTime = GetEngineTime() + 7.0;
g_JumpCoolDown = true;
//PrintToChatAll("%f", g_JumpTime);
}
// public Action JumpCoolDown(Handle timer)
// {
// g_JumpCoolDown = false;
// }
public void WeighDown(int client, float power, bool reset)
{
// SetEntityGravity(client, 1.0);
float fVelocity[3]; GetEntPropVector(client, Prop_Data, "m_vecVelocity", fVelocity);
fVelocity[2] = power;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fVelocity);
// SetEntityGravity(client, 6.0);
}
//////////////////// END SAXTON HALE CODE CHDATA
public void PerformStun(int client)
{
//Get our hero variables
float duration = 1.5;
bool fullStun = false;
float radius = 400.0;
int iTeam = GetClientTeam(client);
ApplyRadialStun(client, GetOpposingTeam(iTeam), duration, radius, fullStun);
// FakeClientCommandEx(client, "taunt");
// TF2_AddCondition(client, TFCond_DefenseBuffed, 15.0);
// TF2_AddCondition(client, TFCond_FreezeInput, 4.0);
int random = GetRandomInt(1,4);
//HaleRageSound "saxtron_h413/saxtron_h413_responce_rage"
char szVO[PLATFORM_MAX_PATH];
Format(szVO, sizeof(szVO),"%s%i.wav",HaleRageSound, random);
// PrintToChatAll("%s",szVO);
b_SaxtonSaid[client] = false;
SaxtronSay(client, szVO);
TF2_AddCondition(client, TFCond_SpeedBuffAlly, 8.0);
}
public void ApplyRadialStun(int hero, int team, float flDuration, float flRadius, bool full)
{
//positions
float heroPos[3];
float playerPos[3];
//Get our hero's position
GetClientAbsOrigin(hero, heroPos);
int stunflag = TF_STUNFLAGS_SMALLBONK;
if (full)
stunflag = TF_STUNFLAGS_BIGBONK;
//loop through players
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client) && IsPlayerAlive(client))
{
int cteam = GetClientTeam(client);
if (cteam != team) continue;
GetClientAbsOrigin(client, playerPos);
if (GetVectorDistance(playerPos, heroPos) <= flRadius)
{
if (full)
TF2_StunPlayer(client, flDuration, 0.0, stunflag);
else
TF2_StunPlayer(client, flDuration, 0.0, stunflag);
}
}
}
}
public int GetOpposingTeam(int team)
{
switch (team)
{
case 2: return 3;
case 3: return 2;
}
return -1;
}
public void SaxtronSay(int client, const char[] voiceline)
{
if (!b_SaxtonSaid[client]){
EmitSoundToAll(voiceline, client);
EmitSoundToAll(voiceline, client);
EmitSoundToAll(voiceline, client);
b_SaxtonSaid[client] = true;
CreateTimer(3.5, Timer_SaxtonSaid, client);
}
}
public void SaxtronSayAll(int client, const char[] voiceline)
{
if (!b_SaxtonSaidAll[client]){
for (int i = 1; i <= MaxClients; i++)
{
if (IsValidClient(i) && IsPlayerAlive(client))
{
EmitSoundToClient(i,voiceline);
EmitSoundToClient(i,voiceline);
EmitSoundToClient(i,voiceline);
}
}
b_SaxtonSaidAll[client] = true;
CreateTimer(25.0, Timer_SaxtonSaidAll, client);
}
}
public Action Timer_SaxtonSaid(Handle timer, int client)
{
b_SaxtonSaid[client] = false;
return Plugin_Continue;
}
public Action Timer_SaxtonSaidAll(Handle timer, int client)
{
b_SaxtonSaidAll[client] = false;
return Plugin_Continue;
}
#define CHAR_FULL "■"
#define CHAR_EMPTY "□"
// bool b_hud_clamp[MAXPLAYERS + 1] = false;
void DrawHaleHUD(int client)
{
DrawRageHUD(client);
DrawJumpHUD(client);
}
void DrawJumpHUD(int client)
{
char sHUDText[128];
char sProgress[32];
int iPercents = RoundToCeil(float(g_SuperJumpCharge) / float(g_SuperJumpChargeLimit)* 100.0);
for (int j = 1; j <= 10; j++)
{
if (iPercents >= j * 10)StrCat(sProgress, sizeof(sProgress), CHAR_FULL);
else StrCat(sProgress, sizeof(sProgress), CHAR_EMPTY);
}
// int team = GetClientTeam(client);
// float angles[3], pos[3];
if (g_JumpCoolDown){
Format(sHUDText, sizeof(sHUDText), "Jump %i(cooldown) : %d%%%% \n%s ", RoundToNearest((g_JumpTime+1.0) - GetEngineTime()), iPercents, sProgress);
SetHudTextParams(0.85, -0.4, 0.1, 255, 0, 0, 255);
}else
{
Format(sHUDText, sizeof(sHUDText), "Jump: %d%%%% \n%s ", iPercents, sProgress);
if(iPercents >= 100)
{
SetHudTextParams(0.85, -0.4, 0.1, 0, 255, 0, 255);
}else {
SetHudTextParams(0.85, -0.4, 0.1, 255, 255, 255, 255);
}
}
//SetHudTextParams(0.85, -0.4, 0.1, 255, 255, 255, 255);
ShowHudText(client, -2, sHUDText);
// b_hud_clamp[client] = false;
}
void DrawRageHUD(int client)
{
char sHUDText[128];
char sProgress[32];
int iPercents = RoundToCeil(g_rage[client] / g_ragelimit * 100.0);
for (int j = 1; j <= 10; j++)
{
if (iPercents >= j * 10)StrCat(sProgress, sizeof(sProgress), CHAR_FULL);
else StrCat(sProgress, sizeof(sProgress), CHAR_EMPTY);
}
// int team = GetClientTeam(client);
// float angles[3], pos[3];
Format(sHUDText, sizeof(sHUDText), "Rage: %d%%%% \n%s ", iPercents, sProgress);
if(iPercents >= 100)
{
Format(sHUDText, sizeof(sHUDText), "Rage Ready!\nReload to activate!");
SetHudTextParams(0.85, 0.6, 0.1, 0, 255, 0, 255);
}else {
SetHudTextParams(0.85, 0.6, 0.1, 255, 255, 255, 255);
}
ShowHudText(client, -3, sHUDText);
// b_hud_clamp[client] = false;
}
public void TF2_OnConditionAdded(int client, TFCond condition)
{
//PrintToChatAll("CONDITION WAS: %i for %N", condition, client);
if (IsRobot(client, ROBOT_NAME) && condition == TFCond_Taunting )
{
int IsJumping = GetEntProp(client, Prop_Send, "m_bJumping");
int tauntid = GetEntProp(client, Prop_Send, "m_iTauntItemDefIndex");
if (tauntid == 463){
SaxtronSay(client,"saxtron_h413/saxtron_h413_responce_spree1.wav");
//TF2_RemoveCondition(client, condition);
}
if (tauntid == -1 && !IsJumping && g_rage[client] >= g_ragelimit)
{
PerformStun(client);
g_rage[client] = 0.0;
}
}
}