-
Notifications
You must be signed in to change notification settings - Fork 83
/
weapon-config.inc
8253 lines (6706 loc) · 220 KB
/
weapon-config.inc
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
#if defined _INC_WEAPON_CONFIG
#endinput
#endif
#define _INC_WEAPON_CONFIG
#tryinclude <open.mp>
#if !defined _INC_open_mp
#include <a_samp>
#endif
// Print debug messages in the chat and server log
#if !defined WC_DEBUG
#define WC_DEBUG false
#endif
// Print debug messages to the console but not the chat
#if !defined WC_DEBUG_SILENT
#define WC_DEBUG_SILENT false
#endif
// Max number of rejected hits (GetRejectedHit)
#if !defined WC_MAX_REJECTED_HITS
#define WC_MAX_REJECTED_HITS 15
#endif
// Max ranges for DAMAGE_TYPE_RANGE(_MULTIPLIER)
#if !defined WC_MAX_DAMAGE_RANGES
#define WC_MAX_DAMAGE_RANGES 5
#endif
// The world a player has after the death animation finished until he respawns or enters class selection
#if !defined WC_DEATH_WORLD
#define WC_DEATH_WORLD 0x00DEAD00
#endif
// The max number of entries in the damage feeds
#if !defined WC_FEED_HEIGHT
#define WC_FEED_HEIGHT 5
#endif
// Damage feeds color (which a player give to another)
#if !defined WC_FEED_GIVEN_COLOR
#define WC_FEED_GIVEN_COLOR 0x30FF50FF // light green
#endif
// Damage feeds color (which a player take from another)
#if !defined WC_FEED_TAKEN_COLOR
#define WC_FEED_TAKEN_COLOR 0x33CCFFFF // blue
#endif
// Use Incognito's streamer for custom vending machines
#if !defined WC_USE_STREAMER
#define WC_USE_STREAMER false
#endif
// For AddPlayerClass(Ex)
#if !defined WC_MAX_CLASSES
#define WC_MAX_CLASSES 320
#endif
// For SetWeaponName
#if !defined WC_MAX_WEAPON_NAME
#define WC_MAX_WEAPON_NAME 21
#endif
// For modes that always have negative cash
#if !defined WC_CUSTOM_VENDING_MACHINES
#define WC_CUSTOM_VENDING_MACHINES true
#endif
// Healthbar foreground color
#if !defined WC_HEALTH_BAR_FG_COLOR
#define WC_HEALTH_BAR_FG_COLOR 0xB4191DFF // red
#endif
// Healthbar background color
#if !defined WC_HEALTH_BAR_BG_COLOR
#define WC_HEALTH_BAR_BG_COLOR 0x5A0C0EFF // dark red
#endif
#if WC_USE_STREAMER && !defined Streamer_IncludeFileVersion
#error streamer.inc is required when WC_USE_STREAMER=true
#endif
#if !defined _INC_SKY && !defined PAWNRAKNET_INC_
// https://github.com/oscar-broman/SKY
#tryinclude <SKY>
#if !defined _INC_SKY
// https://github.com/katursis/Pawn.RakNet
#tryinclude <Pawn.RakNet>
#if !defined PAWNRAKNET_INC_
#error The SKY or Pawn.RakNet plugin is required
#endif
#endif
#endif
// y_iterate and standalone foreach support
#if !defined _Y_ITERATE_LOCAL_VERSION && !defined _FOREACH_LOCAL_VERSION
#tryinclude <YSI_Data\y_iterate>
#if !defined _Y_ITERATE_LOCAL_VERSION
#tryinclude <foreach>
#endif
#endif
// y_va is needed to pass format parameters to open.mp natives (textdraw hooks)
#if !defined _INC_y_va && defined _INC_open_mp
#tryinclude <YSI_Coding\y_va>
#endif
// Pre-hooks for hooking callbacks
#if !defined CHAIN_ORDER
#define CHAIN_ORDER() 0
#endif
#define CHAIN_HOOK(%0) forward @CO_%0();public @CO_%0(){return CHAIN_ORDER()+1;}
#define CHAIN_NEXT(%0) @CO_%0
#define CHAIN_FORWARD:%0_%2(%1)=%3; \
forward %0_%2(%1); \
public %0_%2(%1) <_ALS : _ALS_x0, _ALS : _ALS_x1> { return (%3); } \
public %0_%2(%1) <> { return (%3); }
#define CHAIN_PUBLIC:%0(%1) %0(%1) <_ALS : _ALS_go>
CHAIN_HOOK(WC)
#undef CHAIN_ORDER
#define CHAIN_ORDER CHAIN_NEXT(WC)
static stock _WC_IncludeStates() <_ALS : _ALS_x0, _ALS : _ALS_x1, _ALS : _ALS_x2, _ALS : _ALS_x3> {}
static stock _WC_IncludeStates() <_ALS : _ALS_go> {}
// Provides a way for const correctness support
// when used with the newer standard libraries
// https://github.com/pawn-lang/samp-stdlib
// https://github.com/pawn-lang/pawn-stdlib
#if !defined SAMP_CONST_CORRECT
#define WC_CONST
#else
#define WC_CONST const
#endif
#if !defined _INC_open_mp
#if !defined BULLET_HIT_TYPE
#define BULLET_HIT_TYPE: _:
#endif
#if !defined FORCE_SYNC
#define FORCE_SYNC: _:
#endif
#if !defined KEY
#define KEY: _:
#endif
#if !defined PLAYER_STATE
#define PLAYER_STATE: _:
#endif
#if !defined SPECIAL_ACTION
#define SPECIAL_ACTION: _:
#endif
#if !defined SPECTATE_MODE
#define SPECTATE_MODE: _:
#endif
#if !defined TEXT_DRAW_ALIGN
#define TEXT_DRAW_ALIGN: _:
#endif
#if !defined TEXT_DRAW_FONT
#define TEXT_DRAW_FONT: _:
#endif
#if !defined WEAPON
#define WEAPON: _:
#endif
#if !defined WEAPON_SLOT
#define WEAPON_SLOT: _:
#endif
#if !defined PlayerTextDrawBoxColour
#define PlayerTextDrawBoxColour PlayerTextDrawBoxColor
#endif
#if !defined PlayerTextDrawBackgroundColour
#define PlayerTextDrawBackgroundColour PlayerTextDrawBackgroundColor
#endif
#if !defined PlayerTextDrawColour
#define PlayerTextDrawColour PlayerTextDrawColor
#endif
#if !defined TextDrawBoxColour
#define TextDrawBoxColour TextDrawBoxColor
#endif
#if !defined TextDrawBackgroundColour
#define TextDrawBackgroundColour TextDrawBackgroundColor
#endif
#if !defined TextDrawColour
#define TextDrawColour TextDrawColor
#endif
#endif
// Given in OnInvalidWeaponDamage
enum {
WC_NO_ERROR,
WC_NO_ISSUER,
WC_NO_DAMAGED,
WC_INVALID_DAMAGE,
WC_INVALID_DISTANCE
}
// Used in SetWeaponDamage
enum {
DAMAGE_TYPE_MULTIPLIER,
DAMAGE_TYPE_STATIC,
DAMAGE_TYPE_RANGE_MULTIPLIER,
DAMAGE_TYPE_RANGE
}
// Hits displayed in the damage feeds
enum E_DAMAGE_FEED_HIT {
e_Issuer,
e_Name[MAX_PLAYER_NAME],
Float:e_Amount,
WEAPON:e_Weapon,
e_Tick
}
// Given in OnRejectedHit
enum E_REJECTED_HIT {
e_Time,
e_Hour,
e_Minute,
e_Second,
WEAPON:e_Weapon,
e_Reason,
e_Info1,
e_Info2,
e_Info3,
e_Name[MAX_PLAYER_NAME]
}
// e_Reason in E_REJECTED_HIT
enum {
HIT_NO_DAMAGEDID,
HIT_INVALID_WEAPON,
HIT_LAST_SHOT_INVALID,
HIT_MULTIPLE_PLAYERS,
HIT_MULTIPLE_PLAYERS_SHOTGUN,
HIT_DYING_PLAYER,
HIT_SAME_TEAM,
HIT_UNSTREAMED,
HIT_INVALID_HITTYPE,
HIT_BEING_RESYNCED,
HIT_NOT_SPAWNED,
HIT_OUT_OF_RANGE,
HIT_TOO_FAR_FROM_SHOT,
SHOOTING_RATE_TOO_FAST,
SHOOTING_RATE_TOO_FAST_MULTIPLE,
HIT_RATE_TOO_FAST,
HIT_RATE_TOO_FAST_MULTIPLE,
HIT_TOO_FAR_FROM_ORIGIN,
HIT_INVALID_DAMAGE,
HIT_SAME_VEHICLE,
HIT_OWN_VEHICLE,
HIT_INVALID_VEHICLE,
HIT_DISCONNECTED
}
// Must be in sync with the enum above
// Used in debug messages and GetRejectedHit
stock const g_HitRejectReasons[][] = {
"None or invalid player shot",
"Invalid weapon",
"Last shot invalid",
"One bullet hit %d players",
"Hit too many players with shotgun: %d",
"Hit a dying player",
"Hit a teammate",
"Hit someone that can't see you (not streamed in)",
"Invalid hit type: %d",
"Hit while being resynced",
"Hit when not spawned or dying",
"Hit out of range (%f > %f)",
"Hit player too far from hit position (dist %f)",
"Shooting rate too fast: %d (%d samples, max %d)",
"Shooting rate too fast: %d (%d samples, multiple weapons)",
"Hit rate too fast: %d (%d samples, max %d)",
"Hit rate too fast: %d (%d samples, multiple weapons)",
"Damage inflicted too far from current position (dist %f)",
"Invalid weapon damage (%.4f)",
"Hit a player in the same vehicle",
"Hit the vehicle you're in",
"Hit invalid vehicle: %d",
"Hit a disconnected player ID: %d"
};
// Used for SetCustomVendingMachines
#if WC_CUSTOM_VENDING_MACHINES
enum E_VENDING_MACHINE {
e_Model,
e_Interior,
Float:e_PosX,
Float:e_PosY,
Float:e_PosZ,
Float:e_RotX,
Float:e_RotY,
Float:e_RotZ,
Float:e_FrontX,
Float:e_FrontY
}
#endif
// Used to resync players that got team-knifed in lagshot mode
enum E_RESYNC_DATA {
Float:e_Health,
Float:e_Armour,
e_Skin,
e_Team,
Float:e_PosX,
Float:e_PosY,
Float:e_PosZ,
Float:e_PosA,
WEAPON:e_Weapon,
WEAPON:e_WeaponId[13],
e_WeaponAmmo[13]
}
// From OnPlayerWeaponShot
enum E_SHOT_INFO {
e_Tick,
WEAPON:e_Weapon,
e_HitType,
e_HitId,
e_Hits,
Float:e_X,
Float:e_Y,
Float:e_Z,
Float:e_OX,
Float:e_OY,
Float:e_OZ,
Float:e_HX,
Float:e_HY,
Float:e_HZ,
Float:e_Length,
bool:e_Valid
}
enum E_HIT_INFO {
e_Tick,
e_Issuer,
WEAPON:e_Weapon,
Float:e_Amount,
Float:e_Health,
Float:e_Armour,
e_Bodypart
}
enum E_SPAWN_INFO {
e_Skin,
e_Team,
Float:e_PosX,
Float:e_PosY,
Float:e_PosZ,
Float:e_Rot,
WEAPON:e_Weapon1,
e_Ammo1,
WEAPON:e_Weapon2,
e_Ammo2,
WEAPON:e_Weapon3,
e_Ammo3
}
// When a player takes or gives invalid damage (WC_* errors above)
forward OnInvalidWeaponDamage(playerid, damagedid, Float:amount, WEAPON:weaponid, bodypart, error, bool:given);
// Before damage is inflicted
forward OnPlayerDamage(&playerid, &Float:amount, &issuerid, &WEAPON:weapon, &bodypart);
// After OnPlayerDamage
forward OnPlayerDamageDone(playerid, Float:amount, issuerid, WEAPON:weapon, bodypart);
// Before the death animation is applied
forward OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time);
// When the death animation is finished and the player has been sent to respawn
forward OnPlayerDeathFinished(playerid, bool:cancelable);
// When a shot or damage given is rejected
forward OnRejectedHit(playerid, hit[E_REJECTED_HIT]);
#if WC_CUSTOM_VENDING_MACHINES
// When a player is about to use a vending machine
forward OnPlayerUseVendingMachine(playerid, &Float:health_given);
#endif
// If you have your own definitions, remove them and use these instead
#define BODY_PART_UNKNOWN 0
#define WEAPON_UNARMED (WEAPON:0)
#define WEAPON_VEHICLE_M4 (WEAPON:19)
#define WEAPON_VEHICLE_MINIGUN (WEAPON:20)
#define WEAPON_VEHICLE_ROCKETLAUNCHER (WEAPON:21)
#define WEAPON_PISTOLWHIP (WEAPON:48)
#define WEAPON_HELIBLADES (WEAPON:50)
#define WEAPON_EXPLOSION (WEAPON:51)
#define WEAPON_CARPARK (WEAPON:52)
// Possibly defined in omp-stdlib with a different value
#if defined WEAPON_UNKNOWN
#undef WEAPON_UNKNOWN
#endif
#define WEAPON_UNKNOWN (WEAPON:55)
#if !defined _INC_SKY
// Define packet IDs
const WC_PLAYER_SYNC = 207;
const WC_VEHICLE_SYNC = 200;
const WC_PASSENGER_SYNC = 211;
const WC_AIM_SYNC = 203;
// Define RPC IDs
const WC_RPC_CLEAR_ANIMATIONS = 87;
const WC_RPC_REQUEST_SPAWN = 129;
#endif
#if defined _INC_open_mp && defined PAWNRAKNET_INC_
const WC_RPC_SET_POS_FIND_Z = 13;
#endif
#if WC_DEBUG_SILENT
static s_DebugMsgBuf[512];
#define DebugMessage(%1,%2) \
format(s_DebugMsgBuf,512,%2),printf("(wc:%d) %s",%1,s_DebugMsgBuf)
#define DebugMessageRed(%1,%2) \
format(s_DebugMsgBuf,512,%2),printf("(wc:%d) WARN: %s",%1,s_DebugMsgBuf)
#define DebugMessageAll(%1) \
printf("(wc) " %1)
#define DebugMessageRedAll(%1) \
printf("(wc) WARN: " %1)
#elseif WC_DEBUG
static s_DebugMsgBuf[512];
#define DebugMessage(%1,%2) \
format(s_DebugMsgBuf,512,"(wc) " %2),SendClientMessage(%1,-1,s_DebugMsgBuf), \
format(s_DebugMsgBuf,512,%2),printf("(wc:%d) %s",%1,s_DebugMsgBuf)
#define DebugMessageRed(%1,%2) \
format(s_DebugMsgBuf,512,"(wc) " %2),SendClientMessage(%1,0xcc0000ff,s_DebugMsgBuf), \
format(s_DebugMsgBuf,512,%2),printf("(wc:%d) WARN: %s",%1,s_DebugMsgBuf)
#define DebugMessageAll(%1) \
format(s_DebugMsgBuf,512,"(wc) " %1),SendClientMessageToAll(-1,s_DebugMsgBuf), \
printf("(wc) " %1)
#define DebugMessageRedAll(%1) \
format(s_DebugMsgBuf,512,"(wc) " %1),SendClientMessageToAll(0xcc0000ff,s_DebugMsgBuf), \
printf("(wc) WARN: " %1)
#else
#define DebugMessage(%1);
#define DebugMessageRed(%1);
#define DebugMessageAll(%1);
#define DebugMessageRedAll(%1);
#endif
// Weapons allowed in OnPlayerGiveDamage
static const s_ValidDamageGiven[] = {
1, // 0 - Fist
1, // 1 - Brass knuckles
1, // 2 - Golf club
1, // 3 - Nitestick
1, // 4 - Knife
1, // 5 - Bat
1, // 6 - Shovel
1, // 7 - Pool cue
1, // 8 - Katana
1, // 9 - Chainsaw
1, // 10 - Dildo
1, // 11 - Dildo 2
1, // 12 - Vibrator
1, // 13 - Vibrator 2
1, // 14 - Flowers
1, // 15 - Cane
0, // 16 - Grenade
0, // 17 - Teargas
0, // 18 - Molotov
0, // 19 - Vehicle M4 (custom)
0, // 20 - Vehicle minigun (custom)
0, // 21 - Vehicle rocket (custom)
1, // 22 - Colt 45
1, // 23 - Silenced
1, // 24 - Deagle
1, // 25 - Shotgun
1, // 26 - Sawed-off
1, // 27 - Spas
1, // 28 - UZI
1, // 29 - MP5
1, // 30 - AK47
1, // 31 - M4
1, // 32 - Tec9
1, // 33 - Cuntgun
1, // 34 - Sniper
0, // 35 - Rocket launcher
0, // 36 - Heatseeker
0, // 37 - Flamethrower
1, // 38 - Minigun
0, // 39 - Satchel
0, // 40 - Detonator
1, // 41 - Spraycan
1, // 42 - Fire extinguisher
0, // 43 - Camera
0, // 44 - Night vision
0, // 45 - Infrared
1 // 46 - Parachute
};
// Weapons allowed in OnPlayerTakeDamage
// 2 = valid in both OnPlayerGiveDamage and OnPlayerTakeDamage
static const s_ValidDamageTaken[] = {
1, // 0 - Fist
1, // 1 - Brass knuckles
1, // 2 - Golf club
1, // 3 - Nitestick
1, // 4 - Knife
1, // 5 - Bat
1, // 6 - Shovel
1, // 7 - Pool cue
1, // 8 - Katana
1, // 9 - Chainsaw
1, // 10 - Dildo
1, // 11 - Dildo 2
1, // 12 - Vibrator
1, // 13 - Vibrator 2
1, // 14 - Flowers
1, // 15 - Cane
0, // 16 - Grenade
0, // 17 - Teargas
0, // 18 - Molotov
0, // 19 - Vehicle M4 (custom)
0, // 20 - Vehicle minigun (custom)
0, // 21 - Vehicle rocket (custom)
1, // 22 - Colt 45
1, // 23 - Silenced
1, // 24 - Deagle
1, // 25 - Shotgun
1, // 26 - Sawed-off
1, // 27 - Spas
1, // 28 - UZI
1, // 29 - MP5
1, // 30 - AK47
1, // 31 - M4
1, // 32 - Tec9
1, // 33 - Cuntgun
1, // 34 - Sniper
0, // 35 - Rocket launcher
0, // 36 - Heatseeker
2, // 37 - Flamethrower
1, // 38 - Minigun
0, // 39 - Satchel
0, // 40 - Detonator
1, // 41 - Spraycan
1, // 42 - Fire extinguisher
0, // 43 - Camera
0, // 44 - Night vision
0, // 45 - Infrared
1, // 46 - Parachute
0, // 47 - Fake pistol
0, // 48 - Pistol whip (custom)
2, // 49 - Vehicle
2, // 50 - Helicopter blades
2, // 51 - Explosion
0, // 52 - Car park (custom)
2, // 53 - Drowning
2 // 54 - Splat
};
// Default weapon damage. Connected to s_DamageType.
// Melee weapons are multipliers because the damage differs
// depending on type of punch/kick and fight style.
static Float:s_WeaponDamage[] = {
1.0, // 0 - Fist
1.0, // 1 - Brass knuckles
1.0, // 2 - Golf club
1.0, // 3 - Nitestick
1.0, // 4 - Knife
1.0, // 5 - Bat
1.0, // 6 - Shovel
1.0, // 7 - Pool cue
1.0, // 8 - Katana
1.0, // 9 - Chainsaw
1.0, // 10 - Dildo
1.0, // 11 - Dildo 2
1.0, // 12 - Vibrator
1.0, // 13 - Vibrator 2
1.0, // 14 - Flowers
1.0, // 15 - Cane
82.5, // 16 - Grenade
0.0, // 17 - Teargas
1.0, // 18 - Molotov
9.9, // 19 - Vehicle M4 (custom)
46.2, // 20 - Vehicle minigun (custom)
82.5, // 21 - Vehicle rocket (custom)
8.25, // 22 - Colt 45
13.2, // 23 - Silenced
46.2, // 24 - Deagle
3.3, // 25 - Shotgun
3.3, // 26 - Sawed-off
4.95, // 27 - Spas
6.6, // 28 - UZI
8.25, // 29 - MP5
9.9, // 30 - AK47
9.9, // 31 - M4
6.6, // 32 - Tec9
24.75, // 33 - Cuntgun
41.25, // 34 - Sniper
82.5, // 35 - Rocket launcher
82.5, // 36 - Heatseeker
1.0, // 37 - Flamethrower
46.2, // 38 - Minigun
82.5, // 39 - Satchel
0.0, // 40 - Detonator
0.33, // 41 - Spraycan
0.33, // 42 - Fire extinguisher
0.0, // 43 - Camera
0.0, // 44 - Night vision
0.0, // 45 - Infrared
0.0, // 46 - Parachute
0.0, // 47 - Fake pistol
2.64, // 48 - Pistol whip (custom)
9.9, // 49 - Vehicle
330.0, // 50 - Helicopter blades
82.5, // 51 - Explosion
1.0, // 52 - Car park (custom)
1.0, // 53 - Drowning
165.0 // 54 - Splat
};
#assert DAMAGE_TYPE_MULTIPLIER == 0
#assert DAMAGE_TYPE_STATIC == 1
// Whether the damage is multiplied by the given/taken value (0) or always the same value (1)
static s_DamageType[] = {
0, // 0 - Fist
0, // 1 - Brass knuckles
0, // 2 - Golf club
0, // 3 - Nitestick
0, // 4 - Knife
0, // 5 - Bat
0, // 6 - Shovel
0, // 7 - Pool cue
0, // 8 - Katana
0, // 9 - Chainsaw
0, // 10 - Dildo
0, // 11 - Dildo 2
0, // 12 - Vibrator
0, // 13 - Vibrator 2
0, // 14 - Flowers
0, // 15 - Cane
0, // 16 - Grenade
1, // 17 - Teargas
0, // 18 - Molotov
1, // 19 - Vehicle M4 (custom)
1, // 20 - Vehicle minigun (custom)
0, // 21 - Vehicle rocket (custom)
1, // 22 - Colt 45
1, // 23 - Silenced
1, // 24 - Deagle
1, // 25 - Shotgun
1, // 26 - Sawed-off
1, // 27 - Spas
1, // 28 - UZI
1, // 29 - MP5
1, // 30 - AK47
1, // 31 - M4
1, // 32 - Tec9
1, // 33 - Cuntgun
1, // 34 - Sniper
0, // 35 - Rocket launcher
0, // 36 - Heatseeker
0, // 37 - Flamethrower
1, // 38 - Minigun
0, // 39 - Satchel
0, // 40 - Detonator
1, // 41 - Spraycan
1, // 42 - Fire extinguisher
0, // 43 - Camera
0, // 44 - Night vision
0, // 45 - Infrared
0, // 46 - Parachute
0, // 47 - Fake pistol
1, // 48 - Pistol whip (custom)
1, // 49 - Vehicle
1, // 50 - Helicopter blades
0, // 51 - Explosion
0, // 52 - Car park (custom)
0, // 53 - Drowning
0 // 54 - Splat
};
// The default weapon range (from weapon.dat)
// Note that due to various bugs, these can be exceeded, but
// this include blocks out-of-range values.
static Float:s_WeaponRange[] = {
1.76, // 0 - Fist
1.76, // 1 - Brass knuckles
1.76, // 2 - Golf club
1.76, // 3 - Nitestick
1.76, // 4 - Knife
1.76, // 5 - Bat
1.6, // 6 - Shovel
1.76, // 7 - Pool cue
1.76, // 8 - Katana
1.76, // 9 - Chainsaw
1.76, // 10 - Dildo
1.76, // 11 - Dildo 2
1.76, // 12 - Vibrator
1.76, // 13 - Vibrator 2
1.76, // 14 - Flowers
1.76, // 15 - Cane
40.0, // 16 - Grenade
40.0, // 17 - Teargas
40.0, // 18 - Molotov
90.0, // 19 - Vehicle M4 (custom)
75.0, // 20 - Vehicle minigun (custom)
0.0, // 21 - Vehicle rocket (custom)
35.0, // 22 - Colt 45
35.0, // 23 - Silenced
35.0, // 24 - Deagle
40.0, // 25 - Shotgun
35.0, // 26 - Sawed-off
40.0, // 27 - Spas
35.0, // 28 - UZI
45.0, // 29 - MP5
70.0, // 30 - AK47
90.0, // 31 - M4
35.0, // 32 - Tec9
100.0, // 33 - Cuntgun
320.0, // 34 - Sniper
55.0, // 35 - Rocket launcher
55.0, // 36 - Heatseeker
5.1, // 37 - Flamethrower
75.0, // 38 - Minigun
40.0, // 39 - Satchel
25.0, // 40 - Detonator
6.1, // 41 - Spraycan
10.1, // 42 - Fire extinguisher
100.0, // 43 - Camera
100.0, // 44 - Night vision
100.0, // 45 - Infrared
1.76 // 46 - Parachute
};
// The fastest possible gap between weapon shots in milliseconds
static s_MaxWeaponShootRate[] = {
250, // 0 - Fist
250, // 1 - Brass knuckles
250, // 2 - Golf club
250, // 3 - Nitestick
250, // 4 - Knife
250, // 5 - Bat
250, // 6 - Shovel
250, // 7 - Pool cue
250, // 8 - Katana
30, // 9 - Chainsaw
250, // 10 - Dildo
250, // 11 - Dildo 2
250, // 12 - Vibrator
250, // 13 - Vibrator 2
250, // 14 - Flowers
250, // 15 - Cane
0, // 16 - Grenade
0, // 17 - Teargas
0, // 18 - Molotov
90, // 19 - Vehicle M4 (custom)
20, // 20 - Vehicle minigun (custom)
0, // 21 - Vehicle rocket (custom)
160, // 22 - Colt 45
120, // 23 - Silenced
120, // 24 - Deagle
800, // 25 - Shotgun
120, // 26 - Sawed-off
120, // 27 - Spas
50, // 28 - UZI
90, // 29 - MP5
90, // 30 - AK47
90, // 31 - M4
50, // 32 - Tec9
800, // 33 - Cuntgun
800, // 34 - Sniper
0, // 35 - Rocket launcher
0, // 36 - Heatseeker
0, // 37 - Flamethrower
20, // 38 - Minigun
0, // 39 - Satchel
0, // 40 - Detonator
10, // 41 - Spraycan
10, // 42 - Fire extinguisher
0, // 43 - Camera
0, // 44 - Night vision
0, // 45 - Infrared
0, // 46 - Parachute
0, // 47 - Fake pistol
400 // 48 - Pistol whip (custom)
};
// Whether the damage is applied directly to health (1) or is distributed between health and armour (0), and whether this rule applies only to the torso (1) or not (0)
static s_DamageArmour[][2] = {
{0, 0}, // 0 - Fist
{0, 0}, // 1 - Brass knuckles
{0, 0}, // 2 - Golf club
{0, 0}, // 3 - Nitestick
{0, 0}, // 4 - Knife
{0, 0}, // 5 - Bat
{0, 0}, // 6 - Shovel
{0, 0}, // 7 - Pool cue
{0, 0}, // 8 - Katana
{0, 0}, // 9 - Chainsaw
{0, 0}, // 10 - Dildo
{0, 0}, // 11 - Dildo 2
{0, 0}, // 12 - Vibrator
{0, 0}, // 13 - Vibrator 2
{0, 0}, // 14 - Flowers
{0, 0}, // 15 - Cane
{0, 0}, // 16 - Grenade
{0, 0}, // 17 - Teargas
{0, 0}, // 18 - Molotov
{1, 1}, // 19 - Vehicle M4 (custom)
{1, 1}, // 20 - Vehicle minigun (custom)
{0, 0}, // 21 - Vehicle rocket (custom)
{1, 1}, // 22 - Colt 45
{1, 1}, // 23 - Silenced
{1, 1}, // 24 - Deagle
{1, 1}, // 25 - Shotgun
{1, 1}, // 26 - Sawed-off
{1, 1}, // 27 - Spas
{1, 1}, // 28 - UZI
{1, 1}, // 29 - MP5
{1, 1}, // 30 - AK47
{1, 1}, // 31 - M4
{1, 1}, // 32 - Tec9
{1, 1}, // 33 - Cuntgun
{1, 1}, // 34 - Sniper
{0, 0}, // 35 - Rocket launcher
{0, 0}, // 36 - Heatseeker
{0, 0}, // 37 - Flamethrower
{1, 1}, // 38 - Minigun
{0, 0}, // 39 - Satchel
{0, 0}, // 40 - Detonator
{0, 0}, // 41 - Spraycan
{0, 0}, // 42 - Fire extinguisher
{1, 0}, // 43 - Camera
{1, 0}, // 44 - Night vision
{1, 0}, // 45 - Infrared
{1, 0}, // 46 - Parachute
{1, 0}, // 47 - Fake pistol
{0, 0}, // 48 - Pistol whip (custom)
{0, 0}, // 49 - Vehicle
{0, 1}, // 50 - Helicopter blades
{0, 0}, // 51 - Explosion
{0, 0}, // 52 - Car park (custom)
{0, 0}, // 53 - Drowning
{0, 0} // 54 - Splat
};
// That's right, it's called cuntgun
stock const g_WeaponName[57][WC_MAX_WEAPON_NAME] = {
{"Fist" }, {"Brass knuckles"}, {"Golf club" },
{"Nightstick" }, {"Knife" }, {"Bat" },
{"Shovel" }, {"Pool cue" }, {"Katana" },
{"Chainsaw" }, {"Purple dildo" }, {"Dildo" },
{"Vibrator" }, {"Vibrator" }, {"Flowers" },
{"Cane" }, {"Grenade" }, {"Tear gas" },
{"Molotov" }, {"Vehicle gun" }, {"Vehicle gun" },
{"Vehicle gun" }, {"Colt 45" }, {"Silenced pistol" },
{"Deagle" }, {"Shotgun" }, {"Sawn-off shotgun" },
{"Combat shotgun" }, {"Mac-10" }, {"MP5" },
{"AK-47" }, {"M4" }, {"Tec-9" },
{"Cuntgun" }, {"Sniper" }, {"Rocket launcher" },
{"Heat seeking RPG" }, {"Flamethrower" }, {"Minigun" },
{"Satchel" }, {"Detonator" }, {"Spraycan" },
{"Fire extinguisher"}, {"Camera" }, {"Night vision goggles"},
{"Infrared goggles" }, {"Parachute" }, {"Fake pistol" },
{"Pistol whip" }, {"Vehicle" }, {"Helicopter blades" },
{"Explosion" }, {"Car parking" }, {"Drowning" },
{"Collision" }, {"Splat" }, {"Unknown" }
};
// Yes - this is every single one of them
#if WC_CUSTOM_VENDING_MACHINES
static const Float:sc_VendingMachines[][E_VENDING_MACHINE] = {
{955, 0, -862.82, 1536.60, 21.98, 0.00, 0.00, 180.00, -862.84, 1537.60},
{956, 0, 2271.72, -76.46, 25.96, 0.00, 0.00, 0.00, 2271.72, -77.46},
{955, 0, 1277.83, 372.51, 18.95, 0.00, 0.00, 64.00, 1278.73, 372.07},
{956, 0, 662.42, -552.16, 15.71, 0.00, 0.00, 180.00, 662.41, -551.16},
{955, 0, 201.01, -107.61, 0.89, 0.00, 0.00, 270.00, 200.01, -107.63},
{955, 0, -253.74, 2597.95, 62.24, 0.00, 0.00, 90.00, -252.74, 2597.95},
{956, 0, -253.74, 2599.75, 62.24, 0.00, 0.00, 90.00, -252.74, 2599.75},
{956, 0, -76.03, 1227.99, 19.12, 0.00, 0.00, 90.00, -75.03, 1227.99},
{955, 0, -14.70, 1175.35, 18.95, 0.00, 0.00, 180.00, -14.72, 1176.35},
{1977, 7, 316.87, -140.35, 998.58, 0.00, 0.00, 270.00, 315.87, -140.36},
{1775, 17, 373.82, -178.14, 1000.73, 0.00, 0.00, 0.00, 373.82, -179.14},
{1776, 17, 379.03, -178.88, 1000.73, 0.00, 0.00, 270.00, 378.03, -178.90},
{1775, 17, 495.96, -24.32, 1000.73, 0.00, 0.00, 180.00, 495.95, -23.32},
{1776, 17, 500.56, -1.36, 1000.73, 0.00, 0.00, 0.00, 500.56, -2.36},
{1775, 17, 501.82, -1.42, 1000.73, 0.00, 0.00, 0.00, 501.82, -2.42},
{956, 0, -1455.11, 2591.66, 55.23, 0.00, 0.00, 180.00, -1455.13, 2592.66},
{955, 0, 2352.17, -1357.15, 23.77, 0.00, 0.00, 90.00, 2353.17, -1357.15},
{955, 0, 2325.97, -1645.13, 14.21, 0.00, 0.00, 0.00, 2325.97, -1646.13},
{956, 0, 2139.51, -1161.48, 23.35, 0.00, 0.00, 87.00, 2140.51, -1161.53},
{956, 0, 2153.23, -1016.14, 62.23, 0.00, 0.00, 127.00, 2154.03, -1015.54},
{955, 0, 1928.73, -1772.44, 12.94, 0.00, 0.00, 90.00, 1929.73, -1772.44},
{1776, 1, 2222.36, 1602.64, 1000.06, 0.00, 0.00, 90.00, 2223.36, 1602.64},
{1775, 1, 2222.20, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2223.20, 1606.77},
{1775, 1, 2155.90, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2156.90, 1606.77},
{1775, 1, 2209.90, 1607.19, 1000.05, 0.00, 0.00, 270.00, 2208.90, 1607.17},
{1776, 1, 2155.84, 1607.87, 1000.06, 0.00, 0.00, 90.00, 2156.84, 1607.87},
{1776, 1, 2202.45, 1617.00, 1000.06, 0.00, 0.00, 180.00, 2202.43, 1618.00},
{1776, 1, 2209.24, 1621.21, 1000.06, 0.00, 0.00, 0.00, 2209.24, 1620.21},
{1776, 3, 330.67, 178.50, 1020.07, 0.00, 0.00, 0.00, 330.67, 177.50},
{1776, 3, 331.92, 178.50, 1020.07, 0.00, 0.00, 0.00, 331.92, 177.50},
{1776, 3, 350.90, 206.08, 1008.47, 0.00, 0.00, 90.00, 351.90, 206.08},
{1776, 3, 361.56, 158.61, 1008.47, 0.00, 0.00, 180.00, 361.54, 159.61},
{1776, 3, 371.59, 178.45, 1020.07, 0.00, 0.00, 0.00, 371.59, 177.45},
{1776, 3, 374.89, 188.97, 1008.47, 0.00, 0.00, 0.00, 374.89, 187.97},
{1775, 2, 2576.70, -1284.43, 1061.09, 0.00, 0.00, 270.00, 2575.70, -1284.44},
{1775, 15, 2225.20, -1153.42, 1025.90, 0.00, 0.00, 270.00, 2224.20, -1153.43},
{955, 0, 1154.72, -1460.89, 15.15, 0.00, 0.00, 270.00, 1153.72, -1460.90},
{956, 0, 2480.85, -1959.27, 12.96, 0.00, 0.00, 180.00, 2480.84, -1958.27},
{955, 0, 2060.11, -1897.64, 12.92, 0.00, 0.00, 0.00, 2060.11, -1898.64},
{955, 0, 1729.78, -1943.04, 12.94, 0.00, 0.00, 0.00, 1729.78, -1944.04},
{956, 0, 1634.10, -2237.53, 12.89, 0.00, 0.00, 0.00, 1634.10, -2238.53},
{955, 0, 1789.21, -1369.26, 15.16, 0.00, 0.00, 270.00, 1788.21, -1369.28},
{956, 0, -2229.18, 286.41, 34.70, 0.00, 0.00, 180.00, -2229.20, 287.41},
{955, 256, -1980.78, 142.66, 27.07, 0.00, 0.00, 270.00, -1981.78, 142.64},
{955, 256, -2118.96, -423.64, 34.72, 0.00, 0.00, 255.00, -2119.93, -423.40},
{955, 256, -2118.61, -422.41, 34.72, 0.00, 0.00, 255.00, -2119.58, -422.17},
{955, 256, -2097.27, -398.33, 34.72, 0.00, 0.00, 180.00, -2097.29, -397.33},
{955, 256, -2092.08, -490.05, 34.72, 0.00, 0.00, 0.00, -2092.08, -491.05},
{955, 256, -2063.27, -490.05, 34.72, 0.00, 0.00, 0.00, -2063.27, -491.05},
{955, 256, -2005.64, -490.05, 34.72, 0.00, 0.00, 0.00, -2005.64, -491.05},
{955, 256, -2034.46, -490.05, 34.72, 0.00, 0.00, 0.00, -2034.46, -491.05},
{955, 256, -2068.56, -398.33, 34.72, 0.00, 0.00, 180.00, -2068.58, -397.33},
{955, 256, -2039.85, -398.33, 34.72, 0.00, 0.00, 180.00, -2039.86, -397.33},
{955, 256, -2011.14, -398.33, 34.72, 0.00, 0.00, 180.00, -2011.15, -397.33},
{955, 2048, -1350.11, 492.28, 10.58, 0.00, 0.00, 90.00, -1349.11, 492.28},
{956, 2048, -1350.11, 493.85, 10.58, 0.00, 0.00, 90.00, -1349.11, 493.85},
{955, 0, 2319.99, 2532.85, 10.21, 0.00, 0.00, 0.00, 2319.99, 2531.85},
{956, 0, 2845.72, 1295.04, 10.78, 0.00, 0.00, 0.00, 2845.72, 1294.04},
{955, 0, 2503.14, 1243.69, 10.21, 0.00, 0.00, 180.00, 2503.12, 1244.69},
{956, 0, 2647.69, 1129.66, 10.21, 0.00, 0.00, 0.00, 2647.69, 1128.66},
{1209, 0, -2420.21, 984.57, 44.29, 0.00, 0.00, 90.00, -2419.21, 984.57},
{1302, 0, -2420.17, 985.94, 44.29, 0.00, 0.00, 90.00, -2419.17, 985.94},
{955, 0, 2085.77, 2071.35, 10.45, 0.00, 0.00, 90.00, 2086.77, 2071.35},
{956, 0, 1398.84, 2222.60, 10.42, 0.00, 0.00, 180.00, 1398.82, 2223.60},
{956, 0, 1659.46, 1722.85, 10.21, 0.00, 0.00, 0.00, 1659.46, 1721.85},
{955, 0, 1520.14, 1055.26, 10.00, 0.00, 0.00, 270.00, 1519.14, 1055.24},
{1775, 6, -19.03, -57.83, 1003.63, 0.00, 0.00, 180.00, -19.05, -56.83},
{1775, 18, -16.11, -91.64, 1003.63, 0.00, 0.00, 180.00, -16.13, -90.64},
{1775, 16, -15.10, -140.22, 1003.63, 0.00, 0.00, 180.00, -15.11, -139.22},
{1775, 17, -32.44, -186.69, 1003.63, 0.00, 0.00, 180.00, -32.46, -185.69},
{1775, 16, -35.72, -140.22, 1003.63, 0.00, 0.00, 180.00, -35.74, -139.22},
{1776, 6, -36.14, -57.87, 1003.63, 0.00, 0.00, 180.00, -36.16, -56.87},
{1776, 18, -17.54, -91.71, 1003.63, 0.00, 0.00, 180.00, -17.56, -90.71},
{1776, 16, -16.53, -140.29, 1003.63, 0.00, 0.00, 180.00, -16.54, -139.29},
{1776, 17, -33.87, -186.76, 1003.63, 0.00, 0.00, 180.00, -33.89, -185.76}
};
#endif
// Sorry about the mess..
static s_LagCompMode;
static WEAPON:s_LastExplosive[MAX_PLAYERS];
static s_LastShot[MAX_PLAYERS][E_SHOT_INFO];
static s_LastShotTicks[MAX_PLAYERS][10];
static s_LastShotWeapons[MAX_PLAYERS][10];
static s_LastShotIdx[MAX_PLAYERS];
static s_LastHitTicks[MAX_PLAYERS][10];
static s_LastHitWeapons[MAX_PLAYERS][10];
static s_LastHitIdx[MAX_PLAYERS];
static s_ShotsFired[MAX_PLAYERS];
static s_HitsIssued[MAX_PLAYERS];
static s_MaxShootRateSamples = 4;
static s_MaxHitRateSamples = 4;
static Float:s_PlayerMaxHealth[MAX_PLAYERS] = {100.0, ...};
static Float:s_PlayerHealth[MAX_PLAYERS] = {100.0, ...};
static Float:s_PlayerMaxArmour[MAX_PLAYERS] = {100.0, ...};
static Float:s_PlayerArmour[MAX_PLAYERS] = {0.0, ...};
static s_LastSentHealth[MAX_PLAYERS];
static s_LastSentArmour[MAX_PLAYERS];
static bool:s_DamageArmourToggle[2] = {false, ...};
static s_PlayerTeam[MAX_PLAYERS] = {NO_TEAM, ...};
static s_IsDying[MAX_PLAYERS];
static s_DeathTimer[MAX_PLAYERS];