y_ac.inc 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /**
  2. * Copyright (c) 2013, Dan
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright notice,
  11. * this list of conditions and the following disclaimer in the documentation
  12. * and\or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  18. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * Special thanks to:
  26. * cessil - useful anticheat tips
  27. * Slice - memset
  28. * Y_Less - very thorough research
  29. */
  30. /*
  31. This file has a VERY odd inclusion method because most of the files in the AC
  32. code have very generic names, and the PAWN compiler isn't very friendly to
  33. generic names. If two files have the same name, even if they're not in the
  34. same folder, it will only include one of them. You can partially get around
  35. this by using "/" instead of "\" (which forces the compiler to include the path
  36. in the name check too), but it is limited to 30 characters*. To get around
  37. this as well, we just make sure that we know what these 30 characters are and
  38. remove that symbol. Note that the folder name "y_ac@do_compiler_long_fix" is 25
  39. characters, which, when added to "_inc_" makes our 30 exactly.
  40. * It should be 31, but the variable in the compiler was declared as "sNAMEMAX"
  41. chars instead of "sNAMEMAX+1" as all other similar instances are.
  42. */
  43. #if defined _INC_y_ac
  44. #endinput
  45. #endif
  46. #define _INC_y_ac
  47. #include "..\YSI_Internal\y_compilerpass"
  48. #include "..\YSI_Internal\y_version"
  49. #include "..\YSI_Core\y_debug"
  50. #include "..\YSI_Data\y_iterate"
  51. #define YSIM_U_DISABLE
  52. #define MASTER 57
  53. #include "..\YSI_Core\y_master"
  54. /**
  55. * Callback triggered when a cheat is detected.
  56. * <param name="playerid">Player's ID.<\param>
  57. * <param name="cheatid">Cheat ID.<\param>
  58. * <param name="extraid">Additional cheat ID (depends on hack tool, detection method, etc.).<\param>
  59. * <param name="info">Additional information.<\param>
  60. */
  61. forward AC_OnCheatDetected(playerid, cheatid, extraid, info[]);
  62. /**
  63. * <summary>Generate forward declarations for public and stock functions.<\summary>
  64. */
  65. #define AC_STOCK%0(%1) stock%0(%1)
  66. //#define AC_STOCK%0(%1) %0(%1)
  67. // Defines new functions. Not the real purpose of this anticheat.
  68. #if defined AC_NEW_FUNCTIONS
  69. #define IsPlayerAFK AC_IsPlayerAFK
  70. #define IsPlayerSpawned AC_IsPlayerSpawned
  71. #endif
  72. // Rename old natives (unprotected).
  73. #if defined _ALS_GetPlayerMoney
  74. #if defined BAD_GetPlayerMoney
  75. #define U_GetPlayerMoney BAD_GetPlayerMoney
  76. #else
  77. #error Unable to set U_GetPlayerMoney
  78. #endif
  79. #else
  80. native U_GetPlayerMoney(playerid) = GetPlayerMoney;
  81. #endif
  82. #if defined _ALS_GetPlayerSpecialAction
  83. #if defined BAD_GetPlayerSpecialAction
  84. #define U_GetPlayerSpecialAction BAD_GetPlayerSpecialAction
  85. #else
  86. #error Unable to set U_GetPlayerSpecialAction
  87. #endif
  88. #else
  89. native U_GetPlayerSpecialAction(playerid) = GetPlayerSpecialAction;
  90. #endif
  91. // Include the constants.
  92. #include "y_ac@do_compiler_long_fix/constants/cheats.pwn"
  93. #if AUTO_INCLUDE_GUARD
  94. #undef _inc_y_ac@do_compiler_long_fix
  95. #endif
  96. #include "y_ac@do_compiler_long_fix/constants/game.pwn"
  97. #if AUTO_INCLUDE_GUARD
  98. #undef _inc_y_ac@do_compiler_long_fix
  99. #endif
  100. #include "y_ac@do_compiler_long_fix/constants/player.pwn"
  101. #if AUTO_INCLUDE_GUARD
  102. #undef _inc_y_ac@do_compiler_long_fix
  103. #endif
  104. // Include the variables.
  105. #include "y_ac@do_compiler_long_fix/variables.pwn"
  106. #if AUTO_INCLUDE_GUARD
  107. #undef _inc_y_ac@do_compiler_long_fix
  108. #endif
  109. // Include the utilities.
  110. #include "..\YSI_Core\y_utils"
  111. #include "y_ac@do_compiler_long_fix/utils/CheatDetected.pwn"
  112. #if AUTO_INCLUDE_GUARD
  113. #undef _inc_y_ac@do_compiler_long_fix
  114. #endif
  115. #include "y_ac@do_compiler_long_fix/utils/GetSpeed.pwn"
  116. #if AUTO_INCLUDE_GUARD
  117. #undef _inc_y_ac@do_compiler_long_fix
  118. #endif
  119. #include "y_ac@do_compiler_long_fix/utils/IsPlayerAFK.pwn"
  120. #if AUTO_INCLUDE_GUARD
  121. #undef _inc_y_ac@do_compiler_long_fix
  122. #endif
  123. #include "y_ac@do_compiler_long_fix/utils/IsPlayerAtVendingMachine.pwn" // Rewrite to use y_areas.
  124. #if AUTO_INCLUDE_GUARD
  125. #undef _inc_y_ac@do_compiler_long_fix
  126. #endif
  127. #include "y_ac@do_compiler_long_fix/utils/IsPlayerSpawned.pwn"
  128. #if AUTO_INCLUDE_GUARD
  129. #undef _inc_y_ac@do_compiler_long_fix
  130. #endif
  131. // #include "y_ac@do_compiler_long_fix/utils/memset"
  132. // #if AUTO_INCLUDE_GUARD
  133. // #undef _inc_y_ac@do_compiler_long_fix
  134. // #endif
  135. #define AC_memset memset // Already defined by YSI.
  136. #include "y_ac@do_compiler_long_fix/utils/sync/IsPlayerSynced.pwn"
  137. #if AUTO_INCLUDE_GUARD
  138. #undef _inc_y_ac@do_compiler_long_fix
  139. #endif
  140. #include "y_ac@do_compiler_long_fix/utils/sync/SetPlayerSync.pwn"
  141. #if AUTO_INCLUDE_GUARD
  142. #undef _inc_y_ac@do_compiler_long_fix
  143. #endif
  144. // Include the callback hooks.
  145. #include "..\YSI_Coding\y_hooks"
  146. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerCommandText.pwn"
  147. #if AUTO_INCLUDE_GUARD
  148. #undef _inc_y_ac@do_compiler_long_fix
  149. #endif
  150. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerConnect.pwn"
  151. #if AUTO_INCLUDE_GUARD
  152. #undef _inc_y_ac@do_compiler_long_fix
  153. #endif
  154. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerDeath.pwn"
  155. #if AUTO_INCLUDE_GUARD
  156. #undef _inc_y_ac@do_compiler_long_fix
  157. #endif
  158. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerSpawn.pwn"
  159. #if AUTO_INCLUDE_GUARD
  160. #undef _inc_y_ac@do_compiler_long_fix
  161. #endif
  162. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerText.pwn"
  163. #if AUTO_INCLUDE_GUARD
  164. #undef _inc_y_ac@do_compiler_long_fix
  165. #endif
  166. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnPlayerUpdate.pwn"
  167. #if AUTO_INCLUDE_GUARD
  168. #undef _inc_y_ac@do_compiler_long_fix
  169. #endif
  170. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnScriptExit.pwn"
  171. #if AUTO_INCLUDE_GUARD
  172. #undef _inc_y_ac@do_compiler_long_fix
  173. #endif
  174. #include "y_ac@do_compiler_long_fix/hooks/callbacks/OnScriptInit.pwn"
  175. #if AUTO_INCLUDE_GUARD
  176. #undef _inc_y_ac@do_compiler_long_fix
  177. #endif
  178. // Include the watchguard timer.
  179. #include "..\YSI_Coding\y_timers"
  180. #include "y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Armour.pwn"
  181. #if AUTO_INCLUDE_GUARD
  182. #undef _inc_y_ac@do_compiler_long_fix
  183. #endif
  184. #include "y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Freeze.pwn"
  185. #if AUTO_INCLUDE_GUARD
  186. #undef _inc_y_ac@do_compiler_long_fix
  187. #endif
  188. #include "y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Health.pwn"
  189. #if AUTO_INCLUDE_GUARD
  190. #undef _inc_y_ac@do_compiler_long_fix
  191. #endif
  192. #include "y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Jetpack.pwn"
  193. #if AUTO_INCLUDE_GUARD
  194. #undef _inc_y_ac@do_compiler_long_fix
  195. #endif
  196. #include "y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Joypad.pwn"
  197. #if AUTO_INCLUDE_GUARD
  198. #undef _inc_y_ac@do_compiler_long_fix
  199. #endif
  200. #include "y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Money.pwn"
  201. #if AUTO_INCLUDE_GUARD
  202. #undef _inc_y_ac@do_compiler_long_fix
  203. #endif
  204. #include "y_ac@do_compiler_long_fix/watchguard/impl/Watchguard_Ping.pwn"
  205. #if AUTO_INCLUDE_GUARD
  206. #undef _inc_y_ac@do_compiler_long_fix
  207. #endif
  208. #include "y_ac@do_compiler_long_fix/watchguard/Watchguard.pwn"
  209. #if AUTO_INCLUDE_GUARD
  210. #undef _inc_y_ac@do_compiler_long_fix
  211. #endif
  212. // Include the function hooks.
  213. #include "y_ac@do_compiler_long_fix/hooks/natives/GetPlayerMoney.pwn"
  214. #if AUTO_INCLUDE_GUARD
  215. #undef _inc_y_ac@do_compiler_long_fix
  216. #endif
  217. #include "y_ac@do_compiler_long_fix/hooks/natives/GetPlayerSpecialAction.pwn"
  218. #if AUTO_INCLUDE_GUARD
  219. #undef _inc_y_ac@do_compiler_long_fix
  220. #endif
  221. #include "y_ac@do_compiler_long_fix/hooks/natives/GivePlayerMoney.pwn"
  222. #if AUTO_INCLUDE_GUARD
  223. #undef _inc_y_ac@do_compiler_long_fix
  224. #endif
  225. #include "y_ac@do_compiler_long_fix/hooks/natives/ResetPlayerMoney.pwn"
  226. #if AUTO_INCLUDE_GUARD
  227. #undef _inc_y_ac@do_compiler_long_fix
  228. #endif
  229. #include "y_ac@do_compiler_long_fix/hooks/natives/SetPlayerArmour.pwn"
  230. #if AUTO_INCLUDE_GUARD
  231. #undef _inc_y_ac@do_compiler_long_fix
  232. #endif
  233. #include "y_ac@do_compiler_long_fix/hooks/natives/SetPlayerHealth.pwn"
  234. #if AUTO_INCLUDE_GUARD
  235. #undef _inc_y_ac@do_compiler_long_fix
  236. #endif
  237. #include "y_ac@do_compiler_long_fix/hooks/natives/SetPlayerSpecialAction.pwn"
  238. #if AUTO_INCLUDE_GUARD
  239. #undef _inc_y_ac@do_compiler_long_fix
  240. #endif
  241. #include "y_ac@do_compiler_long_fix/hooks/natives/TogglePlayerControllable.pwn"
  242. #if AUTO_INCLUDE_GUARD
  243. #undef _inc_y_ac@do_compiler_long_fix
  244. #endif
  245. #include "y_ac@do_compiler_long_fix/hooks/natives/TogglePlayerSpectating.pwn"
  246. #if AUTO_INCLUDE_GUARD
  247. #undef _inc_y_ac@do_compiler_long_fix
  248. #endif