y_hooks.inc 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008
  1. /*----------------------------------------------------------------------------*-
  2. ==============================
  3. y_hooks - Hook any callback!
  4. ==============================
  5. Description:
  6. Automatically hooks any callbacks with a very simple syntax.
  7. Legal:
  8. Version: MPL 1.1
  9. The contents of this file are subject to the Mozilla Public License Version
  10. 1.1 (the "License"); you may not use this file except in compliance with
  11. the License. You may obtain a copy of the License at
  12. http://www.mozilla.org/MPL/
  13. Software distributed under the License is distributed on an "AS IS" basis,
  14. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  15. for the specific language governing rights and limitations under the
  16. License.
  17. The Original Code is the SA:MP script information include.
  18. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  19. Portions created by the Initial Developer are Copyright (C) 2008
  20. the Initial Developer. All Rights Reserved.
  21. Contributors:
  22. ZeeX, koolk
  23. Thanks:
  24. Peter, Cam - Support.
  25. ZeeX - Very productive conversations.
  26. koolk - IsPlayerinAreaEx code.
  27. TheAlpha - Danish translation.
  28. breadfish - German translation.
  29. Fireburn - Dutch translation.
  30. yom - French translation.
  31. 50p - Polish translation.
  32. Zamaroht - Spanish translation.
  33. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
  34. for me to strive to better.
  35. Pixels^ - Running XScripters where the idea was born.
  36. Matite - Pestering me to release it and using it.
  37. Very special thanks to:
  38. Thiadmer - PAWN.
  39. Kye/Kalcor - SA:MP.
  40. SA:MP Team past, present and future - SA:MP.
  41. Version:
  42. 1.0
  43. Changelog:
  44. 06/08/10:
  45. First version
  46. -*----------------------------------------------------------------------------*/
  47. #include <YSI\internal\y_version>
  48. #include <a_samp>
  49. #include <YSI\y_scripting>
  50. #include <YSI\y_utils>
  51. #define ALS_PREFIX S@@
  52. #include <YSI\y_als>
  53. #include <YSI\y_stringhash>
  54. #include <YSI\internal\y_shortfunc>
  55. #include <YSI\y_debug>
  56. //#define Hook:%1_On%2(%3) forward %1_@%2(%3); public %1_@%2(%3)
  57. #define Hook:%1_On%2(%3) @yH_%2_%1(%3);@yH_%2_%1(%3)
  58. #define HOOK_FUNC_SEARCH (Scripting_FastString('@', 'y', 'H', '_'))
  59. #define HOOKS_INSERT<%0> tmp=_:gs_aHookFunctionPointers[ALS_On%0],gs_aHookFunctionPointers[ALS_On%0]=Bit:((tmp!=_:-1?tmp&0xFFFF:idx-1)|idx<<16);
  60. //#define HOOKS_CALL<%0,%1>(%2) new t=_:gs_aHookFunctionPointers[ALS_On%0];if(t!=-1){new e=t>>>16;t&=0xFFFF;do t=Scripting_GetPublic(t,gs_szFunctionBuffer,"@yH_"#%0),P@(gs_szFunctionBuffer,#%1#x,%2);while(t!=e);}
  61. #define HOOKS_C_INT<%0,%1>(%2) new t=_:gs_aHookFunctionPointers[ALS_On%0];if(t!=-1){new e=t>>>16;t&=0xFFFF;do t=Scripting_GetPublic(t,gs_szFunctionBuffer,"@yH_"#%0),P@(gs_szFunctionBuffer,#%1#x,%2);while(t!=e);}
  62. #define HUK_C_GameModeInit HOOKS_C_INT<GameModeInit ,>()
  63. #define HUK_C_GameModeExit HOOKS_C_INT<GameModeExit ,>()
  64. #define HUK_C_FilterScriptInit HOOKS_C_INT<FilterScriptInit ,>()
  65. #define HUK_C_FilterScriptExit HOOKS_C_INT<FilterScriptExit ,>()
  66. #define HUK_C_PlayerConnect HOOKS_C_INT<PlayerConnect ,i>(playerid)
  67. #define HUK_C_PlayerDisconnect HOOKS_C_INT<PlayerDisconnect ,ii>(playerid,reason)
  68. #define HUK_C_PlayerSpawn HOOKS_C_INT<PlayerSpawn ,i>(playerid)
  69. #define HUK_C_PlayerDeath HOOKS_C_INT<PlayerDeath ,iii>(playerid,killerid,reason)
  70. #define HUK_C_VehicleSpawn HOOKS_C_INT<VehicleSpawn ,i>(vehicleid)
  71. #define HUK_C_VehicleDeath HOOKS_C_INT<VehicleDeath ,ii>(vehicleid,killerid)
  72. #define HUK_C_PlayerText HOOKS_C_INT<PlayerText ,is>(playerid,text)
  73. #define HUK_C_PlayerCommandText HOOKS_C_INT<PlayerCommandText ,is>(playerid,cmdtext)
  74. #define HUK_C_PlayerRequestClass HOOKS_C_INT<PlayerRequestClass ,ii>(playerid,classid)
  75. #define HUK_C_PlayerEnterVehicle HOOKS_C_INT<PlayerEnterVehicle ,iii>(playerid,vehicleid,ispassenger)
  76. #define HUK_C_PlayerExitVehicle HOOKS_C_INT<PlayerExitVehicle ,ii>(playerid,vehicleid)
  77. #define HUK_C_PlayerStateChange HOOKS_C_INT<PlayerStateChange ,iii>(playerid,newstate,oldstate)
  78. #define HUK_C_PlayerEnterCheckpoint HOOKS_C_INT<PlayerEnterCheckpoint ,i>(playerid)
  79. #define HUK_C_PlayerLeaveCheckpoint HOOKS_C_INT<PlayerLeaveCheckpoint ,i>(playerid)
  80. #define HUK_C_PlayerEnterRaceCheckpoint HOOKS_C_INT<PlayerEnterRaceCheckpoint,i>(playerid)
  81. #define HUK_C_PlayerLeaveRaceCheckpoint HOOKS_C_INT<PlayerLeaveRaceCheckpoint,i>(playerid)
  82. #define HUK_C_RconCommand HOOKS_C_INT<RconCommand ,s>(cmd)
  83. #define HUK_C_PlayerRequestSpawn HOOKS_C_INT<PlayerRequestSpawn ,i>(playerid)
  84. #define HUK_C_ObjectMoved HOOKS_C_INT<ObjectMoved ,i>(objectid)
  85. #define HUK_C_PlayerObjectMoved HOOKS_C_INT<PlayerObjectMoved ,ii>(playerid,objectid)
  86. #define HUK_C_PlayerPickUpPickup HOOKS_C_INT<PlayerPickUpPickup ,ii>(playerid,pickupid)
  87. #define HUK_C_VehicleMod HOOKS_C_INT<VehicleMod ,iii>(playerid,vehicleid,componentid)
  88. #define HUK_C_EnterExitModShop HOOKS_C_INT<EnterExitModShop ,iii>(playerid,enterexit,interiorid)
  89. #define HUK_C_VehiclePaintjob HOOKS_C_INT<VehiclePaintjob ,iii>(playerid,vehicleid,paintjobid)
  90. #define HUK_C_VehicleRespray HOOKS_C_INT<VehicleRespray ,iiii>(playerid,vehicleid,color1,color2)
  91. #define HUK_C_VehicleDamageStatusUpdate HOOKS_C_INT<VehicleDamageStatusUpdate,ii>(playerid,playerid)
  92. #define HUK_C_PlayerSelectedMenuRow HOOKS_C_INT<PlayerSelectedMenuRow ,ii>(playerid,row)
  93. #define HUK_C_PlayerExitedMenu HOOKS_C_INT<PlayerExitedMenu ,i>(playerid)
  94. #define HUK_C_PlayerInteriorChange HOOKS_C_INT<PlayerInteriorChange ,iii>(playerid,newinteriorid,oldinteriorid)
  95. #define HUK_C_PlayerKeyStateChange HOOKS_C_INT<PlayerKeyStateChange ,iii>(playerid,newkeys,oldkeys)
  96. #define HUK_C_RconLoginAttempt HOOKS_C_INT<RconLoginAttempt ,ssi>(ip,password,success)
  97. #define HUK_C_PlayerUpdate HOOKS_C_INT<PlayerUpdate ,i>(playerid)
  98. #define HUK_C_PlayerStreamIn HOOKS_C_INT<PlayerStreamIn ,ii>(playerid,forplayerid)
  99. #define HUK_C_PlayerStreamOut HOOKS_C_INT<PlayerStreamOut ,ii>(playerid,forplayerid)
  100. #define HUK_C_VehicleStreamIn HOOKS_C_INT<VehicleStreamIn ,ii>(vehicleid,forplayerid)
  101. #define HUK_C_VehicleStreamOut HOOKS_C_INT<VehicleStreamOut ,ii>(vehicleid,forplayerid)
  102. //#define HUK_C_DialogResponse HOOKS_C_INT<DialogResponse ,ii>(playerid,dialogid,response,listitem,inputtext)
  103. #define HUK_C_PlayerClickPlayer HOOKS_C_INT<PlayerClickPlayer ,iii>(playerid,clickedplayerid,source)
  104. //#define HUK_C_DialogResponse if(inputtext[0]){HOOKS_C_INT<DialogResponse,iiiis>(playerid,dialogid,response,listitem,inputtext)}else{HOOKS_C_INT<DialogResponse,iiiis>(playerid,dialogid,response,listitem,NULL)}
  105. //#define CALL_WRAPPER<%0> HUK_C_%0 ALS_CALL_%0
  106. #define HOOKS_CALL<%0> HUK_C_%0 ALS_C_%0
  107. #define HOOKS_MAX_UPDATES (4)
  108. static
  109. gs_aHookFunctionPointers[ALS] = {Bit:-1, ...},
  110. gs_szFunctionBuffer[32],
  111. gs_aOnPlayerUpdateHooks[HOOKS_MAX_UPDATES] = {-1, ...}/*,
  112. gs_pCodeStart*/;
  113. ALS_DATA<>
  114. /*static Hooks_GetNext(&idx)
  115. {
  116. idx = Scripting_GetPublicFast(idx, gs_szFunctionBuffer, HOOK_FUNC_SEARCH);
  117. if (idx == 0)
  118. {
  119. return -1;
  120. }
  121. return YHash(gs_szFunctionBuffer[4], true, hash_bernstein, strfind(gs_szFunctionBuffer[4], "_"));
  122. }*/
  123. /*----------------------------------------------------------------------------*-
  124. Function:
  125. Hooks_GenFuncList
  126. Params:
  127. -
  128. Return:
  129. -
  130. Notes:
  131. Generates a set of data describing every callback for speed later.
  132. -*----------------------------------------------------------------------------*/
  133. static Hooks_GenFuncList()
  134. {
  135. // Check for old style hooks using the new ALS library.
  136. ALS_DETECT<GameModeInit>
  137. #if 1
  138. ALS_DETECT<GameModeExit>
  139. ALS_DETECT<FilterScriptInit>
  140. ALS_DETECT<FilterScriptExit>
  141. ALS_DETECT<PlayerConnect>
  142. ALS_DETECT<PlayerDisconnect>
  143. ALS_DETECT<PlayerSpawn>
  144. ALS_DETECT<PlayerDeath>
  145. ALS_DETECT<VehicleSpawn>
  146. ALS_DETECT<VehicleDeath>
  147. ALS_DETECT<PlayerText>
  148. ALS_DETECT<PlayerCommandText>
  149. ALS_DETECT<PlayerRequestClass>
  150. ALS_DETECT<PlayerEnterVehicle>
  151. ALS_DETECT<PlayerExitVehicle>
  152. ALS_DETECT<PlayerStateChange>
  153. ALS_DETECT<PlayerEnterCheckpoint>
  154. ALS_DETECT<PlayerLeaveCheckpoint>
  155. ALS_DETECT<PlayerEnterRaceCheckpoint>
  156. ALS_DETECT<PlayerLeaveRaceCheckpoint>
  157. ALS_DETECT<RconCommand>
  158. ALS_DETECT<PlayerRequestSpawn>
  159. ALS_DETECT<ObjectMoved>
  160. ALS_DETECT<PlayerObjectMoved>
  161. ALS_DETECT<PlayerPickUpPickup>
  162. ALS_DETECT<VehicleMod>
  163. ALS_DETECT<EnterExitModShop>
  164. ALS_DETECT<VehiclePaintjob>
  165. ALS_DETECT<VehicleRespray>
  166. ALS_DETECT<VehicleDamageStatusUpdate>
  167. ALS_DETECT<PlayerSelectedMenuRow>
  168. ALS_DETECT<PlayerExitedMenu>
  169. ALS_DETECT<PlayerInteriorChange>
  170. ALS_DETECT<PlayerKeyStateChange>
  171. ALS_DETECT<RconLoginAttempt>
  172. ALS_DETECT<PlayerUpdate>
  173. ALS_DETECT<PlayerStreamIn>
  174. ALS_DETECT<PlayerStreamOut>
  175. ALS_DETECT<VehicleStreamIn>
  176. ALS_DETECT<VehicleStreamOut>
  177. ALS_DETECT<DialogResponse>
  178. ALS_DETECT<PlayerClickPlayer>
  179. #endif
  180. // Check for new style hooks. This gets the bounds of functions, to make
  181. // later calls very slightly faster!
  182. new
  183. idx = 0,
  184. tmp;
  185. // For some reason compile time initialisation didn't work...
  186. for (new ALS:i; i != ALS; ++i)
  187. {
  188. gs_aHookFunctionPointers[i] = -1;
  189. }
  190. for ( ; ; )
  191. {
  192. idx = Scripting_GetPublicFast(idx, gs_szFunctionBuffer, HOOK_FUNC_SEARCH);
  193. if (idx == 0)
  194. {
  195. break;
  196. }
  197. //return YHash(gs_szFunctionBuffer[4], true, bernstein, strfind(gs_szFunctionBuffer[4], "_"));
  198. //switch (Hooks_GetNext(idx))
  199. switch (YHash(gs_szFunctionBuffer[4], true, hash_bernstein, strfind(gs_szFunctionBuffer[4], "_")))
  200. {
  201. case _H(G,a,m,e,M,o,d,e,I,n,i,t):
  202. HOOKS_INSERT<GameModeInit>
  203. case _H(G,a,m,e,M,o,d,e,E,x,i,t):
  204. HOOKS_INSERT<GameModeExit>
  205. case _H(F,i,l,t,e,r,S,c,r,i,p,t,I,n,i,t):
  206. HOOKS_INSERT<FilterScriptInit>
  207. case _H(F,i,l,t,e,r,S,c,r,i,p,t,E,x,i,t):
  208. HOOKS_INSERT<FilterScriptExit>
  209. case _H(P,l,a,y,e,r,C,o,n,n,e,c,t):
  210. HOOKS_INSERT<PlayerConnect>
  211. case _H(P,l,a,y,e,r,D,i,s,c,o,n,n,e,c,t):
  212. HOOKS_INSERT<PlayerDisconnect>
  213. case _H(P,l,a,y,e,r,S,p,a,w,n):
  214. HOOKS_INSERT<PlayerSpawn>
  215. case _H(P,l,a,y,e,r,D,e,a,t,h):
  216. HOOKS_INSERT<PlayerDeath>
  217. case _H(V,e,h,i,c,l,e,S,p,a,w,n):
  218. HOOKS_INSERT<VehicleSpawn>
  219. case _H(V,e,h,i,c,l,e,D,e,a,t,h):
  220. HOOKS_INSERT<VehicleDeath>
  221. case _H(P,l,a,y,e,r,T,e,x,t):
  222. HOOKS_INSERT<PlayerText>
  223. case _H(P,l,a,y,e,r,C,o,m,m,a,n,d,T,e,x,t):
  224. HOOKS_INSERT<PlayerCommandText>
  225. case _H(P,l,a,y,e,r,R,e,q,u,e,s,t,C,l,a,s,s):
  226. HOOKS_INSERT<PlayerRequestClass>
  227. case _H(P,l,a,y,e,r,E,n,t,e,r,V,e,h,i,c,l,e,):
  228. HOOKS_INSERT<PlayerEnterVehicle>
  229. case _H(P,l,a,y,e,r,E,x,i,t,V,e,h,i,c,l,e,):
  230. HOOKS_INSERT<PlayerExitVehicle>
  231. case _H(P,l,a,y,e,r,S,t,a,t,e,C,h,a,n,g,e):
  232. HOOKS_INSERT<PlayerStateChange>
  233. case _H(P,l,a,y,e,r,E,n,t,e,r,C,h,e,c,k,p,o,i,n,t), _H(P,l,a,y,e,r,E,n,t,e,r,C,P):
  234. HOOKS_INSERT<PlayerEnterCheckpoint>
  235. case _H(P,l,a,y,e,r,L,e,a,v,e,C,h,e,c,k,p,o,i,n,t), _H(P,l,a,y,e,r,L,e,a,v,e,C,P):
  236. HOOKS_INSERT<PlayerLeaveCheckpoint>
  237. case _H(P,l,a,y,e,r,E,n,t,e,r,R,a,c,e,C,h,e,c,k,p,o,i,n,t), _H(P,l,a,y,e,r,E,n,t,e,r,R,C,P):
  238. HOOKS_INSERT<PlayerEnterRaceCheckpoint>
  239. case _H(P,l,a,y,e,r,L,e,a,v,e,R,a,c,e,C,h,e,c,k,p,o,i,n,t), _H(P,l,a,y,e,r,L,e,a,v,e,R,C,P):
  240. HOOKS_INSERT<PlayerLeaveRaceCheckpoint>
  241. case _H(R,c,o,n,C,o,m,m,a,n,d):
  242. HOOKS_INSERT<RconCommand>
  243. case _H(P,l,a,y,e,r,R,e,q,u,e,s,t,S,p,a,w,n):
  244. HOOKS_INSERT<PlayerRequestSpawn>
  245. case _H(O,b,j,e,c,t,M,o,v,e,d):
  246. HOOKS_INSERT<ObjectMoved>
  247. case _H(P,l,a,y,e,r,O,b,j,e,c,t,M,o,v,e,d):
  248. HOOKS_INSERT<PlayerObjectMoved>
  249. case _H(P,l,a,y,e,r,P,i,c,k,U,p,P,i,c,k,u,p):
  250. HOOKS_INSERT<PlayerPickUpPickup>
  251. case _H(V,e,h,i,c,l,e,M,o,d):
  252. HOOKS_INSERT<VehicleMod>
  253. case _H(E,n,t,e,r,E,x,i,t,M,o,d,S,h,o,p):
  254. HOOKS_INSERT<EnterExitModShop>
  255. case _H(V,e,h,i,c,l,e,P,a,i,n,t,j,o,b):
  256. HOOKS_INSERT<VehiclePaintjob>
  257. case _H(V,e,h,i,c,l,e,R,e,s,p,r,a,y):
  258. HOOKS_INSERT<VehicleRespray>
  259. case _H(V,e,h,i,c,l,e,D,a,m,a,g,e,S,t,a,t,u,s,U,p,d,a,t,e), _H(V,e,h,i,c,l,e,D,a,m,a,g,e,U,p,d,a,t,e):
  260. HOOKS_INSERT<VehicleDamageStatusUpdate>
  261. case _H(P,l,a,y,e,r,S,e,l,e,c,t,e,d,M,e,n,u,R,o,w), _H(P,l,a,y,e,r,S,e,l,e,c,t,e,d,M,e,n,u):
  262. HOOKS_INSERT<PlayerSelectedMenuRow>
  263. case _H(P,l,a,y,e,r,E,x,i,t,e,d,M,e,n,u):
  264. HOOKS_INSERT<PlayerExitedMenu>
  265. case _H(P,l,a,y,e,r,I,n,t,e,r,i,o,r,C,h,a,n,g,e):
  266. HOOKS_INSERT<PlayerInteriorChange>
  267. case _H(P,l,a,y,e,r,K,e,y,S,t,a,t,e,C,h,a,n,g,e):
  268. HOOKS_INSERT<PlayerKeyStateChange>
  269. case _H(R,c,o,n,L,o,g,i,n,A,t,t,e,m,p,t):
  270. HOOKS_INSERT<RconLoginAttempt>
  271. case _H(P,l,a,y,e,r,S,t,r,e,a,m,I,n):
  272. HOOKS_INSERT<PlayerStreamIn>
  273. case _H(P,l,a,y,e,r,S,t,r,e,a,m,O,u,t):
  274. HOOKS_INSERT<PlayerStreamOut>
  275. case _H(V,e,h,i,c,l,e,S,t,r,e,a,m,I,n):
  276. HOOKS_INSERT<VehicleStreamIn>
  277. case _H(V,e,h,i,c,l,e,S,t,r,e,a,m,O,u,t):
  278. HOOKS_INSERT<VehicleStreamOut>
  279. case _H(D,i,a,l,o,g,R,e,s,p,o,n,s,e):
  280. HOOKS_INSERT<DialogResponse>
  281. case _H(P,l,a,y,e,r,C,l,i,c,k,P,l,a,y,e,r):
  282. HOOKS_INSERT<PlayerClickPlayer>
  283. case -1:
  284. // Do nothing - end condition.
  285. break;
  286. case _H(P,l,a,y,e,r,U,p,d,a,t,e):
  287. {
  288. //HOOKS_INSERT<PlayerUpdate>
  289. // This uses different code to improve speed a little bit.
  290. tmp = _:gs_aHookFunctionPointers[ALS_OnPlayerUpdate];
  291. if (tmp == -1)
  292. {
  293. gs_aHookFunctionPointers[ALS_OnPlayerUpdate] = Bit:0;
  294. // Save the index of the first OnPlayerUpdate function.
  295. gs_aOnPlayerUpdateHooks[0] = idx - 1;
  296. //gs_aOnPlayerUpdateHooks[0] = Scripting_GetPublicPointer(gs_szFunctionBuffer);
  297. }
  298. else
  299. {
  300. // f = First, the upper limit.
  301. // s = Second, the lower limit.
  302. // Note that this only supports 65535 public functions, but
  303. // I suspect the compiler may get a little upset before you
  304. // reach that number - and if it doesn't you're going to
  305. // end up with a HUGE AMX!
  306. // f should always be larger than s in a normal system, even
  307. // if it's only 1 larger.
  308. new
  309. s = tmp & 0xFFFF;
  310. if (tmp & 0xFFFF0000)
  311. {
  312. // Given up counting - too many for quick
  313. // resolution.
  314. gs_aHookFunctionPointers[ALS_OnPlayerUpdate] = Bit:(s | idx << 16);
  315. }
  316. else
  317. {
  318. // Counting.
  319. if (++s == HOOKS_MAX_UPDATES)
  320. {
  321. // Reached the limit of the number of quick hooks
  322. // for OnPlayerUpdate supported.
  323. gs_aHookFunctionPointers[ALS_OnPlayerUpdate] = Bit:(idx - 1 | idx << 16);
  324. }
  325. else
  326. {
  327. gs_aOnPlayerUpdateHooks[s] = idx - 1;
  328. //gs_aOnPlayerUpdateHooks[s] = Scripting_GetPublicPointer(gs_szFunctionBuffer);
  329. gs_aHookFunctionPointers[ALS_OnPlayerUpdate] = Bit:s;
  330. }
  331. }
  332. }
  333. //gs_aHookFunctionPointers[ALS_OnPlayerUpdate] = Bit:((tmp!=_:-1?tmp&0xFFFF:idx-1)|idx<<16);
  334. }
  335. }
  336. }
  337. // Now, skip functions we don't need... This is actually self modifying
  338. // code, so if you don't use any of the Hook: features, they are never even
  339. // called. The functionality of this script depends entirely on the rest of
  340. // the script. This can't be made in to a macro because #OnWhatever needs
  341. // to stringise the value in the current define if it exists, whereas doing
  342. // #On%0 would just make a string of "OnWhatever".
  343. if (gs_aHookFunctionPointers[ALS_OnGameModeInit] == Bit:-1) Scripting_RedirectPublic(#OnGameModeInit, Scripting_GetPublicPointer("S@@_OnGameModeInit"));
  344. // Now the same again.
  345. #if 1
  346. if (gs_aHookFunctionPointers[ALS_OnGameModeExit] == Bit:-1) Scripting_RedirectPublic(#OnGameModeExit, Scripting_GetPublicPointer("S@@_OnGameModeExit"));
  347. if (gs_aHookFunctionPointers[ALS_OnFilterScriptInit] == Bit:-1) Scripting_RedirectPublic(#OnFilterScriptInit, Scripting_GetPublicPointer("S@@_OnFilterScriptInit"));
  348. if (gs_aHookFunctionPointers[ALS_OnFilterScriptExit] == Bit:-1) Scripting_RedirectPublic(#OnFilterScriptExit, Scripting_GetPublicPointer("S@@_OnFilterScriptExit"));
  349. if (gs_aHookFunctionPointers[ALS_OnPlayerConnect] == Bit:-1) Scripting_RedirectPublic(#OnPlayerConnect, Scripting_GetPublicPointer("S@@_OnPlayerConnect"));
  350. if (gs_aHookFunctionPointers[ALS_OnPlayerDisconnect] == Bit:-1) Scripting_RedirectPublic(#OnPlayerDisconnect, Scripting_GetPublicPointer("S@@_OnPlayerDisconnect"));
  351. if (gs_aHookFunctionPointers[ALS_OnPlayerSpawn] == Bit:-1) Scripting_RedirectPublic(#OnPlayerSpawn, Scripting_GetPublicPointer("S@@_OnPlayerSpawn"));
  352. if (gs_aHookFunctionPointers[ALS_OnPlayerDeath] == Bit:-1) Scripting_RedirectPublic(#OnPlayerDeath, Scripting_GetPublicPointer("S@@_OnPlayerDeath"));
  353. if (gs_aHookFunctionPointers[ALS_OnVehicleSpawn] == Bit:-1) Scripting_RedirectPublic(#OnVehicleSpawn, Scripting_GetPublicPointer("S@@_OnVehicleSpawn"));
  354. if (gs_aHookFunctionPointers[ALS_OnVehicleDeath] == Bit:-1) Scripting_RedirectPublic(#OnVehicleDeath, Scripting_GetPublicPointer("S@@_OnVehicleDeath"));
  355. if (gs_aHookFunctionPointers[ALS_OnPlayerText] == Bit:-1) Scripting_RedirectPublic(#OnPlayerText, Scripting_GetPublicPointer("S@@_OnPlayerText"));
  356. if (gs_aHookFunctionPointers[ALS_OnPlayerCommandText] == Bit:-1) Scripting_RedirectPublic(#OnPlayerCommandText, Scripting_GetPublicPointer("S@@_OnPlayerCommandText"));
  357. if (gs_aHookFunctionPointers[ALS_OnPlayerRequestClass] == Bit:-1) Scripting_RedirectPublic(#OnPlayerRequestClass, Scripting_GetPublicPointer("S@@_OnPlayerRequestClass"));
  358. if (gs_aHookFunctionPointers[ALS_OnPlayerEnterVehicle] == Bit:-1) Scripting_RedirectPublic(#OnPlayerEnterVehicle, Scripting_GetPublicPointer("S@@_OnPlayerEnterVehicle"));
  359. if (gs_aHookFunctionPointers[ALS_OnPlayerExitVehicle] == Bit:-1) Scripting_RedirectPublic(#OnPlayerExitVehicle, Scripting_GetPublicPointer("S@@_OnPlayerExitVehicle"));
  360. if (gs_aHookFunctionPointers[ALS_OnPlayerStateChange] == Bit:-1) Scripting_RedirectPublic(#OnPlayerStateChange, Scripting_GetPublicPointer("S@@_OnPlayerStateChange"));
  361. if (gs_aHookFunctionPointers[ALS_OnPlayerEnterCheckpoint] == Bit:-1) Scripting_RedirectPublic(#OnPlayerEnterCheckpoint, Scripting_GetPublicPointer("S@@_OnPlayerEnterCheckpoint"));
  362. if (gs_aHookFunctionPointers[ALS_OnPlayerLeaveCheckpoint] == Bit:-1) Scripting_RedirectPublic(#OnPlayerLeaveCheckpoint, Scripting_GetPublicPointer("S@@_OnPlayerLeaveCheckpoint"));
  363. if (gs_aHookFunctionPointers[ALS_OnPlayerEnterRaceCheckpoint] == Bit:-1) Scripting_RedirectPublic(#OnPlayerEnterRaceCheckpoint, Scripting_GetPublicPointer("S@@_OnPlayerEnterRaceCheckpoint"));
  364. if (gs_aHookFunctionPointers[ALS_OnPlayerLeaveRaceCheckpoint] == Bit:-1) Scripting_RedirectPublic(#OnPlayerLeaveRaceCheckpoint, Scripting_GetPublicPointer("S@@_OnPlayerLeaveRaceCheckpoint"));
  365. if (gs_aHookFunctionPointers[ALS_OnRconCommand] == Bit:-1) Scripting_RedirectPublic(#OnRconCommand, Scripting_GetPublicPointer("S@@_OnRconCommand"));
  366. if (gs_aHookFunctionPointers[ALS_OnPlayerRequestSpawn] == Bit:-1) Scripting_RedirectPublic(#OnPlayerRequestSpawn, Scripting_GetPublicPointer("S@@_OnPlayerRequestSpawn"));
  367. if (gs_aHookFunctionPointers[ALS_OnObjectMoved] == Bit:-1) Scripting_RedirectPublic(#OnObjectMoved, Scripting_GetPublicPointer("S@@_OnObjectMoved"));
  368. if (gs_aHookFunctionPointers[ALS_OnPlayerObjectMoved] == Bit:-1) Scripting_RedirectPublic(#OnPlayerObjectMoved, Scripting_GetPublicPointer("S@@_OnPlayerObjectMoved"));
  369. if (gs_aHookFunctionPointers[ALS_OnPlayerPickUpPickup] == Bit:-1) Scripting_RedirectPublic(#OnPlayerPickUpPickup, Scripting_GetPublicPointer("S@@_OnPlayerPickUpPickup"));
  370. if (gs_aHookFunctionPointers[ALS_OnVehicleMod] == Bit:-1) Scripting_RedirectPublic(#OnVehicleMod, Scripting_GetPublicPointer("S@@_OnVehicleMod"));
  371. if (gs_aHookFunctionPointers[ALS_OnEnterExitModShop] == Bit:-1) Scripting_RedirectPublic(#OnEnterExitModShop, Scripting_GetPublicPointer("S@@_OnEnterExitModShop"));
  372. if (gs_aHookFunctionPointers[ALS_OnVehiclePaintjob] == Bit:-1) Scripting_RedirectPublic(#OnVehiclePaintjob, Scripting_GetPublicPointer("S@@_OnVehiclePaintjob"));
  373. if (gs_aHookFunctionPointers[ALS_OnVehicleRespray] == Bit:-1) Scripting_RedirectPublic(#OnVehicleRespray, Scripting_GetPublicPointer("S@@_OnVehicleRespray"));
  374. if (gs_aHookFunctionPointers[ALS_OnVehicleDamageStatusUpdate] == Bit:-1) Scripting_RedirectPublic(#OnVehicleDamageStatusUpdate, Scripting_GetPublicPointer("S@@_OnVehicleDamageStatusUpdate"));
  375. if (gs_aHookFunctionPointers[ALS_OnPlayerSelectedMenuRow] == Bit:-1) Scripting_RedirectPublic(#OnPlayerSelectedMenuRow, Scripting_GetPublicPointer("S@@_OnPlayerSelectedMenuRow"));
  376. if (gs_aHookFunctionPointers[ALS_OnPlayerExitedMenu] == Bit:-1) Scripting_RedirectPublic(#OnPlayerExitedMenu, Scripting_GetPublicPointer("S@@_OnPlayerExitedMenu"));
  377. if (gs_aHookFunctionPointers[ALS_OnPlayerInteriorChange] == Bit:-1) Scripting_RedirectPublic(#OnPlayerInteriorChange, Scripting_GetPublicPointer("S@@_OnPlayerInteriorChange"));
  378. if (gs_aHookFunctionPointers[ALS_OnPlayerKeyStateChange] == Bit:-1) Scripting_RedirectPublic(#OnPlayerKeyStateChange, Scripting_GetPublicPointer("S@@_OnPlayerKeyStateChange"));
  379. if (gs_aHookFunctionPointers[ALS_OnRconLoginAttempt] == Bit:-1) Scripting_RedirectPublic(#OnRconLoginAttempt, Scripting_GetPublicPointer("S@@_OnRconLoginAttempt"));
  380. //if (gs_aHookFunctionPointers[ALS_OnPlayerUpdate] == Bit:-1) Scripting_RedirectPublic(#OnPlayerUpdate, Scripting_GetPublicPointer("S@@_OnPlayerUpdate"));
  381. if (gs_aHookFunctionPointers[ALS_OnPlayerStreamIn] == Bit:-1) Scripting_RedirectPublic(#OnPlayerStreamIn, Scripting_GetPublicPointer("S@@_OnPlayerStreamIn"));
  382. if (gs_aHookFunctionPointers[ALS_OnPlayerStreamOut] == Bit:-1) Scripting_RedirectPublic(#OnPlayerStreamOut, Scripting_GetPublicPointer("S@@_OnPlayerStreamOut"));
  383. if (gs_aHookFunctionPointers[ALS_OnVehicleStreamIn] == Bit:-1) Scripting_RedirectPublic(#OnVehicleStreamIn, Scripting_GetPublicPointer("S@@_OnVehicleStreamIn"));
  384. if (gs_aHookFunctionPointers[ALS_OnVehicleStreamOut] == Bit:-1) Scripting_RedirectPublic(#OnVehicleStreamOut, Scripting_GetPublicPointer("S@@_OnVehicleStreamOut"));
  385. if (gs_aHookFunctionPointers[ALS_OnDialogResponse] == Bit:-1) Scripting_RedirectPublic(#OnDialogResponse, Scripting_GetPublicPointer("S@@_OnDialogResponse"));
  386. if (gs_aHookFunctionPointers[ALS_OnPlayerClickPlayer] == Bit:-1) Scripting_RedirectPublic(#OnPlayerClickPlayer, Scripting_GetPublicPointer("S@@_OnPlayerClickPlayer"));
  387. #endif
  388. // The OnPlayerUpdate code is special.
  389. tmp = _:gs_aHookFunctionPointers[ALS_OnPlayerUpdate];
  390. if (tmp == -1)
  391. {
  392. Scripting_RedirectPublic(#OnPlayerUpdate, Scripting_GetPublicPointer("S@@_OnPlayerUpdate"));
  393. }
  394. else
  395. {
  396. if (!(tmp & 0xFFFF))
  397. {
  398. // Some fast find functions, but no normal ones.
  399. gs_aHookFunctionPointers[ALS_OnPlayerUpdate] = Bit:-1;
  400. }
  401. }
  402. }
  403. #pragma tabsize 0
  404. // Hook OnGameModeInit using the old system to call the new system.
  405. public OnGameModeInit()
  406. {
  407. #if !defined FILTERSCRIPT
  408. // Generate the list of functions
  409. Hooks_GenFuncList();
  410. #endif
  411. HOOKS_CALL<GameModeInit>
  412. //HOOKS_CALL<GameModeInit,>()
  413. //ALS_CALL<OnGameModeInit,>()
  414. }
  415. #if defined _ALS_OnGameModeInit
  416. #undef OnGameModeInit
  417. #else
  418. #define _ALS_OnGameModeInit
  419. #endif
  420. #define OnGameModeInit S@@_OnGameModeInit
  421. ALS_FORWARD<GameModeInit>
  422. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  423. {
  424. if (inputtext[0])
  425. {
  426. HOOKS_C_INT<DialogResponse,iiiis>(playerid,dialogid,response,listitem,inputtext)
  427. ALS_C_INT<DialogResponse,1,iiiis>(playerid,dialogid,response,listitem,inputtext)
  428. }
  429. else
  430. {
  431. HOOKS_C_INT<DialogResponse,iiiis>(playerid,dialogid,response,listitem,NULL)
  432. ALS_C_INT<DialogResponse,1,iiiis>(playerid,dialogid,response,listitem,NULL)
  433. }
  434. //HOOKS_CALL<DialogResponse>
  435. }
  436. #if defined _ALS_OnDialogResponse
  437. #undef OnDialogResponse
  438. #else
  439. #define _ALS_OnDialogResponse
  440. #endif
  441. #define OnDialogResponse S@@_OnDialogResponse
  442. ALS_FORWARD<DialogResponse>
  443. public OnPlayerUpdate(playerid)
  444. {
  445. P:1("Hooks_OnPlayerUpdate called");
  446. // This is the special one.
  447. for (new i = 0; i != HOOKS_MAX_UPDATES; ++i)
  448. {
  449. P:2("Hooks_OnPlayerUpdate: i = %d", i);
  450. new
  451. tmp = gs_aOnPlayerUpdateHooks[i];
  452. if (tmp == -1)
  453. {
  454. ALS_CALL<PlayerUpdate>
  455. }
  456. // This function can return any public, it's not limited to getting
  457. // OnPlayerUpdate functions, but the passed index means it will reach a
  458. // matching function, which will be an update function, instantly.
  459. Scripting_GetPublicFast(tmp, gs_szFunctionBuffer, HOOK_FUNC_SEARCH);
  460. CallLocalFunction(gs_szFunctionBuffer,"i", playerid);
  461. }
  462. P:2("Hooks_OnPlayerUpdate ended");
  463. // This uses the normal call wrapper.
  464. HOOKS_CALL<PlayerUpdate>
  465. }
  466. #if defined _ALS_OnPlayerUpdate
  467. #undef OnPlayerUpdate
  468. #else
  469. #define _ALS_OnPlayerUpdate
  470. #endif
  471. #define OnPlayerUpdate S@@_OnPlayerUpdate
  472. ALS_FORWARD<PlayerUpdate>
  473. public OnFilterScriptInit()
  474. {
  475. #if defined FILTERSCRIPT
  476. // Generate the list of functions
  477. Hooks_GenFuncList();
  478. #endif
  479. HOOKS_CALL<FilterScriptInit>
  480. }
  481. #if defined _ALS_OnFilterScriptInit
  482. #undef OnFilterScriptInit
  483. #else
  484. #define _ALS_OnFilterScriptInit
  485. #endif
  486. #define OnFilterScriptInit S@@_OnFilterScriptInit
  487. ALS_FORWARD<FilterScriptInit>
  488. // =============================================================================
  489. // =============================================================================
  490. // ||| |||
  491. // ||| NOTE: |||
  492. // ||| |||
  493. // ||| EVERYTHING BEYOND THIS POINT IS BORING AND CAN BE IGNORED - |||
  494. // ||| IT'S JUST THE SAME CODE OVER AND OVER FOR EVERY CALLBACK: |||
  495. // ||| |||
  496. // ||| |||
  497. // ||| public OnPlayerConnect(playerid) |||
  498. // ||| { |||
  499. // ||| HOOKS_CALL<PlayerConnect> |||
  500. // ||| } |||
  501. // ||| #if defined _ALS_OnPlayerConnect |||
  502. // ||| #undef OnPlayerConnect |||
  503. // ||| #else |||
  504. // ||| #define _ALS_OnPlayerConnect |||
  505. // ||| #endif |||
  506. // ||| #define OnPlayerConnect S@@_OnPlayerConnect |||
  507. // ||| ALS_FORWARD<PlayerConnect> |||
  508. // ||| |||
  509. // ||| |||
  510. // ||| THE "#if 1" WILL ALLOW YOU TO HIDE ALL THE CODE IN AN |||
  511. // ||| EDITOR WITH CODE FOLDING, FOR EXAMPLE NOTEPAD++ |||
  512. // ||| |||
  513. // =============================================================================
  514. // =============================================================================
  515. #if 1
  516. public OnGameModeExit()
  517. {
  518. HOOKS_CALL<GameModeExit>
  519. }
  520. #if defined _ALS_OnGameModeExit
  521. #undef OnGameModeExit
  522. #else
  523. #define _ALS_OnGameModeExit
  524. #endif
  525. #define OnGameModeExit S@@_OnGameModeExit
  526. ALS_FORWARD<GameModeExit>
  527. public OnFilterScriptExit()
  528. {
  529. HOOKS_CALL<FilterScriptExit>
  530. }
  531. #if defined _ALS_OnFilterScriptExit
  532. #undef OnFilterScriptExit
  533. #else
  534. #define _ALS_OnFilterScriptExit
  535. #endif
  536. #define OnFilterScriptExit S@@_OnFilterScriptExit
  537. ALS_FORWARD<FilterScriptExit>
  538. public OnPlayerConnect(playerid)
  539. {
  540. HOOKS_CALL<PlayerConnect>
  541. }
  542. #if defined _ALS_OnPlayerConnect
  543. #undef OnPlayerConnect
  544. #else
  545. #define _ALS_OnPlayerConnect
  546. #endif
  547. #define OnPlayerConnect S@@_OnPlayerConnect
  548. ALS_FORWARD<PlayerConnect>
  549. public OnPlayerDisconnect(playerid, reason)
  550. {
  551. HOOKS_CALL<PlayerDisconnect>
  552. }
  553. #if defined _ALS_OnPlayerDisconnect
  554. #undef OnPlayerDisconnect
  555. #else
  556. #define _ALS_OnPlayerDisconnect
  557. #endif
  558. #define OnPlayerDisconnect S@@_OnPlayerDisconnect
  559. ALS_FORWARD<PlayerDisconnect>
  560. public OnPlayerSpawn(playerid)
  561. {
  562. HOOKS_CALL<PlayerSpawn>
  563. }
  564. #if defined _ALS_OnPlayerSpawn
  565. #undef OnPlayerSpawn
  566. #else
  567. #define _ALS_OnPlayerSpawn
  568. #endif
  569. #define OnPlayerSpawn S@@_OnPlayerSpawn
  570. ALS_FORWARD<PlayerSpawn>
  571. public OnPlayerDeath(playerid, killerid, reason)
  572. {
  573. HOOKS_CALL<PlayerDeath>
  574. }
  575. #if defined _ALS_OnPlayerDeath
  576. #undef OnPlayerDeath
  577. #else
  578. #define _ALS_OnPlayerDeath
  579. #endif
  580. #define OnPlayerDeath S@@_OnPlayerDeath
  581. ALS_FORWARD<PlayerDeath>
  582. public OnVehicleSpawn(vehicleid)
  583. {
  584. HOOKS_CALL<VehicleSpawn>
  585. }
  586. #if defined _ALS_OnVehicleSpawn
  587. #undef OnVehicleSpawn
  588. #else
  589. #define _ALS_OnVehicleSpawn
  590. #endif
  591. #define OnVehicleSpawn S@@_OnVehicleSpawn
  592. ALS_FORWARD<VehicleSpawn>
  593. public OnVehicleDeath(vehicleid, killerid)
  594. {
  595. HOOKS_CALL<VehicleDeath>
  596. }
  597. #if defined _ALS_OnVehicleDeath
  598. #undef OnVehicleDeath
  599. #else
  600. #define _ALS_OnVehicleDeath
  601. #endif
  602. #define OnVehicleDeath S@@_OnVehicleDeath
  603. ALS_FORWARD<VehicleDeath>
  604. public OnPlayerText(playerid, text[])
  605. {
  606. HOOKS_CALL<PlayerText>
  607. }
  608. #if defined _ALS_OnPlayerText
  609. #undef OnPlayerText
  610. #else
  611. #define _ALS_OnPlayerText
  612. #endif
  613. #define OnPlayerText S@@_OnPlayerText
  614. ALS_FORWARD<PlayerText>
  615. public OnPlayerCommandText(playerid, cmdtext[])
  616. {
  617. HOOKS_CALL<PlayerCommandText>
  618. }
  619. #if defined _ALS_OnPlayerCommandText
  620. #undef OnPlayerCommandText
  621. #else
  622. #define _ALS_OnPlayerCommandText
  623. #endif
  624. #define OnPlayerCommandText S@@_OnPlayerCommandText
  625. ALS_FORWARD<PlayerCommandText>
  626. public OnPlayerRequestClass(playerid, classid)
  627. {
  628. HOOKS_CALL<PlayerRequestClass>
  629. }
  630. #if defined _ALS_OnPlayerRequestClass
  631. #undef OnPlayerRequestClass
  632. #else
  633. #define _ALS_OnPlayerRequestClass
  634. #endif
  635. #define OnPlayerRequestClass S@@_OnPlayerRequestClass
  636. ALS_FORWARD<PlayerRequestClass>
  637. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  638. {
  639. HOOKS_CALL<PlayerEnterVehicle>
  640. }
  641. #if defined _ALS_OnPlayerEnterVehicle
  642. #undef OnPlayerEnterVehicle
  643. #else
  644. #define _ALS_OnPlayerEnterVehicle
  645. #endif
  646. #define OnPlayerEnterVehicle S@@_OnPlayerEnterVehicle
  647. ALS_FORWARD<PlayerEnterVehicle>
  648. public OnPlayerExitVehicle(playerid, vehicleid)
  649. {
  650. HOOKS_CALL<PlayerExitVehicle>
  651. }
  652. #if defined _ALS_OnPlayerExitVehicle
  653. #undef OnPlayerExitVehicle
  654. #else
  655. #define _ALS_OnPlayerExitVehicle
  656. #endif
  657. #define OnPlayerExitVehicle S@@_OnPlayerExitVehicle
  658. ALS_FORWARD<PlayerExitVehicle>
  659. public OnPlayerStateChange(playerid, newstate, oldstate)
  660. {
  661. HOOKS_CALL<PlayerStateChange>
  662. }
  663. #if defined _ALS_OnPlayerStateChange
  664. #undef OnPlayerStateChange
  665. #else
  666. #define _ALS_OnPlayerStateChange
  667. #endif
  668. #define OnPlayerStateChange S@@_OnPlayerStateChange
  669. ALS_FORWARD<PlayerStateChange>
  670. public OnPlayerEnterCheckpoint(playerid)
  671. {
  672. HOOKS_CALL<PlayerEnterCheckpoint>
  673. }
  674. #if defined _ALS_OnPlayerEnterCheckpoint
  675. #undef OnPlayerEnterCheckpoint
  676. #else
  677. #define _ALS_OnPlayerEnterCheckpoint
  678. #endif
  679. #define OnPlayerEnterCheckpoint S@@_OnPlayerEnterCheckpoint
  680. ALS_FORWARD<PlayerEnterCheckpoint>
  681. public OnPlayerLeaveCheckpoint(playerid)
  682. {
  683. HOOKS_CALL<PlayerLeaveCheckpoint>
  684. }
  685. #if defined _ALS_OnPlayerLeaveCheckpoint
  686. #undef OnPlayerLeaveCheckpoint
  687. #else
  688. #define _ALS_OnPlayerLeaveCheckpoint
  689. #endif
  690. #define OnPlayerLeaveCheckpoint S@@_OnPlayerLeaveCheckpoint
  691. ALS_FORWARD<PlayerLeaveCheckpoint>
  692. public OnPlayerEnterRaceCheckpoint(playerid)
  693. {
  694. HOOKS_CALL<PlayerEnterRaceCheckpoint>
  695. }
  696. #if defined _ALS_OnPlayerEnterRaceCP
  697. #undef OnPlayerEnterRaceCheckpoint
  698. #else
  699. #define _ALS_OnPlayerEnterRaceCP
  700. #endif
  701. #define OnPlayerEnterRaceCheckpoint S@@_OnPlayerEnterRaceCheckpoint
  702. ALS_FORWARD<PlayerEnterRaceCheckpoint>
  703. public OnPlayerLeaveRaceCheckpoint(playerid)
  704. {
  705. HOOKS_CALL<PlayerLeaveRaceCheckpoint>
  706. }
  707. #if defined _ALS_OnPlayerLeaveRaceCP
  708. #undef OnPlayerLeaveRaceCheckpoint
  709. #else
  710. #define _ALS_OnPlayerLeaveRaceCP
  711. #endif
  712. #define OnPlayerLeaveRaceCheckpoint S@@_OnPlayerLeaveRaceCheckpoint
  713. ALS_FORWARD<PlayerLeaveRaceCheckpoint>
  714. public OnRconCommand(cmd[])
  715. {
  716. HOOKS_CALL<RconCommand>
  717. }
  718. #if defined _ALS_OnRconCommand
  719. #undef OnRconCommand
  720. #else
  721. #define _ALS_OnRconCommand
  722. #endif
  723. #define OnRconCommand S@@_OnRconCommand
  724. ALS_FORWARD<RconCommand>
  725. public OnPlayerRequestSpawn(playerid)
  726. {
  727. HOOKS_CALL<PlayerRequestSpawn>
  728. }
  729. #if defined _ALS_OnPlayerRequestSpawn
  730. #undef OnPlayerRequestSpawn
  731. #else
  732. #define _ALS_OnPlayerRequestSpawn
  733. #endif
  734. #define OnPlayerRequestSpawn S@@_OnPlayerRequestSpawn
  735. ALS_FORWARD<PlayerRequestSpawn>
  736. public OnObjectMoved(objectid)
  737. {
  738. HOOKS_CALL<ObjectMoved>
  739. }
  740. #if defined _ALS_OnObjectMoved
  741. #undef OnObjectMoved
  742. #else
  743. #define _ALS_OnObjectMoved
  744. #endif
  745. #define OnObjectMoved S@@_OnObjectMoved
  746. ALS_FORWARD<ObjectMoved>
  747. public OnPlayerObjectMoved(playerid, objectid)
  748. {
  749. HOOKS_CALL<PlayerObjectMoved>
  750. }
  751. #if defined _ALS_OnPlayerObjectMoved
  752. #undef OnPlayerObjectMoved
  753. #else
  754. #define _ALS_OnPlayerObjectMoved
  755. #endif
  756. #define OnPlayerObjectMoved S@@_OnPlayerObjectMoved
  757. ALS_FORWARD<PlayerObjectMoved>
  758. public OnPlayerPickUpPickup(playerid, pickupid)
  759. {
  760. HOOKS_CALL<PlayerPickUpPickup>
  761. }
  762. #if defined _ALS_OnPlayerPickUpPickup
  763. #undef OnPlayerPickUpPickup
  764. #else
  765. #define _ALS_OnPlayerPickUpPickup
  766. #endif
  767. #define OnPlayerPickUpPickup S@@_OnPlayerPickUpPickup
  768. ALS_FORWARD<PlayerPickUpPickup>
  769. public OnVehicleMod(playerid, vehicleid, componentid)
  770. {
  771. HOOKS_CALL<VehicleMod>
  772. }
  773. #if defined _ALS_OnVehicleMod
  774. #undef OnVehicleMod
  775. #else
  776. #define _ALS_OnVehicleMod
  777. #endif
  778. #define OnVehicleMod S@@_OnVehicleMod
  779. ALS_FORWARD<VehicleMod>
  780. public OnEnterExitModShop(playerid, enterexit, interiorid)
  781. {
  782. HOOKS_CALL<EnterExitModShop>
  783. }
  784. #if defined _ALS_OnEnterExitModShop
  785. #undef OnEnterExitModShop
  786. #else
  787. #define _ALS_OnEnterExitModShop
  788. #endif
  789. #define OnEnterExitModShop S@@_OnEnterExitModShop
  790. ALS_FORWARD<EnterExitModShop>
  791. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  792. {
  793. HOOKS_CALL<VehiclePaintjob>
  794. }
  795. #if defined _ALS_OnVehiclePaintjob
  796. #undef OnVehiclePaintjob
  797. #else
  798. #define _ALS_OnVehiclePaintjob
  799. #endif
  800. #define OnVehiclePaintjob S@@_OnVehiclePaintjob
  801. ALS_FORWARD<VehiclePaintjob>
  802. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  803. {
  804. HOOKS_CALL<VehicleRespray>
  805. }
  806. #if defined _ALS_OnVehicleRespray
  807. #undef OnVehicleRespray
  808. #else
  809. #define _ALS_OnVehicleRespray
  810. #endif
  811. #define OnVehicleRespray S@@_OnVehicleRespray
  812. ALS_FORWARD<VehicleRespray>
  813. public OnVehicleDamageStatusUpdate(vehicleid, playerid)
  814. {
  815. HOOKS_CALL<VehicleDamageStatusUpdate>
  816. }
  817. #if defined _ALS_OnVehicleDamageStatusUpd
  818. #undef OnVehicleDamageStatusUpdate
  819. #else
  820. #define _ALS_OnVehicleDamageStatusUpd
  821. #endif
  822. #define OnVehicleDamageStatusUpdate S@@_OnVehicleDamageStatusUpdate
  823. ALS_FORWARD<VehicleDamageStatusUpdate>
  824. public OnPlayerSelectedMenuRow(playerid, row)
  825. {
  826. HOOKS_CALL<PlayerSelectedMenuRow>
  827. }
  828. #if defined _ALS_OnPlayerSelectedMenuRow
  829. #undef OnPlayerSelectedMenuRow
  830. #else
  831. #define _ALS_OnPlayerSelectedMenuRow
  832. #endif
  833. #define OnPlayerSelectedMenuRow S@@_OnPlayerSelectedMenuRow
  834. ALS_FORWARD<PlayerSelectedMenuRow>
  835. public OnPlayerExitedMenu(playerid)
  836. {
  837. HOOKS_CALL<PlayerExitedMenu>
  838. }
  839. #if defined _ALS_OnPlayerExitedMenu
  840. #undef OnPlayerExitedMenu
  841. #else
  842. #define _ALS_OnPlayerExitedMenu
  843. #endif
  844. #define OnPlayerExitedMenu S@@_OnPlayerExitedMenu
  845. ALS_FORWARD<PlayerExitedMenu>
  846. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  847. {
  848. HOOKS_CALL<PlayerInteriorChange>
  849. }
  850. #if defined _ALS_OnPlayerInteriorChange
  851. #undef OnPlayerInteriorChange
  852. #else
  853. #define _ALS_OnPlayerInteriorChange
  854. #endif
  855. #define OnPlayerInteriorChange S@@_OnPlayerInteriorChange
  856. ALS_FORWARD<PlayerInteriorChange>
  857. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  858. {
  859. HOOKS_CALL<PlayerKeyStateChange>
  860. }
  861. #if defined _ALS_OnPlayerKeyStateChange
  862. #undef OnPlayerKeyStateChange
  863. #else
  864. #define _ALS_OnPlayerKeyStateChange
  865. #endif
  866. #define OnPlayerKeyStateChange S@@_OnPlayerKeyStateChange
  867. ALS_FORWARD<PlayerKeyStateChange>
  868. public OnRconLoginAttempt(ip[], password[], success)
  869. {
  870. HOOKS_CALL<RconLoginAttempt>
  871. }
  872. #if defined _ALS_OnRconLoginAttempt
  873. #undef OnRconLoginAttempt
  874. #else
  875. #define _ALS_OnRconLoginAttempt
  876. #endif
  877. #define OnRconLoginAttempt S@@_OnRconLoginAttempt
  878. ALS_FORWARD<RconLoginAttempt>
  879. public OnPlayerStreamIn(playerid, forplayerid)
  880. {
  881. HOOKS_CALL<PlayerStreamIn>
  882. }
  883. #if defined _ALS_OnPlayerStreamIn
  884. #undef OnPlayerStreamIn
  885. #else
  886. #define _ALS_OnPlayerStreamIn
  887. #endif
  888. #define OnPlayerStreamIn S@@_OnPlayerStreamIn
  889. ALS_FORWARD<PlayerStreamIn>
  890. public OnPlayerStreamOut(playerid, forplayerid)
  891. {
  892. HOOKS_CALL<PlayerStreamOut>
  893. }
  894. #if defined _ALS_OnPlayerStreamOut
  895. #undef OnPlayerStreamOut
  896. #else
  897. #define _ALS_OnPlayerStreamOut
  898. #endif
  899. #define OnPlayerStreamOut S@@_OnPlayerStreamOut
  900. ALS_FORWARD<PlayerStreamOut>
  901. public OnVehicleStreamIn(vehicleid, forplayerid)
  902. {
  903. HOOKS_CALL<VehicleStreamIn>
  904. }
  905. #if defined _ALS_OnVehicleStreamIn
  906. #undef OnVehicleStreamIn
  907. #else
  908. #define _ALS_OnVehicleStreamIn
  909. #endif
  910. #define OnVehicleStreamIn S@@_OnVehicleStreamIn
  911. ALS_FORWARD<VehicleStreamIn>
  912. public OnVehicleStreamOut(vehicleid, forplayerid)
  913. {
  914. HOOKS_CALL<VehicleStreamOut>
  915. }
  916. #if defined _ALS_OnVehicleStreamOut
  917. #undef OnVehicleStreamOut
  918. #else
  919. #define _ALS_OnVehicleStreamOut
  920. #endif
  921. #define OnVehicleStreamOut S@@_OnVehicleStreamOut
  922. ALS_FORWARD<VehicleStreamOut>
  923. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  924. {
  925. HOOKS_CALL<PlayerClickPlayer>
  926. }
  927. #if defined _ALS_OnDPlayerClickPlayer
  928. #undef OnPlayerClickPlayer
  929. #else
  930. #define _ALS_OnPlayerClickPlayer
  931. #endif
  932. #define OnPlayerClickPlayer S@@_OnPlayerClickPlayer
  933. ALS_FORWARD<PlayerClickPlayer>
  934. #endif
  935. #pragma tabsize 4
  936. #undef ALS_PREFIX