-
Notifications
You must be signed in to change notification settings - Fork 5
/
fixes.inc
5665 lines (5245 loc) · 193 KB
/
fixes.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
/*
* ===============
* INTRODUCTION:
* ===============
*
* fixes.inc - Community patch for buggy SA:MP functions.
*
* ================
* LIST OF FIXES:
* ================
*
* FIX: GetPlayerColor
* PROBLEM: Returns "0" if "SetPlayerColor" has never been called.
* SOLUTION: Call "SetPlayerColor" in "OnPlayerConnect".
* SEE: "OnPlayerConnect".
* AUTHOR: KoczkaHUN
* POST: http://forum.sa-mp.com/showpost.php?p=1486048
*
* FIX: FILTERSCRIPT
* PROBLEM: Despite the fact that is in every new script, many people don't
* define "FILTERSCRIPT" where appropriate.
* SOLUTION: Provide an "IS_FILTERSCRIPT" variable (note the naming to match
* the original macro).
* AUTHOR: Y_Less
* SEE: "OnFilterScriptInit" and "OnGameModeInit".
*
* FIX: SpawnPlayer
* PROBLEM: Kills the player if they are in a vehicle.
* SOLUTION: Remove the from the vehicle.
* SEE: "FIXES_SpawnPlayer".
* AUTHOR: Y_Less
*
* FIX: SetPlayerName
* PROBLEM: Using "SetPlayerName" when the new name only differs from the old
* name in case does not alter the name at all.
* SOLUTION: Change their name twice - once to "_FIXES TEMP NAME" and then to
* the actual required name.
* SEE: "OnPlayerConnect" and "FIXES_SetPlayerName".
* AUTHOR: Y_Less/Slice
*
* FIX: GetPlayerSkin
* PROBLEM: Returns the new skin after "SetSpawnInfo" is called but before the
* player actually respawns to get the new skin.
* SOLUTION: Record the skin in "OnPlayerSpawn" and always return that one.
* SEE: "OnPlayerSpawn", "FIXES_GetPlayerSkin" and "FIXES_SetPlayerSkin".
* AUTHOR: Y_Less
*
* FIX: GetWeaponName
* PROBLEM: Returns nothing for 18, 44, and 45.
* SOLUTION: Return the correct names ("Molotov Cocktail", "Thermal Goggles",
* and "Night vision Goggles").
* SEE: "FIXES_GetWeaponName".
* AUTHOR: Y_Less
*
* FIX: SetPlayerWorldBounds
* PROBLEM: Aiming can bypass the edge.
* SOLUTION: Check for the player leaving the area and reset them to their last
* good position if they leave the area (aiming or not).
* SEE: "OnPlayerUpdate" and "FIXES_SetPlayerWorldBounds".
* AUTHOR: Y_Less
*
* FIX: TogglePlayerControllable
* PROBLEM: Other players see you moving on the spot.
* SOLUTION: Return 0 in OnPlayerUpdate.
* SEE: "FIXES_TogglePlayerControllable" and "OnPlayerUpdate".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=876854
*
* FIX: HydraSniper
* PROBLEM: Entring military aircraft with a sniper rifle messes up vies.
* SOLUTION: Set their armed weapon to fists.
* SEE: "OnPlayerStateChange", "FIXES_GivePlayerWeapon",
* "FIXES_SetPlayerArmedWeapon".
* AUTHOR: funky1234
* POST: http://forum.sa-mp.com/showpost.php?p=965644
*
* FIX: IsPlayerInCheckpoint
* PROBLEM: Function returns an undefined value if it is called before any
* other checkpoint functions are called to initialise the value.
* SOLUTION: Call "DisablePlayerCheckpoint" when they connect.
* SEE: "OnPlayerConnect".
* AUTHOR: Y_Less
*
* FIX: IsPlayerInRaceCheckpoint
* PROBLEM: Function returns an undefined value if it is called before any
* other race checkpoint functions are called to initialise the value.
* SOLUTION: Call "DisablePlayerRaceCheckpoint" when they connect.
* SEE: "OnPlayerConnect".
* AUTHOR: Y_Less
*
* FIX: GetPlayerWeapon
* PROBLEM: Returns the old value after using "SetPlayerArmedWeapon" when they
* are in a vehicle.
* SOLUTION: If "SetPlayerArmedWeapon" is called in a vehicle, store the new
* value and return that instead.
* SEE: "OnPlayerStateChange", "FIXES_SetPlayerArmedWeapon", and
* "FIXES_GetPlayerWeapon".
* AUTHOR: Y_Less
*
* FIX: PutPlayerInVehicle
* PROBLEM: If this is used on a passenger the driver of their old vehicle
* doesn't see them in their new vehicle.
* SOLUTION: Remove them from the vehicle first.
* SEE: "OnPlayerStateChange" and "FIXES_PutPlayerInVehicle".
* AUTHOR: leong124/Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1265965
*
* FIX: KEY_AIM
* PROBLEM: "KEY_AIM" isn't defined by default.
* SOLUTION: Define it.
* SEE: N/A.
* AUTHOR: Y_Less
*
* FIX: SetPlayerCheckpoint
* PROBLEM: If a checkpoint is already set it will use the size of that
* checkpoint instead of the new one.
* SOLUTION: Call "DisablePlayerCheckpoint" before setting the checkpoint.
* SEE: "FIXES_SetPlayerCheckpoint".
* AUTHOR: KoczkaHUN
* POST: http://forum.sa-mp.com/showpost.php?p=1482401
*
* FIX: SetPlayerRaceCheckpoint
* PROBLEM: If a checkpoint is already set it will use the size of that
* checkpoint instead of the new one.
* SOLUTION: Call "DisablePlayerRaceCheckpoint" before setting the checkpoint.
* SEE: "FIXES_SetPlayerRaceCheckpoint".
* AUTHOR: KoczkaHUN
* POST: http://forum.sa-mp.com/showpost.php?p=1482401
*
* FIX: TextDrawCreate
* PROBLEM: Crashes on a blank string.
* SOLUTION: Intercept blank strings.
* SEE: "FIXES_TextDrawCreate".
* AUTHOR: wups
* POST: http://forum.sa-mp.com/showpost.php?p=1484008
*
* FIX: TextDrawSetString
* PROBLEM: Crashes on a blank string and size greater than 1024.
* SOLUTION: Intercept blank strings and truncate long strings.
* SEE: "FIXES_TextDrawSetString".
* AUTHOR: TomTrox
* POST: http://forum.sa-mp.com/showpost.php?p=1487870
*
* FIX: AllowInteriorWeapons
* PROBLEM: Does nothing.
* SOLUTION: Set the player's weapon to fists in an interior.
* SEE: "FIXES_AllowInteriorWeapons", "OnGameModeInit" and
* "OnPlayerUpdate".
* AUTHOR: KoczkaHUN
* POST: http://forum.sa-mp.com/showpost.php?p=1502696
*
* FIX: OnPlayerEnterVehicle
* PROBLEM: Crashes other players when people enter an invalid seat.
* SOLUTION: Desync the people with invalid seats.
* SEE: "OnPlayerStateChange" and "OnPlayerUpdate".
* AUTHOR: RyDeR`/Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1410296
*
* FIX: OnPlayerEnterVehicle_2
* PROBLEM: Crashes the server when hacks enter an invalid vehicle.
* SOLUTION: Desync the people with invalid vehicles.
* SEE: "OnPlayerEnterVehicle".
* AUTHOR: im/Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=2340900
*
* FIX: AllowTeleport
* PROBLEM: 0.3dRC9 removed "AllowPlayerTeleport" and "AllowAdminTeleport" in
* favour of "OnPlayerClickMap". Some scripts used the old code and.
* SOLUTION: Teleport the player in "OnPlayerClickMap".
* SEE: "OnPlayerClickMap", "FIXES_AllowPlayerTeleport", and
* "FIXES_AllowAdminTeleport".
* AUTHOR: Y_Less
*
* FIX: SetPlayerSpecialAction
* PROBLEM: Removing jetpacks from players by setting their special action to 0
* causes the sound to stay until death.
* SOLUTION: Call "ClearAnimations" before "SetPlayerSpecialAction".
* SEE: "FIXES_SetPlayerSpecialAction".
* AUTHOR: MP2
* POST: Private message from MP2.
*
* FIX: OnDialogResponse
* PROBLEM: Cheaters can spoof the dialogid they are using to respond to ones
* they can't actually see.
* SOLUTION: Store the displayed dialogid and use that instead.
* SEE: "FIXES_OnDialogResponse", "FIXES_ShowPlayerDialog".
* AUTHOR: Y_Less
* FIXED IN: 0.3e RC6
*
* FIX: GetPlayerDialog
* PROBLEM: This function doesn't exist. Fixed for hidden dialogs.
* SOLUTION: Add it. DEFAULTS TO FALSE!
* SEE: "FIXES_GetPlayerDialog".
* AUTHOR: Y_Less/xX_Simon_Xx
* POST: http://forum.sa-mp.com/showpost.php?p=2141254
*
* FIX: SetSpawnInfo
* PROBLEM: Kicks the player if "SpawnPlayer" is called before "SetSpawnInfo".
* SOLUTION: Call "SetSpawnInfo" at least once.
* SEE: "OnPlayerConnect".
* AUTHOR: Y_Less
*
* FIX: SetPlayerSkin
* PROBLEM: Breaks sitting on bikes.
* SOLUTION: Put them back in the vehicle after setting their skin.
* SEE: "FIXES_SetPlayerSkin".
* AUTHOR: CyNiC
* POST: http://forum.sa-mp.com/showpost.php?p=1756094
*
* FIX: HideMenuForPlayer
* PROBLEM: Crashes when passed an invalid menu ID.
* SOLUTION: Don't hide it when passed an invalid menu.
* SEE: "FIXES_HideMenuForPlayer".
* AUTHOR: Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1787297
*
* FIX: valstr
* PROBLEM: Crashes on large numbers.
* SOLUTION: Use "format" instead.
* SEE: "FIXES_valstr".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fclose
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fclose".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fwrite
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fwrite".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fread
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fread".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fputchar
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fputchar".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fgetchar
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fgetchar".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fblockwrite
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fblockwrite".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fblockread
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fblockread".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: fseek
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_fseek".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: flength
* PROBLEM: Crashes on an invalid handle.
* SOLUTION: Check for an invalid handle.
* SEE: "FIXES_flength".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1790300
*
* FIX: file_inc
* PROBLEM: All file.inc fixes are included separately for major overhead.
* SOLUTION: Optionally group them all under one define. DEFAULTS TO FALSE!
* SEE: "FIX_file_inc".
* AUTHOR: Y_Less
*
* FIX: IsPlayerAttachedObjectSlotUsed
* PROBLEM: Doesn't work in OnPlayerDisconnect.
* SOLUTION: Maintain an internal record of slots used.
* SEE: "FIXES_SetPlayerAttachedObject",
* "FIXES_RemovePlayerAttachedObject",
* "FIXES_IsPAttachedObjectSlotUsed", and
* "OnPlayerDisconnect".
* AUTHOR: Y_Less
*
* FIX: SetPlayerAttachedObject
* PROBLEM: Doesn't remove objects when the mode ends.
* SOLUTION: Remove them.
* SEE: "FIXES_SetPlayerAttachedObject",
* "FIXES_RemovePlayerAttachedObject", and
* "OnPlayerDisconnect".
* AUTHOR: Y_Less
*
* FIX: OnPlayerDeath
* PROBLEM: Clients get stuck when they die with an animation applied.
* SOLUTION: Clear their animations.
* SEE: "OnPlayerDeath" and "OnPlayerUpdate".
* AUTHOR: h02
* POST: http://forum.sa-mp.com/showpost.php?p=1641144
*
* FIX: strins
* PROBLEM: Ignores the "maxlength" parameter causing possible crashes.
* SOLUTION: Manually check the length.
* SEE: "FIXES_strins".
* AUTHOR: Slice/Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1860495
* POST: http://forum.sa-mp.com/showpost.php?p=1864706
*
* FIX: IsPlayerConnected
* PROBLEM: Only uses the lower two bytes of a passed ID.
* SOLUTION: Mask the numbers.
* SEE: "FIXES_IsPlayerConnected".
* AUTHOR: Slice
* POST: http://forum.sa-mp.com/showpost.php?p=1860464
*
* FIX: OnPlayerCommandText
* PROBLEM: Can crash ZCMD when passed a null string.
* SOLUTION: Pass NULL if invalid inputs given.
* SEE: "OnPlayerCommandText".
* AUTHOR: Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1909511
*
* FIX: TrainExit
* PROBLEM: When getting out of a train entered by "PutPlayerInVehicle", the
* camera does not reset properly.
* SOLUTION: Reset the camera.
* SEE: "FIXES_PutPlayerInVehicle", "FIXES_OnPlayerStateChange".
* AUTHOR: Terminator3/Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1980214
*
* FIX: Kick
* PROBLEM: Calling "Kick" in "OnPlayerConnect" doesn't work properly.
* SOLUTION: Defer it.
* SEE: "OnPlayerConnect", "FIXES_Kick".
* AUTHOR: Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1989453
* FIXED IN: 0.3x
*
* FIX: OnVehicleMod
* PROBLEM: Crashes other players when invalid mods are applied.
* SOLUTION: Desync the player.
* SEE: "OnVehicleMod".
* AUTHOR: JernejL/Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1671500
*
* FIX: random
* PROBLEM: Doesn't work with negative numbers.
* SOLUTION: Invert then reinvert. DEFAULTS TO FALSE!
* SEE: "FIXES_random".
* AUTHOR: xX_Simon_Xx
* POST: http://forum.sa-mp.com/showpost.php?p=2141254
*
* FIX: sleep
* PROBLEM: Leaks bytes from the stack.
* SOLUTION: Invoke "SYSREQ.C" and "RETN" first to store the correct values.
* SEE: "FIXES_sleep".
* AUTHOR: Y_Less
*
* FIX: AddMenuItem
* PROBLEM: Crashes when passed an invalid menu ID.
* SOLUTION: Don't hide it when passed an invalid menu.
* SEE: "FIXES_AddMenuItem".
* AUTHOR: Y_Less
*
* FIX: SetMenuColumnHeader
* PROBLEM: Crashes when passed an invalid menu ID.
* SOLUTION: Don't hide it when passed an invalid menu.
* SEE: "FIXES_SetMenuColumnHeader".
* AUTHOR: Y_Less
*
* FIX: ShowMenuForPlayer
* PROBLEM: Crashes when passed an invalid menu ID.
* SOLUTION: Don't hide it when passed an invalid menu.
* SEE: "FIXES_ShowMenuForPlayer".
* AUTHOR: Y_Less
*
* FIX: HideMenuForPlayer
* PROBLEM: Crashes when passed an invalid menu ID.
* SOLUTION: Don't hide it when passed an invalid menu.
* SEE: "FIXES_HideMenuForPlayer".
* AUTHOR: Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=1787297
*
* FIX: HideMenuForPlayer_2
* PROBLEM: Ignores the "menuid" parameter.
* SOLUTION: Only hide the correct menu. DEFAULTS TO FALSE!
* SEE: "FIXES_HideMenuForPlayer".
* AUTHOR: Y_Less
*
* FIX: DisableMenu
* PROBLEM: Crashes when passed an invalid menu ID.
* SOLUTION: Don't hide it when passed an invalid menu.
* SEE: "FIXES_DisableMenu".
* AUTHOR: Y_Less
*
* FIX: DisableMenuRow
* PROBLEM: Crashes when passed an invalid menu ID.
* SOLUTION: Don't hide it when passed an invalid menu.
* SEE: "FIXES_DisableMenuRow".
* AUTHOR: Y_Less
*
* FIX: Menus
* PROBLEM: All menu function fixes are included separately for major overhead.
* SOLUTION: Optionally group them all under one define.
* SEE: "FIX_Menus", "_FIX_Menus"
* AUTHOR: Y_Less
*
* FIX: GetPlayerMenu
* PROBLEM: Returns previous menu when none is displayed.
* SOLUTION: Return the correct value.
* SEE: "FIXES_GetPlayerMenu", "OnPlayerSelectedMenuRow".
* AUTHOR: Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=2295867
*
* FIX: GetPlayerInterior
* PROBLEM: Always returns 0 for NPCs.
* SOLUTION: Return the correct value.
* SEE: "FIXES_GetPlayerInterior", "FIXES_SetPlayerInterior".
* AUTHOR: Y_Less
* POST: http://forum.sa-mp.com/showpost.php?p=2309246
*
* ==============
* STYLE RULES:
* ==============
*
* All globals should be "static stock" whenever possible (so they can only be
* accessed from this one file).
*
* Statics must start with "FIXES_gs", and all other globals with "FIXES_g".
*
* All functions not overriding existing functions must start with "FIXES_".
*
* Macros must be upper case, use underscores, and start "FIXES_":
* "FIXES_LIKE_THIS".
*
* Functions should be upper camel case (as the original functions are)
* "FIXES_LikeThis".
*
* Globals (after the prefix) should be upper camel case, and locals lower camel
* case "likeThis".
*
* ALS should be used to hook functions and callbacks.
*
* The ALS prefix for chaining is also "FIXES_"
*
* Enums start with "E_" or "e_" depending on type, then follow rules for
* macros.
*
* Use "FIXES_gsCallbackHooks" and "E_FIXES_CALLBACK_HOOKS" for ALS chaining.
*
* NO libraries should be included - not even the default SA:MP ones. Let the
* user do it.
*
* Due to the above rule, you cannot assume any third party libraries AT ALL, so
* do not use them.
*
* Certain terms may be shortened when dealing with long callback names to avoid
* compile truncation warnings (max symbol length is 31). Current list:
*
* "Checkpoint" -> "CP"
* "Update" -> "Upd"
* "TextDraw" -> "TD"
* "Object" -> "Obj"
* "Player" -> "P"
*
* Document all fixes at the top of the file, and highlight code.
*
* 4 space TABS - do not edit this file in PAWNO unless you know how to correct
* the indentation.
*
* All rules have exceptions, but they must be justifiable. For example
* "IS_FILTERSCRIPT" is a global variable, but is not called
* "FIXES_gIsFilterscript" to better match the "FILTERSCRIPT" macro it
* replaces. Now a macro for "_FIXES_gIsFilterscript".
*
* Variables which need to be fully global (i.e. not "static"), but should not
* actually be used by other people (e.g. appear inside a macro) should be
* prefixed with "_FIXES" instead of "FIXES" to indicate their private use.
*
* No comments beyond the end of column 80 (where the line in "PAWNO" is).
*
* When redefining a native, add a "BAD_" external name declaration with the
* "_ALS_" definition so that others may use the original native if they so
* desire (with the caveat that it may break all fixes). Note the "BAD_"
* name is meant to indicate the possibility of breaking the fix, not a
* comment on the original native function.
*
* If a bug is fixed in some version of the server it can be conditionally
* included here. This is done by checking for the existance of a native
* function introduced in the same server version. For example
* "TogglePlayerControllable" was fixed in 0.3eRC6, the same time as the
* "SetObjectMaterial" native was introduced, thus the inclusion becomes:
*
* #if !defined FIX_TogglePlayerControllable
* #define FIX_TogglePlayerControllable (!defined SetObjectMaterial)
* #endif
*
* This only includes this fix if that native doesn't exist.
*
* To reduce general memory consumption, strings in this include are stored
* globally in constant arrays and referenced. This is EXACTLY as fast as
* using the string constants directly, but means that strings are not
* stored in the assembly multiple times (unless the string is only used
* once, in which case it's more work for no gain). See this post for more
* details:
*
* http://forum.sa-mp.com/showpost.php?p=1795601
*
* Documentation explanation:
*
* FIX: <Short name>
* PROBLEM: <Description of problem>
* SOLUTION: <Description of solution>
* SEE: <List of relevant functions>
* AUTHOR: <Person who wrote the fix>
* POST: <Link to the original post where applicable>
* FIXED IN: <Server version of official fix where applicable>
*/
#define _FIXES_IS_UNSET(%0) ((2*%0-1+1)==-1)
// We can add server version compiler code here to only compile fixes that apply
// to the version of the includes for which the user is compiling.
#if !defined FIX_GetPlayerColor
#if defined FIX_GetPlayerColour
#define FIX_GetPlayerColor (FIX_GetPlayerColour)
#else
#define FIX_GetPlayerColor (1)
#endif
#endif
#if _FIXES_IS_UNSET(FIX_GetPlayerColor)
#undef FIX_GetPlayerColor
#define FIX_GetPlayerColor (0)
#endif
#if !defined FIX_FILTERSCRIPT
#define FIX_FILTERSCRIPT (1)
#elseif _FIXES_IS_UNSET(FIX_FILTERSCRIPT)
#undef FIX_FILTERSCRIPT
#define FIX_FILTERSCRIPT (0)
#endif
#if !defined FIX_SpawnPlayer
#define FIX_SpawnPlayer (1)
#elseif _FIXES_IS_UNSET(FIX_SpawnPlayer)
#undef FIX_SpawnPlayer
#define FIX_SpawnPlayer (0)
#endif
#if !defined FIX_SetPlayerName
#define FIX_SetPlayerName (1)
#elseif _FIXES_IS_UNSET(FIX_SetPlayerName)
#undef FIX_SetPlayerName
#define FIX_SetPlayerName (0)
#endif
#if !defined FIX_GetPlayerSkin
#define FIX_GetPlayerSkin (1)
#elseif _FIXES_IS_UNSET(FIX_GetPlayerSkin)
#undef FIX_GetPlayerSkin
#define FIX_GetPlayerSkin (0)
#endif
#if !defined FIX_GetWeaponName
#define FIX_GetWeaponName (1)
#elseif _FIXES_IS_UNSET(FIX_GetWeaponName)
#undef FIX_GetWeaponName
#define FIX_GetWeaponName (0)
#endif
#if !defined FIX_SetPlayerWorldBounds
#define FIX_SetPlayerWorldBounds (1)
#elseif _FIXES_IS_UNSET(FIX_SetPlayerWorldBounds)
#undef FIX_SetPlayerWorldBounds
#define FIX_SetPlayerWorldBounds (0)
#endif
#if !defined FIX_TogglePlayerControllable
#if defined SetObjectMaterial
#define FIX_TogglePlayerControllable (0)
#else
#define FIX_TogglePlayerControllable (1)
#endif
#elseif _FIXES_IS_UNSET(FIX_TogglePlayerControllable)
#undef FIX_TogglePlayerControllable
#define FIX_TogglePlayerControllable (0)
#endif
#if !defined FIX_HydraSniper
#define FIX_HydraSniper (1)
#elseif _FIXES_IS_UNSET(FIX_HydraSniper)
#undef FIX_HydraSniper
#define FIX_HydraSniper (0)
#endif
#if !defined FIX_IsPlayerInCheckpoint
#define FIX_IsPlayerInCheckpoint (1)
#elseif _FIXES_IS_UNSET(FIX_IsPlayerInCheckpoint)
#undef FIX_IsPlayerInCheckpoint
#define FIX_IsPlayerInCheckpoint (0)
#endif
#if !defined FIX_IsPlayerInRaceCheckpoint
#define FIX_IsPlayerInRaceCheckpoint (1)
#elseif _FIXES_IS_UNSET(FIX_IsPlayerInRaceCheckpoint)
#undef FIX_IsPlayerInRaceCheckpoint
#define FIX_IsPlayerInRaceCheckpoint (0)
#endif
#if !defined FIX_GetPlayerWeapon
#define FIX_GetPlayerWeapon (1)
#elseif _FIXES_IS_UNSET(FIX_GetPlayerWeapon)
#undef FIX_GetPlayerWeapon
#define FIX_GetPlayerWeapon (0)
#endif
#if !defined FIX_PutPlayerInVehicle
#define FIX_PutPlayerInVehicle (1)
#elseif _FIXES_IS_UNSET(FIX_PutPlayerInVehicle)
#undef FIX_PutPlayerInVehicle
#define FIX_PutPlayerInVehicle (0)
#endif
#if !defined FIX_KEY_AIM
#if defined KEY_AIM
#define FIX_KEY_AIM (0)
#else
#define FIX_KEY_AIM (1)
#endif
#elseif _FIXES_IS_UNSET(FIX_KEY_AIM)
#undef FIX_KEY_AIM
#define FIX_KEY_AIM (0)
#endif
#if !defined FIX_SetPlayerCheckpoint
#define FIX_SetPlayerCheckpoint (1)
#elseif _FIXES_IS_UNSET(FIX_SetPlayerCheckpoint)
#undef FIX_SetPlayerCheckpoint
#define FIX_SetPlayerCheckpoint (0)
#endif
#if !defined FIX_SetPlayerRaceCheckpoint
#define FIX_SetPlayerRaceCheckpoint (1)
#elseif _FIXES_IS_UNSET(FIX_SetPlayerRaceCheckpoint)
#undef FIX_SetPlayerRaceCheckpoint
#define FIX_SetPlayerRaceCheckpoint (0)
#endif
#if !defined FIX_TextDrawCreate
#define FIX_TextDrawCreate (1)
#elseif _FIXES_IS_UNSET(FIX_TextDrawCreate)
#undef FIX_TextDrawCreate
#define FIX_TextDrawCreate (0)
#endif
#if !defined FIX_TextDrawSetString
#define FIX_TextDrawSetString (1)
#elseif _FIXES_IS_UNSET(FIX_TextDrawSetString)
#undef FIX_TextDrawSetString
#define FIX_TextDrawSetString (0)
#endif
#if !defined FIX_AllowInteriorWeapons
#define FIX_AllowInteriorWeapons (1)
#elseif _FIXES_IS_UNSET(FIX_AllowInteriorWeapons)
#undef FIX_AllowInteriorWeapons
#define FIX_AllowInteriorWeapons (0)
#endif
#if !defined FIX_OnPlayerEnterVehicle
#if defined OnPlayerClickMap
#define FIX_OnPlayerEnterVehicle (0)
#else
#define FIX_OnPlayerEnterVehicle (1)
#endif
#elseif _FIXES_IS_UNSET(FIX_OnPlayerEnterVehicle)
#undef FIX_OnPlayerEnterVehicle
#define FIX_OnPlayerEnterVehicle (0)
#endif
#if !defined FIX_OnPlayerEnterVehicle_2
#define FIX_OnPlayerEnterVehicle_2 (1)
#elseif _FIXES_IS_UNSET(FIX_OnPlayerEnterVehicle)
#undef FIX_OnPlayerEnterVehicle_2
#define FIX_OnPlayerEnterVehicle_2 (0)
#endif
#if !defined FIX_AllowTeleport
#if defined OnPlayerClickMap
#define FIX_AllowTeleport (1)
#else
#define FIX_AllowTeleport (0)
#endif
#elseif _FIXES_IS_UNSET(FIX_AllowTeleport)
#undef FIX_AllowTeleport
#define FIX_AllowTeleport (0)
#endif
#if !defined FIX_SetPlayerSpecialAction
#define FIX_SetPlayerSpecialAction (1)
#elseif _FIXES_IS_UNSET(FIX_SetPlayerSpecialAction)
#undef FIX_SetPlayerSpecialAction
#define FIX_SetPlayerSpecialAction (0)
#endif
#if !defined FIX_OnDialogResponse
#if defined GetVehicleModelInfo
#define FIX_OnDialogResponse (0)
#else
#define FIX_OnDialogResponse (1)
#endif
#elseif _FIXES_IS_UNSET(FIX_OnDialogResponse)
#undef FIX_OnDialogResponse
#define FIX_OnDialogResponse (0)
#endif
#if !defined FIX_GetPlayerDialog
#define FIX_GetPlayerDialog (0)
#elseif _FIXES_IS_UNSET(FIX_GetPlayerDialog)
#undef FIX_GetPlayerDialog
#define FIX_GetPlayerDialog (0)
#endif
#if !defined FIX_SetSpawnInfo
#if defined GetPlayerVersion
#define FIX_SetSpawnInfo (0)
#else
#define FIX_SetSpawnInfo (1)
#endif
#elseif _FIXES_IS_UNSET(FIX_SetSpawnInfo)
#undef FIX_SetSpawnInfo
#define FIX_SetSpawnInfo (0)
#endif
#if !defined FIX_SetPlayerSkin
#define FIX_SetPlayerSkin (1)
#elseif _FIXES_IS_UNSET(FIX_SetPlayerSkin)
#undef FIX_SetPlayerSkin
#define FIX_SetPlayerSkin (0)
#endif
#if !defined FIX_HideMenuForPlayer
#define FIX_HideMenuForPlayer (1)
#elseif _FIXES_IS_UNSET(FIX_HideMenuForPlayer)
#undef FIX_HideMenuForPlayer
#define FIX_HideMenuForPlayer (0)
#endif
#if !defined FIX_valstr
#define FIX_valstr (1)
#elseif _FIXES_IS_UNSET(FIX_valstr)
#undef FIX_valstr
#define FIX_valstr (0)
#endif
#if !defined FIX_file_inc
#define FIX_file_inc (0)
#elseif _FIXES_IS_UNSET(FIX_file_inc)
#undef FIX_file_inc
#define FIX_file_inc (0)
#endif
#if !defined FIX_fclose
#define FIX_fclose (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fclose)
#undef FIX_fclose
#define FIX_fclose (0)
#endif
#if !defined FIX_fwrite
#define FIX_fwrite (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fwrite)
#undef FIX_fwrite
#define FIX_fwrite (0)
#endif
#if !defined FIX_fread
#define FIX_fread (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fread)
#undef FIX_fread
#define FIX_fread (0)
#endif
#if !defined FIX_fputchar
#define FIX_fputchar (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fputchar)
#undef FIX_fputchar
#define FIX_fputchar (0)
#endif
#if !defined FIX_fgetchar
#define FIX_fgetchar (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fgetchar)
#undef FIX_fgetchar
#define FIX_fgetchar (0)
#endif
#if !defined FIX_fblockwrite
#define FIX_fblockwrite (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fblockwrite)
#undef FIX_fblockwrite
#define FIX_fblockwrite (0)
#endif
#if !defined FIX_fblockread
#define FIX_fblockread (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fblockread)
#undef FIX_fblockread
#define FIX_fblockread (0)
#endif
#if !defined FIX_fseek
#define FIX_fseek (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_fseek)
#undef FIX_fseek
#define FIX_fseek (0)
#endif
#if !defined FIX_flength
#define FIX_flength (FIX_file_inc)
#elseif _FIXES_IS_UNSET(FIX_flength)
#undef FIX_flength
#define FIX_flength (0)
#endif
#if !defined FIX_IsPlayerAttachedObjSlotUsed
#define FIX_IsPlayerAttachedObjSlotUsed (1)
#elseif _FIXES_IS_UNSET(FIX_IsPlayerAttachedObjSlotUsed)
#undef FIX_IsPlayerAttachedObjSlotUsed
#define FIX_IsPlayerAttachedObjSlotUsed (0)
#endif
#if !defined FIX_SetPlayerAttachedObject
#define FIX_SetPlayerAttachedObject (1)
#elseif _FIXES_IS_UNSET(FIX_SetPlayerAttachedObject)
#undef FIX_SetPlayerAttachedObject
#define FIX_SetPlayerAttachedObject (0)
#endif
#if !defined FIX_OnPlayerDeath
#define FIX_OnPlayerDeath (1)
#elseif _FIXES_IS_UNSET(FIX_OnPlayerDeath)
#undef FIX_OnPlayerDeath
#define FIX_OnPlayerDeath (0)
#endif
#if !defined FIX_strins
#define FIX_strins (1)
#elseif _FIXES_IS_UNSET(FIX_strins)
#undef FIX_strins
#define FIX_strins (0)
#endif
#if !defined FIX_IsPlayerConnected
#define FIX_IsPlayerConnected (1)
#elseif _FIXES_IS_UNSET(FIX_IsPlayerConnected)
#undef FIX_IsPlayerConnected
#define FIX_IsPlayerConnected (0)
#endif
#if !defined FIX_OnPlayerCommandText
#if defined _ALS_OnPlayerCommandText
#define FIX_OnPlayerCommandText (0)
#else
#define FIX_OnPlayerCommandText (1)
#endif
#elseif _FIXES_IS_UNSET(FIX_OnPlayerCommandText)
#undef FIX_OnPlayerCommandText
#define FIX_OnPlayerCommandText (0)
#endif
#if !defined FIX_TrainExit
#define FIX_TrainExit (1)
#elseif _FIXES_IS_UNSET(FIX_TrainExit)
#undef FIX_TrainExit
#define FIX_TrainExit (0)
#endif
#if !defined FIX_Kick
#if defined EnableVehicleFriendlyFire
#define FIX_Kick (0)
#else
#define FIX_Kick (1)
#endif
#elseif _FIXES_IS_UNSET(FIX_Kick)
#undef FIX_Kick
#define FIX_Kick (0)
#endif
#if !defined FIX_OnVehicleMod
#define FIX_OnVehicleMod (1)
#elseif _FIXES_IS_UNSET(FIX_OnVehicleMod)
#undef FIX_OnVehicleMod
#define FIX_OnVehicleMod (0)
#endif
#if !defined FIX_random
#define FIX_random (0)
#elseif _FIXES_IS_UNSET(FIX_random)
#undef FIX_random
#define FIX_random (0)
#endif
#if !defined FIX_sleep
#define FIX_sleep (1)
#elseif _FIXES_IS_UNSET(FIX_sleep)
#undef FIX_sleep
#define FIX_sleep (0)
#endif
#if !defined FIX_Menus
#define FIX_Menus (1)
#elseif _FIXES_IS_UNSET(FIX_Menus)
#undef FIX_Menus
#define FIX_Menus (0)
#endif
#if !defined FIX_AddMenuItem
#define FIX_AddMenuItem (FIX_Menus)
#elseif _FIXES_IS_UNSET(FIX_AddMenuItem)
#undef FIX_AddMenuItem
#define FIX_AddMenuItem (0)
#endif
#if !defined FIX_SetMenuColumnHeader
#define FIX_SetMenuColumnHeader (FIX_Menus)
#elseif _FIXES_IS_UNSET(FIX_SetMenuColumnHeader)
#undef FIX_SetMenuColumnHeader
#define FIX_SetMenuColumnHeader (0)
#endif
#if !defined FIX_ShowMenuForPlayer
#define FIX_ShowMenuForPlayer (FIX_Menus)
#elseif _FIXES_IS_UNSET(FIX_ShowMenuForPlayer)
#undef FIX_ShowMenuForPlayer
#define FIX_ShowMenuForPlayer (0)
#endif
#if !defined FIX_HideMenuForPlayer
#define FIX_HideMenuForPlayer (FIX_Menus)
#elseif _FIXES_IS_UNSET(FIX_HideMenuForPlayer)
#undef FIX_HideMenuForPlayer
#define FIX_HideMenuForPlayer (0)
#endif
#if !defined FIX_GetPlayerMenu
#define FIX_GetPlayerMenu (1)
#elseif _FIXES_IS_UNSET(FIX_GetPlayerMenu)
#undef FIX_GetPlayerMenu
#define FIX_GetPlayerMenu (0)
#endif
#if !defined FIX_HideMenuForPlayer_2
#define FIX_HideMenuForPlayer_2 (0)
#elseif _FIXES_IS_UNSET(FIX_HideMenuForPlayer_2)
#undef FIX_HideMenuForPlayer_2
#define FIX_HideMenuForPlayer_2 (0)
#elseif FIX_HideMenuForPlayer_2 && !FIX_GetPlayerMenu
#error FIX_HideMenuForPlayer_2 requires FIX_GetPlayerMenu
#endif
#if !defined FIX_DisableMenu
#define FIX_DisableMenu (FIX_Menus)
#elseif _FIXES_IS_UNSET(FIX_DisableMenu)
#undef FIX_DisableMenu
#define FIX_DisableMenu (0)
#endif
#if !defined FIX_DisableMenuRow
#define FIX_DisableMenuRow (FIX_Menus)
#elseif _FIXES_IS_UNSET(FIX_DisableMenuRow)
#undef FIX_DisableMenuRow
#define FIX_DisableMenuRow (0)
#endif
#if FIX_Menus || FIX_AddMenuItem || FIX_SetMenuColumnHeader || FIX_ShowMenuForPlayer || FIX_HideMenuForPlayer || FIX_DisableMenu || FIX_DisableMenuRow
#define _FIX_Menus (1)
#else
#define _FIX_Menus (0)
#endif
#if !defined FIX_GetPlayerInterior
#define FIX_GetPlayerInterior (1)
#elseif _FIXES_IS_UNSET(FIX_GetPlayerInterior)