forked from zonde306/l4d2sc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl4d2_CowAntiCheat.sp
1856 lines (1605 loc) · 63 KB
/
l4d2_CowAntiCheat.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
/* [CS:GO] CowAntiCheat Plugin - Burn the cheaters!
*
* Copyright (C) 2018 Eric Edson // ericedson.me // [email protected]
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/.
*/
#pragma semicolon 1
#define PLUGIN_AUTHOR "CodingCow, zonde306"
#define PLUGIN_VERSION "1.15"
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
// #include <autoexecconfig>
#include <SteamWorks>
// #undef REQUIRE_PLUGIN
// #include <sourcebans>
// #define _USE_DETOUR_FUNC_ // 使用 hook 油桶
#if defined _USE_DETOUR_FUNC_
#include <dhooks>
#endif // _USE_DETOUR_FUNC_
#pragma newdecls required
public Plugin myinfo =
{
name = "反作弊",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
// bool sourcebans = false;
#define JUMP_HISTORY 30
#define MAX_TICK_DETECTION 30
int g_iCmdNum[MAXPLAYERS + 1];
int g_iAimbotCount[MAXPLAYERS + 1];
int g_iLastHitGroup[MAXPLAYERS + 1];
bool g_bAngleSet[MAXPLAYERS + 1];
float prev_angles[MAXPLAYERS + 1][3];
int g_iPerfectBhopCount[MAXPLAYERS + 1];
bool g_bThirdPersonEnabled[MAXPLAYERS + 1];
int g_iTicksOnGround[MAXPLAYERS + 1];
int g_iLastJumps[MAXPLAYERS + 1][JUMP_HISTORY];
int g_iLastJumpIndex[MAXPLAYERS + 1];
int g_iJumpsSent[MAXPLAYERS + 1][JUMP_HISTORY];
int g_iJumpsSentIndex[MAXPLAYERS + 1];
int g_iPrev_TicksOnGround[MAXPLAYERS + 1];
float prev_sidemove[MAXPLAYERS + 1];
int g_iPerfSidemove[MAXPLAYERS + 1];
int prev_buttons[MAXPLAYERS + 1];
bool g_bShootSpam[MAXPLAYERS + 1];
int g_iLastShotTick[MAXPLAYERS + 1];
bool g_bFirstShot[MAXPLAYERS + 1];
int g_iAutoShoot[MAXPLAYERS + 1];
int g_iTriggerBotCount[MAXPLAYERS + 1];
int g_iTicksOnPlayer[MAXPLAYERS + 1];
int g_iPrev_TicksOnPlayer[MAXPLAYERS + 1];
int g_iMacroCount[MAXPLAYERS + 1];
int g_iMacroDetectionCount[MAXPLAYERS + 1];
float g_fJumpStart[MAXPLAYERS + 1];
float g_fDefuseTime[MAXPLAYERS+1];
int g_iWallTrace[MAXPLAYERS + 1];
int g_iStrafeCount[MAXPLAYERS + 1];
bool turnRight[MAXPLAYERS + 1];
int g_iTickCount[MAXPLAYERS + 1];
int prev_mousedx[MAXPLAYERS + 1];
int g_iAHKStrafeDetection[MAXPLAYERS + 1];
int g_iMousedx_Value[MAXPLAYERS + 1];
int g_iMousedxCount[MAXPLAYERS + 1];
float g_fJumpPos[MAXPLAYERS + 1];
bool prev_OnGround[MAXPLAYERS + 1];
int g_iTickLeft[MAXPLAYERS + 1];
int g_iTickDetecton[MAXPLAYERS + 1];
float g_fTickDetectedTime[MAXPLAYERS + 1];
float g_fPrevLatency[MAXPLAYERS + 1];
int g_iMaxTick = 0;
float g_Sensitivity[MAXPLAYERS + 1];
float g_mYaw[MAXPLAYERS + 1];
Handle g_hTimerQueryTimeout[MAXPLAYERS + 1] = {null, ...};
int g_iQueryTimeout[MAXPLAYERS + 1] = {0, ...};
int g_iSendMoveCalled[MAXPLAYERS+1];
int g_iSendMoveRate[MAXPLAYERS+1];
float g_fSendMoveSecond[MAXPLAYERS+1];
bool g_bHasThirdChecked[MAXPLAYERS+1];
int g_iOffsetVomitTimer = -1;
float g_fVomitFadeTimer[MAXPLAYERS+1];
float g_fReleasedTimer[MAXPLAYERS+1];
float g_fDefibrillatorTimer[MAXPLAYERS+1];
float g_fGrenadeExplodeTimer[MAXPLAYERS+1];
float g_fGasCanTimer[MAXPLAYERS+1];
ArrayList g_aszClientSteamId;
/* Detection Cvars */
ConVar g_ConVar_AutoBhop;
ConVar g_ConVar_MaxCmdRate;
ConVar g_ConVar_MaxUpdateRate;
ConVar g_ConVar_DefibDuration;
ConVar g_ConVar_AimbotEnable;
ConVar g_ConVar_BhopEnable;
ConVar g_ConVar_SilentStrafeEnable;
ConVar g_ConVar_TriggerbotEnable;
ConVar g_ConVar_MacroEnable;
ConVar g_ConVar_AutoShootEnable;
ConVar g_ConVar_InstantDefuseEnable;
ConVar g_ConVar_PerfectStrafeEnable;
ConVar g_ConVar_BacktrackFixEnable;
ConVar g_ConVar_AHKStrafeEnable;
ConVar g_ConVar_HourCheckEnable;
ConVar g_ConVar_HourCheckValue;
ConVar g_ConVar_ProfileCheckEnable;
ConVar g_ConVar_SpeedHackEnable;
ConVar g_ConVar_ThirdESPEnable;
ConVar g_ConVar_BlockSpecialIdle;
ConVar g_ConVar_BlockVomitIdle;
ConVar g_ConVar_BlockGrenadeIdle;
ConVar g_ConVar_VomitDuration;
ConVar g_ConVar_GrenadeDuration;
ConVar g_ConVar_FamilySharing;
ConVar g_ConVar_MatHack;
ConVar g_ConVar_BlockDefibIdle;
ConVar g_ConVar_BlockReleaseIdle;
ConVar g_ConVar_BlockReleaseDuration;
ConVar g_ConVar_BlockGasCanIdle;
ConVar g_ConVar_BlockGasCanDuration;
ConVar g_ConVar_QueryMaxTime;
ConVar g_ConVar_QueryMaxCount;
/* Detection Thresholds Cvars */
ConVar g_ConVar_AimbotBanThreshold;
ConVar g_ConVar_BhopBanThreshold;
ConVar g_ConVar_SilentStrafeBanThreshold;
ConVar g_ConVar_TriggerbotBanThreshold;
ConVar g_ConVar_TriggerbotLogThreshold;
ConVar g_ConVar_MacroLogThreshold;
ConVar g_ConVar_AutoShootLogThreshold;
ConVar g_ConVar_PerfectStrafeBanThreshold;
ConVar g_ConVar_PerfectStrafeLogThreshold;
ConVar g_ConVar_AHKStrafeLogThreshold;
/* Ban Times */
ConVar g_ConVar_AimbotBanTime;
ConVar g_ConVar_BhopBanTime;
ConVar g_ConVar_SilentStrafeBanTime;
ConVar g_ConVar_TriggerbotBanTime;
ConVar g_ConVar_PerfectStrafeBanTime;
ConVar g_ConVar_InstantDefuseBanTime;
public void OnPluginStart()
{
g_ConVar_AimbotEnable = CreateConVar("cac_aimbot", "1", "是否开启自动瞄准检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BhopEnable = CreateConVar("cac_bhop", "1", "是否开启自动连跳检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_SilentStrafeEnable = CreateConVar("cac_silentstrafe", "1", "是否开启隐藏式自动连跳加速检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_TriggerbotEnable = CreateConVar("cac_triggerbot", "1", "是否开启自动开枪检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_MacroEnable = CreateConVar("cac_macro", "1", "是否开启自动连跳宏检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_AutoShootEnable = CreateConVar("cac_autoshoot", "1", "是否开启自动手枪连射检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_InstantDefuseEnable = CreateConVar("cac_instantdefuse", "1", "是否开启快速拆包检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_PerfectStrafeEnable = CreateConVar("cac_perfectstrafe", "1", "是否开启完美自动连跳加速检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BacktrackFixEnable = CreateConVar("cac_backtrack", "1", "是否开启屏蔽 Backtrack", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_AHKStrafeEnable = CreateConVar("cac_ahkstrafe", "1", "是否开启 AHK 自动连跳加速检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_HourCheckEnable = CreateConVar("cac_hourcheck", "0", "是否开启游戏时间检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_HourCheckValue = CreateConVar("cac_hourcheck_value", "50", "游戏时间必须大于多少才可以加入服务器");
g_ConVar_ProfileCheckEnable = CreateConVar("cac_profilecheck", "1", "是否开启账户信息是否公开检测,开启后账户信息非公开会被踢出", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_SpeedHackEnable = CreateConVar("cac_speedhack", "1", "是否开启加速检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_ThirdESPEnable = CreateConVar("cac_thirdesp", "1", "是否开启第三人称透视检测", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_FamilySharing = CreateConVar("cac_family_sharing", "0", "是否开启禁止家庭共享的玩家加入服务器", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_MatHack = CreateConVar("cac_mathack", "1", "是否开启检查玩家的 mat_ 控制台变量", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BlockDefibIdle = CreateConVar("cac_block_defib_idle", "0", "是否开启禁止电击复活闲置", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BlockReleaseIdle = CreateConVar("cac_block_release_idle", "0", "是否开启禁止解除控制闲置", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BlockReleaseDuration = CreateConVar("cac_block_release_duration", "5.0", "禁止解除控制闲置持续时间", FCVAR_NONE, true, 0.1);
g_ConVar_BlockGasCanIdle = CreateConVar("cac_block_gascan_idle", "0", "是否开启禁止点油闲置", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BlockGasCanDuration = CreateConVar("cac_block_gascan_duration", "9.0", "禁止点油闲置持续时间", FCVAR_NONE, true, 0.1);
g_ConVar_QueryMaxTime = CreateConVar("cac_query_cvar_max_duration", "3.0", "查询 ConVar 超时时间", FCVAR_NONE, true, 0.1);
g_ConVar_QueryMaxCount = CreateConVar("cac_query_cvar_max_count", "5", "查询 ConVar 超时次数", FCVAR_NONE, true, 0.0);
g_ConVar_AimbotBanThreshold = CreateConVar("cac_aimbot_ban_threshold", "5", "检测为自瞄需要的 tick 数量");
g_ConVar_BhopBanThreshold = CreateConVar("cac_bhop_ban_threshold", "10", "检测为自动连跳需要的 tick 数量");
g_ConVar_SilentStrafeBanThreshold = CreateConVar("cac_silentstrafe_ban_threshold", "10", "检测为隐藏式自动连跳加速需要的 tick 数量");
g_ConVar_TriggerbotBanThreshold = CreateConVar("cac_triggerbot_ban_threshold", "5", "检测为自动开枪需要的 tick 数量");
g_ConVar_TriggerbotLogThreshold = CreateConVar("cac_triggerbot_log_threshold", "3", "检测自动连跳记录日志的 tick 数量");
g_ConVar_MacroLogThreshold = CreateConVar("cac_macro_log_threshold", "20", "检测自动连跳宏记录日志的 tick 数量");
g_ConVar_AutoShootLogThreshold = CreateConVar("cac_autoshoot_log_threshold", "20", "检测自动手枪连射记录日志的 tick 数量");
g_ConVar_PerfectStrafeBanThreshold = CreateConVar("cac_perfectstrafe_ban_threshold", "15", "检测为完美自动连跳加速需要的 tick 数量");
g_ConVar_PerfectStrafeLogThreshold = CreateConVar("cac_perfectstrafe_log_threshold", "10", "检测完美自动连跳加速记录日志需要的 tick 数量");
g_ConVar_AHKStrafeLogThreshold = CreateConVar("cac_ahkstrafe_log_threshold", "25", "检测为 AHK 自动连跳需要的 tick 数量");
g_ConVar_AimbotBanTime = CreateConVar("cac_aimbot_bantime", "0", "被检测到自瞄封禁多长时间");
g_ConVar_BhopBanTime = CreateConVar("cac_bhop_bantime", "10080", "被检测到自动连跳封禁多长时间");
g_ConVar_SilentStrafeBanTime = CreateConVar("cac_silentstrafe_bantime", "0", "被检测到隐藏式自动连跳加速封禁多长时间");
g_ConVar_TriggerbotBanTime = CreateConVar("cac_triggerbot_bantime", "0", "被检测到自动开枪封禁多长时间");
g_ConVar_PerfectStrafeBanTime = CreateConVar("cac_perfectstrafe_bantime", "0", "被检测到完美自动连跳加速封禁多长时间");
g_ConVar_InstantDefuseBanTime = CreateConVar("cac_instantdefuse_bantime", "0", "被检测到快速拆包封禁多长时间");
g_ConVar_BlockSpecialIdle = CreateConVar("cac_block_grabbed_idle", "1", "是否开启被控禁止闲置", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BlockVomitIdle = CreateConVar("cac_block_vomit_idle", "1", "是否开启沾到胆汁禁止闲置", FCVAR_NONE, true, 0.0, true, 1.0);
g_ConVar_BlockGrenadeIdle = CreateConVar("cac_block_grenade_idle", "1", "是否开启丢雷禁止闲置", FCVAR_NONE, true, 0.0, true, 1.0);
AutoExecConfig(true, "l4d2_CowAntiCheat");
HookEventEx("bomb_begindefuse", Event_BombBeginDefuse);
HookEventEx("bomb_defused", Event_BombDefused);
HookEventEx("player_now_it", Event_PlayerHitByVomit);
HookEventEx("jockey_ride_end", Event_PlayerReleased);
HookEventEx("charger_pummel_end", Event_PlayerReleased);
HookEventEx("tongue_release", Event_PlayerReleased);
HookEventEx("pounce_stopped", Event_PlayerReleased);
HookEventEx("defibrillator_used", Event_PlayerDefibrillator);
g_ConVar_AutoBhop = FindConVar("sv_autobunnyhopping");
g_ConVar_MaxCmdRate = FindConVar("sv_maxcmdrate");
g_ConVar_MaxUpdateRate = FindConVar("sv_maxupdaterate");
g_ConVar_VomitDuration = FindConVar("survivor_it_duration");
g_ConVar_GrenadeDuration = FindConVar("pipe_bomb_timer_duration");
g_ConVar_DefibDuration = FindConVar("defibrillator_return_to_life_time");
g_iMaxTick = RoundToCeil(1.0 / GetTickInterval() * 2.0);
for (int i = 1; i <= MaxClients; i++)
{
SetDefaults(i);
}
g_aszClientSteamId = CreateArray(255);
g_iOffsetVomitTimer = FindSendPropInfo("CTerrorPlayer", "m_itTimer") + 8;
// g_iOffsetVomitTimer += FindSendPropInfo("DT_CountdownTimer", "m_timestamp");
CreateTimer(1.5, Timer_CheckClientConVar, _, TIMER_REPEAT);
CreateTimer(3.0, Timer_CheckSteamId, _, TIMER_REPEAT);
CreateTimer(0.1, Timer_CheckTickCount, _, TIMER_REPEAT);
AddCommandListener(Command_Away, "go_away_from_keyboard");
AddCommandListener(Command_Away, "jointeam");
RegConsoleCmd("cac_version", Cmd_GetVersion);
RegAdminCmd("cac_bhopcheck", Cmd_GetBunnyHop, ADMFLAG_BAN);
#if defined _USE_DETOUR_FUNC_
InstallGascanHook();
#endif
}
#if defined _USE_DETOUR_FUNC_
Handle g_pfnGasCanKilled = null;
void InstallGascanHook()
{
Handle file = LoadGameConfigFile("l4d2_cowanticheat");
if(file == null)
{
LogError("找不到文件 l4d2_cowanticheat.txt");
return;
}
g_pfnGasCanKilled = DHookCreateDetour(Address_Null, CallConv_THISCALL, ReturnType_Void, ThisPointer_CBaseEntity);
if(g_pfnGasCanKilled == null)
{
LogError("创建 DHookCreateDetour 失败");
return;
}
if(!DHookSetFromConf(g_pfnGasCanKilled, file, SDKConf_Signature, "CGasCan::Event_Killed"))
{
LogError("加载 CGasCan::Event_Killed 失败");
g_pfnGasCanKilled = null;
file.Close();
return;
}
file.Close();
DHookAddParam(g_pfnGasCanKilled, HookParamType_ObjectPtr, -1, DHookPass_ByRef);
if(!DHookEnableDetour(g_pfnGasCanKilled, false, Hooked_GasCanKilled))
{
LogError("安装 CGasCan::Event_Killed 失败");
g_pfnGasCanKilled = null;
return;
}
}
#endif // _USE_DETOUR_FUNC_
public void OnClientPutInServer(int client)
{
SetDefaults(client);
if(IsValidClient(client))
{
if(g_ConVar_ProfileCheckEnable.BoolValue)
{
Handle request = CreateRequest_ProfileStatus(client);
SteamWorks_SendHTTPRequest(request);
}
if(g_ConVar_HourCheckEnable.BoolValue)
{
Handle request = CreateRequest_TimePlayed(client);
SteamWorks_SendHTTPRequest(request);
}
}
}
/* Command Callbacks */
public Action Cmd_GetVersion(int client, int args)
{
PrintToChat(client, "[\x02CAC\x01] 当前版本: \x05%s", PLUGIN_VERSION);
}
public Action Cmd_GetBunnyHop(int client, int args)
{
if(args < 1)
{
ReplyToCommand(client, "[SM] Usage: cac_bhopcheck <#userid|name>");
return Plugin_Handled;
}
char arg[128];
GetCmdArg(1, arg, sizeof(arg));
int target = FindTarget(client, arg, true, false);
if(!IsValidClient(target))
{
PrintToChat(client, "[\x02CAC\x01] Not a valid target!");
return Plugin_Handled;
}
PrintToChat(client, "[\x02CAC\x01] See console for output.");
PrintToConsole(client, "--------------------------------------------");
PrintToConsole(client, " %N's Detection Logs", target);
PrintToConsole(client, "--------------------------------------------");
PrintToConsole(client, "Perfect Jumps: %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",
g_iLastJumps[target][0],
g_iLastJumps[target][1],
g_iLastJumps[target][2],
g_iLastJumps[target][3],
g_iLastJumps[target][4],
g_iLastJumps[target][5],
g_iLastJumps[target][6],
g_iLastJumps[target][7],
g_iLastJumps[target][8],
g_iLastJumps[target][9],
g_iLastJumps[target][10],
g_iLastJumps[target][11],
g_iLastJumps[target][12],
g_iLastJumps[target][13],
g_iLastJumps[target][14],
g_iLastJumps[target][15],
g_iLastJumps[target][16],
g_iLastJumps[target][17],
g_iLastJumps[target][18],
g_iLastJumps[target][19],
g_iLastJumps[target][20],
g_iLastJumps[target][21],
g_iLastJumps[target][22],
g_iLastJumps[target][23],
g_iLastJumps[target][24],
g_iLastJumps[target][25],
g_iLastJumps[target][26],
g_iLastJumps[target][27],
g_iLastJumps[target][28],
g_iLastJumps[target][29]);
int perf = 0;
for (int i = 0; i < JUMP_HISTORY; i++)
{
if(g_iLastJumps[target][i] == 1)
{
perf++;
}
}
float avgPerf = perf / 30.0;
PrintToConsole(client, "Avg Perfect Jumps: %.2f%", avgPerf * 100);
PrintToConsole(client, "Jump Commands: %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",
g_iJumpsSent[target][0],
g_iJumpsSent[target][1],
g_iJumpsSent[target][2],
g_iJumpsSent[target][3],
g_iJumpsSent[target][4],
g_iJumpsSent[target][5],
g_iJumpsSent[target][6],
g_iJumpsSent[target][7],
g_iJumpsSent[target][8],
g_iJumpsSent[target][9],
g_iJumpsSent[target][10],
g_iJumpsSent[target][11],
g_iJumpsSent[target][12],
g_iJumpsSent[target][13],
g_iJumpsSent[target][14],
g_iJumpsSent[target][15],
g_iJumpsSent[target][16],
g_iJumpsSent[target][17],
g_iJumpsSent[target][18],
g_iJumpsSent[target][19],
g_iJumpsSent[target][20],
g_iJumpsSent[target][21],
g_iJumpsSent[target][22],
g_iJumpsSent[target][23],
g_iJumpsSent[target][24],
g_iJumpsSent[target][25],
g_iJumpsSent[target][26],
g_iJumpsSent[target][27],
g_iJumpsSent[target][28],
g_iJumpsSent[target][29]);
int jumps = 0;
for (int i = 0; i < JUMP_HISTORY; i++)
{
jumps += g_iJumpsSent[target][i];
}
float avgJumps = jumps / 30.0;
PrintToConsole(client, "Avg Jump Commands: %.2f", avgJumps);
return Plugin_Handled;
}
#if defined _USE_DETOUR_FUNC_
public MRESReturn Hooked_GasCanKilled(int pThis, Handle hParams)
{
int client = DHookGetParamObjectPtrVar(hParams, 1, 52, ObjectValueType_Ehandle);
if(client <= 0 || client > MaxClients || !IsClientInGame(client) || IsFakeClient(client) ||
!IsPlayerAlive(client) || GetClientTeam(client) != 2)
return MRES_Ignored;
g_fGasCanTimer[client] = GetGameTime() + g_ConVar_BlockGasCanDuration.FloatValue;
return MRES_Ignored;
}
#endif
public Action Command_Away(int client, const char[] command, int argc)
{
if(client <= 0 || client > MaxClients || !IsClientInGame(client) || IsFakeClient(client) ||
!IsPlayerAlive(client) || GetClientTeam(client) != 2)
return Plugin_Continue;
float time = GetGameTime();
if(g_ConVar_BlockSpecialIdle.BoolValue)
{
if(GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker") > 0 ||
GetEntPropEnt(client, Prop_Send, "m_pummelAttacker") > 0 ||
GetEntPropEnt(client, Prop_Send, "m_pounceAttacker") > 0 ||
GetEntPropEnt(client, Prop_Send, "m_tongueOwner") > 0 ||
GetEntPropEnt(client, Prop_Send, "m_carryAttacker") > 0)
{
PrintToChat(client, "\x03[CAE]\x01 被控禁止 闲置/切换队伍。");
return Plugin_Handled;
}
}
if(g_ConVar_BlockReleaseIdle.BoolValue)
{
if(g_fReleasedTimer[client] > time)
{
PrintToChat(client, "\x03[CAE]\x01 被控释放禁止 闲置/切换队伍。");
return Plugin_Handled;
}
}
if(g_ConVar_BlockVomitIdle.BoolValue)
{
if(GetEntDataFloat(client, g_iOffsetVomitTimer) > time)
{
PrintToChat(client, "\x03[CAE]\x01 沾上胆汁禁止 闲置/切换队伍。");
return Plugin_Handled;
}
if(g_fVomitFadeTimer[client] > time)
{
PrintToChat(client, "\x03[CAE]\x01 沾上胆汁禁止 闲置/切换队伍。");
return Plugin_Handled;
}
}
if(g_ConVar_BlockGrenadeIdle.BoolValue)
{
int weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if(weapon > MaxClients && IsValidEntity(weapon) &&
GetEntProp(weapon, Prop_Send, "m_iClip1") == 0)
{
char classname[64];
GetEntityClassname(weapon, classname, 64);
if(StrEqual("weapon_molotov", classname, false) ||
StrEqual("weapon_pipe_bomb", classname, false) ||
StrEqual("weapon_vomitjar", classname, false))
{
PrintToChat(client, "\x03[CAE]\x01 丢雷禁止 闲置/切换队伍。");
return Plugin_Handled;
}
}
if(g_fGrenadeExplodeTimer[client] > time)
{
PrintToChat(client, "\x03[CAE]\x01 丢雷禁止 闲置/切换队伍。");
return Plugin_Handled;
}
}
if(g_ConVar_BlockDefibIdle.BoolValue)
{
if(g_fDefibrillatorTimer[client] > time)
{
PrintToChat(client, "\x03[CAE]\x01 电击复活禁止 闲置/切换队伍。");
return Plugin_Handled;
}
}
if(g_ConVar_BlockGasCanIdle.BoolValue)
{
if(g_fGasCanTimer[client] > time)
{
PrintToChat(client, "\x03[CAE]\x01 禁止点燃油桶闲置。");
return Plugin_Handled;
}
}
ClientCommand(client, "cl_consistencycheck");
return Plugin_Continue;
}
/* Get Player Settings */
public Action Timer_CheckClientConVar(Handle timer)
{
float time = GetGameTime();
for (int i = 1; i <= MaxClients; i++)
{
if(IsValidClient(i) && IsPlayerAlive(i) && !IsFakeClient(i))
{
// 一秒重置一次
// if(g_fSendMoveSecond[i] <= time)
{
g_iSendMoveCalled[i] = 0;
g_bHasThirdChecked[i] = false;
g_fSendMoveSecond[i] = time + 1.0;
}
QueryClientConVar(i, "sensitivity", ConVar_QueryClient, i);
QueryClientConVar(i, "m_yaw", ConVar_QueryClient, i);
QueryClientConVar(i, "c_thirdpersonshoulder", ConVar_QueryClient, i);
QueryClientConVar(i, "cl_cmdrate", ConVar_QueryClient, i);
if(g_ConVar_MatHack.BoolValue)
{
QueryClientConVar(i, "mat_queue_mode", ConVar_QueryClient, i);
QueryClientConVar(i, "mat_hdr_level", ConVar_QueryClient, i);
QueryClientConVar(i, "mat_postprocess_enable", ConVar_QueryClient, i);
QueryClientConVar(i, "r_drawothermodels", ConVar_QueryClient, i);
QueryClientConVar(i, "cl_drawshadowtexture", ConVar_QueryClient, i);
QueryClientConVar(i, "mat_fullbright", ConVar_QueryClient, i);
}
if(g_ConVar_QueryMaxCount.IntValue > 0)
g_hTimerQueryTimeout[i] = CreateTimer(g_ConVar_QueryMaxTime.FloatValue, Timer_QueryConVarTimeout, i);
}
}
}
public Action Timer_QueryConVarTimeout(Handle timer, any client)
{
g_hTimerQueryTimeout[client] = null;
g_iQueryTimeout[client] += 1;
if(!IsValidClient(client))
return Plugin_Stop;
int maxQueryCount = g_ConVar_QueryMaxCount.IntValue;
if(maxQueryCount > 0 && g_iQueryTimeout[client] > maxQueryCount)
if(!(GetUserFlagBits(client) & ADMFLAG_ROOT))
KickClient(client, "查询 ConVar 失败,请重启游戏\nQuery ConVar Timeout");
return Plugin_Continue;
}
public void ConVar_QueryClient(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue)
{
if(IsValidClient(client))
{
if(result == ConVarQuery_Okay)
{
if(StrEqual("sensitivity", cvarName))
{
g_Sensitivity[client] = StringToFloat(cvarValue);
}
else if(StrEqual("m_yaw", cvarName))
{
g_mYaw[client] = StringToFloat(cvarValue);
}
else if(StrEqual("c_thirdpersonshoulder", cvarName))
{
if(StringToInt(cvarValue) > 0)
g_bThirdPersonEnabled[client] = true;
else
g_bThirdPersonEnabled[client] = false;
}
else if(StrEqual("cl_cmdrate", cvarName))
{
g_iSendMoveRate[client] = StringToInt(cvarValue);
}
else if(StrEqual("mat_queue_mode", cvarName))
{
if(StringToInt(cvarValue) >= 3)
{
PrintToChatOther(client, "\x03[CAC]\x01 玩家 \x04%N\x01 的 \x03%s\x01 为 \x05%s\x01.", client, cvarName, cvarValue);
CowAC_Log("玩家 %N 的 ConVar %s 为 %s,不符合规范", client, cvarName, cvarValue);
KickClient(client, "隐藏 Boomer 胆汁屏幕效果\nRemove boomer vomit");
}
}
else if(StrEqual("mat_hdr_level", cvarName))
{
if(StringToInt(cvarValue) != 2)
{
PrintToChatOther(client, "\x03[CAC]\x01 玩家 \x04%N\x01 的 \x03%s\x01 为 \x05%s\x01.", client, cvarName, cvarValue);
CowAC_Log("玩家 %N 的 ConVar %s 为 %s,不符合规范", client, cvarName, cvarValue);
KickClient(client, "地图高亮\nFull Bright");
}
}
else if(StrEqual("mat_postprocess_enable", cvarName))
{
if(StringToInt(cvarValue) != 1)
{
PrintToChatOther(client, "\x03[CAC]\x01 玩家 \x04%N\x01 的 \x03%s\x01 为 \x05%s\x01.", client, cvarName, cvarValue);
CowAC_Log("玩家 %N 的 ConVar %s 为 %s,不符合规范", client, cvarName, cvarValue);
KickClient(client, "隐藏屏幕效果\nClean Screen");
}
}
else if(StrEqual("r_drawothermodels", cvarName))
{
if(StringToInt(cvarValue) != 1)
{
PrintToChatOther(client, "\x03[CAC]\x01 玩家 \x04%N\x01 的 \x03%s\x01 为 \x05%s\x01.", client, cvarName, cvarValue);
CowAC_Log("玩家 %N 的 ConVar %s 为 %s,不符合规范", client, cvarName, cvarValue);
if(cvarValue[0] == '2')
BanClient(client, 0, BANFLAG_AUTO, "[CAC] r_drawothermodels Wireframe", "线框透视\nWireframe WallHack");
else
KickClient(client, "不合理的控制台变量\nConVar violation");
}
}
else if(StrEqual("cl_drawshadowtexture", cvarName))
{
if(StringToInt(cvarValue) > 0)
{
PrintToChatOther(client, "\x03[CAC]\x01 玩家 \x04%N\x01 的 \x03%s\x01 为 \x05%s\x01.", client, cvarName, cvarValue);
CowAC_Log("玩家 %N 的 ConVar %s 为 %s,不符合规范", client, cvarName, cvarValue);
if(cvarValue[0] == '1')
BanClient(client, 0, BANFLAG_AUTO, "[CAC] cl_drawshadowtexture 3DBox", "3D 方框透视\n3DBox WallHack");
else
KickClient(client, "不合理的控制台变量\nConVar violation");
}
}
else if(StrEqual("mat_fullbright", cvarName))
{
if(StringToInt(cvarValue) > 0)
{
PrintToChatOther(client, "\x03[CAC]\x01 玩家 \x04%N\x01 的 \x03%s\x01 为 \x05%s\x01.", client, cvarName, cvarValue);
CowAC_Log("玩家 %N 的 ConVar %s 为 %s,不符合规范", client, cvarName, cvarValue);
KickClient(client, "地图高亮\nFull Bright");
}
}
}
else
{
PrintToChatOther(client, "\x03[CAC]\x01 对玩家 \x04%N\x01 进行安全验证 \x05%s\x01 失败。", client, cvarName);
switch(result)
{
case ConVarQuery_NotFound:
{
CowAC_Log("玩家 %N 查询 ConVar %s 失败:ConVarQuery_NotFound", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_NotFound", cvarName);
}
case ConVarQuery_NotValid:
{
CowAC_Log("玩家 %N 查询 ConVar %s ConVarQuery_NotValid", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_NotValid", cvarName);
}
case ConVarQuery_Protected:
{
CowAC_Log("玩家 %N 查询 ConVar %s ConVarQuery_Protected", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_Protected", cvarName);
}
default:
{
CowAC_Log("玩家 %N 查询 ConVar %s ConVarQuery_Unknown", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_Unknown", cvarName);
}
}
}
if(g_bThirdPersonEnabled[client] && !g_bHasThirdChecked[client] && g_ConVar_ThirdESPEnable.BoolValue)
{
g_bHasThirdChecked[client] = true;
QueryClientConVar(client, "cam_idealdist", ConVar_QueryThirdPerson);
QueryClientConVar(client, "c_thirdpersonshoulderheight", ConVar_QueryThirdPerson);
QueryClientConVar(client, "c_thirdpersonshoulderoffset", ConVar_QueryThirdPerson);
}
if(g_hTimerQueryTimeout[client])
{
g_iQueryTimeout[client] = 0;
KillTimer(g_hTimerQueryTimeout[client]);
g_hTimerQueryTimeout[client] = null;
}
}
}
public int SW_OnValidateClient(int ownerSteamId, int clientSteamId)
{
if(!g_ConVar_FamilySharing.BoolValue)
return 0;
char steamId[255];
FormatEx(steamId, 255, "STEAM_1:%d:%d|STEAM_1:%d:%d",
(ownerSteamId & 1), (ownerSteamId >> 1),
(clientSteamId & 1), (clientSteamId >> 1));
g_aszClientSteamId.PushString(steamId);
return 0;
}
public Action Timer_CheckSteamId(Handle timer, any data)
{
if(!g_ConVar_FamilySharing.BoolValue)
return Plugin_Continue;
char sTwo[255], sClient[2][64];
int i = 0;
for(i = 0; i < g_aszClientSteamId.Length; ++i)
{
g_aszClientSteamId.GetString(i, sTwo, 255);
ExplodeString(sTwo, "|", sClient, 2, 64);
TrimString(sClient[0]);
TrimString(sClient[1]);
int client = FindClientBySteamId(sClient[1]);
if(client == -1)
client = FindClientBySteamId(sClient[0]);
// 等待玩家加入游戏
if(client == -1)
continue;
g_aszClientSteamId.Erase(i);
i -= 1;
if(StrEqual(sClient[0], sClient[1], false))
continue;
if(client == -1)
{
PrintToServer("[CAC] 玩家 %d 的 SteamID 为 %s 游戏所有者为 %s", client, sClient[1], sClient[0]);
CowAC_Log("玩家 %d 的 SteamID 为 %s,但游戏所有者的 SteamID 为 %s", client, sClient[1], sClient[0]);
ServerCommand("kickid \"%s\" \"请不要使用家庭共享的游戏进入\nYou have been refused entry to this server due to Steam Family Sharing being detected on your account. Please reconnect using a game you own.\"", sClient[1]);
ServerCommand("kickid \"%s\" \"请不要使用家庭共享的游戏进入\nYou have been refused entry to this server due to Steam Family Sharing being detected on your account. Please reconnect using a game you own.\"", sClient[0]);
}
else
{
PrintToServer("[CAC] 玩家 %N 的 SteamID 为 %s 游戏所有者为 %s", client, sClient[1], sClient[0]);
CowAC_Log("玩家 %N 的 SteamID 为 %s,但游戏所有者的 SteamID 为 %s", client, sClient[1], sClient[0]);
if(GetUserFlagBits(client) & ADMFLAG_ROOT)
continue;
KickClient(client, "请不要使用家庭共享的游戏进入\nYou have been refused entry to this server due to Steam Family Sharing being detected on your account. Please reconnect using a game you own.");
}
}
return Plugin_Continue;
}
public Action Timer_CheckTickCount(Handle timer, any data)
{
static float fLastProcessed;
int iNewTicks = RoundToCeil((GetEngineTime() - fLastProcessed) / GetTickInterval());
float time = GetGameTime();
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
{
// Make sure latency didn't spike more than 5ms.
// We want to avoid writing a lagging client to logs.
float fLatency = GetClientLatency(i, NetFlow_Outgoing);
if (g_iTickLeft[i] <= 0 && FloatAbs(g_fPrevLatency[i] - fLatency) <= 0.005)
{
if (++g_iTickDetecton[i] >= MAX_TICK_DETECTION && time > g_fTickDetectedTime[i])
{
PrintToChatOther(i, "\x03[CAC]\x01 玩家 \x04%N\x01 移动速度过快。", i);
CowAC_Log("玩家 %N 的移动速度过快", i);
// KickClient(i, "移动速度过快\nspeedhack");
BanClient(i, g_ConVar_InstantDefuseBanTime.IntValue, BANFLAG_AUTO,
"[CAC] Speed Hack Detected.", "移动速度过快\nSpeed Hack");
g_fTickDetectedTime[i] = time + 30.0;
}
}
else if (g_iTickDetecton[i])
{
g_iTickDetecton[i]--;
}
g_fPrevLatency[i] = fLatency;
}
if ((g_iTickLeft[i] += iNewTicks) > g_iMaxTick)
{
g_iTickLeft[i] = g_iMaxTick;
}
}
fLastProcessed = GetEngineTime();
return Plugin_Continue;
}
stock int FindClientBySteamId(const char[] steamID)
{
char steamId[64];
for(int i = 1; i <= MaxClients; ++i)
{
if(!IsClientInGame(i) || IsFakeClient(i))
continue;
GetClientAuthId(i, AuthId_Steam2, steamId, 64, false);
ReplaceString(steamId, 64, "STEAM_0:", "STEAM_1:");
if(StrEqual(steamId, steamID, false))
return i;
}
return -1;
}
public void ConVar_QueryThirdPerson(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue)
{
if(!IsValidClient(client) || cookie == QUERYCOOKIE_FAILED)
return;
int value = StringToInt(cvarValue);
if(StrEqual("c_thirdpersonshoulderoffset", cvarName))
{
if(value > 50 || value < -50)
{
// 通过检测玩家的第三人称相机偏移,防止玩家通过移动相机看到墙后面的东西
PrintToAdmins("[\x02CAC\x01] 玩家 \x04%N\x01 被检测到第三人称水平偏移过大 (%d).", client, value);
CowAC_Log("玩家 %N 的参数 %s 是 %d", client, cvarName, value);
PrintToChatAll("\x03[CAC]\x01 玩家 \x05%N\x01 的 c_thirdpersonshoulderoffset 不符合规范(-50~50)。", client);
PrintHintText(client, "请将你的 c_thirdpersonshoulderoffset 设置为 -50 到 50 之间");
ChangeClientTeam(client, 1);
}
}
else if(StrEqual("c_thirdpersonshoulderheight", cvarName))
{
if(value > 25 || value < -5)
{
// 通过检测玩家的第三人称相机高度,防止玩家通过移动相机看到墙后面的东西
PrintToAdmins("[\x02CAC\x01] 玩家 \x04%N\x01 被检测到第三人垂直偏移过大 (%d).", client, value);
CowAC_Log("玩家 %N 的参数 %s 是 %d", client, cvarName, value);
PrintToChatAll("\x03[CAC]\x01 玩家 \x05%N\x01 的 c_thirdpersonshoulderheight 不符合规范(-5~25)。", client);
PrintHintText(client, "请将你的 c_thirdpersonshoulderheight 设置为 -5 到 25 之间");
ChangeClientTeam(client, 1);
}
}
else if(StrEqual("cam_idealdist", cvarName))
{
if(value > 130 || value < -30)
{
// 通过检测玩家的第三人称相机距离,防止玩家通过移动相机看到墙后面的东西
PrintToAdmins("[\x02CAC\x01] 玩家 \x04%N\x01 被检测到第三人称距离过远 (%d).", client, value);
CowAC_Log("玩家 %N 的参数 %s 是 %d", client, cvarName, value);
PrintToChatAll("\x03[CAC]\x01 玩家 \x05%N\x01 的 cam_idealdist 不符合规范(-30~130)。", client);
PrintHintText(client, "请将你的 cam_idealdist 设置为 -30 到 130 之间");
ChangeClientTeam(client, 1);
}
}
else
{
PrintToChatOther(client, "\x03[CAC]\x01 对玩家 \x04%N\x01 进行安全验证 \x05%s\x01 失败。", client, cvarName);
switch(result)
{
case ConVarQuery_NotFound:
{
CowAC_Log("玩家 %N 查询 ConVar %s 失败:ConVarQuery_NotFound", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_NotFound", cvarName);
}
case ConVarQuery_NotValid:
{
CowAC_Log("玩家 %N 查询 ConVar %s ConVarQuery_NotValid", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_NotValid", cvarName);
}
case ConVarQuery_Protected:
{
CowAC_Log("玩家 %N 查询 ConVar %s ConVarQuery_Protected", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_Protected", cvarName);
}
default:
{
CowAC_Log("玩家 %N 查询 ConVar %s ConVarQuery_Unknown", client, cvarName);
KickClient(client, "检查 ConVar 失败\n ConVarQuery_Unknown", cvarName);
}
}
}
}
public void Event_BombBeginDefuse(Handle event, const char[] name, bool dontBroadcast )
{
int client = GetClientOfUserId( GetEventInt( event, "userid" ) );
if(g_ConVar_InstantDefuseEnable.BoolValue)
{
g_fDefuseTime[client] = GetEngineTime();
}
}
public void Event_BombDefused(Handle event, const char[] name, bool dontBroadcast )
{
int client = GetClientOfUserId( GetEventInt( event, "userid" ) );
if(GetEngineTime() - g_fDefuseTime[client] < 3.5 && g_ConVar_InstantDefuseEnable.BoolValue)
{
PrintToChatOther(client, "[\x02CAC\x01] \x04%N \x01被检测到快速拆包!", client);
BanClient(client, g_ConVar_InstantDefuseBanTime.IntValue, BANFLAG_AUTO,
"[CAC] Instant Defuse Detected.", "快速拆雷\nInstant Defuse Detected");
}
}
public void Event_PlayerHitByVomit(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if(client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 2)
return;
g_fVomitFadeTimer[client] = GetGameTime() + g_ConVar_VomitDuration.FloatValue;
}
public void Event_PlayerReleased(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("victim"));
if(client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 2)
return;
g_fReleasedTimer[client] = GetGameTime() + g_ConVar_BlockReleaseDuration.FloatValue;
}
public void Event_PlayerDefibrillator(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("subject"));
if(client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 2)
return;
g_fDefibrillatorTimer[client] = GetGameTime() + g_ConVar_DefibDuration.FloatValue;
}
public void OnEntityCreated(int entity, const char[] classname)
{
if(entity <= MaxClients || entity > 2048)
return;
if(StrEqual("molotov_projectile", classname, false) ||
StrEqual("pipe_bomb_projectile", classname, false) ||
StrEqual("vomitjar_projectile", classname, false))
SDKHook(entity, SDKHook_SpawnPost, EntityHook_OnGrenadeThrown);
}
public void EntityHook_OnGrenadeThrown(int entity)
{
SDKUnhook(entity, SDKHook_SpawnPost, EntityHook_OnGrenadeThrown);
int client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
if(client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != 2)
return;
char classname[64];
GetEntityClassname(entity, classname, 64);
if(StrEqual("molotov_projectile", classname, false) ||
StrEqual("pipe_bomb_projectile", classname, false) ||
StrEqual("vomitjar_projectile", classname, false))
g_fGrenadeExplodeTimer[client] = GetGameTime() + g_ConVar_GrenadeDuration.FloatValue;