@amxts/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +162 -0
  3. package/README.ru.md +162 -0
  4. package/amxmodx/base/include/amxconst.inc +594 -0
  5. package/amxmodx/base/include/amxmisc.inc +902 -0
  6. package/amxmodx/base/include/amxmodx.inc +3447 -0
  7. package/amxmodx/base/include/amxmodx_version.inc +20 -0
  8. package/amxmodx/base/include/cellarray.inc +525 -0
  9. package/amxmodx/base/include/cellstack.inc +166 -0
  10. package/amxmodx/base/include/celltrie.inc +412 -0
  11. package/amxmodx/base/include/core.inc +202 -0
  12. package/amxmodx/base/include/csstats.inc +298 -0
  13. package/amxmodx/base/include/csstats_const.inc +29 -0
  14. package/amxmodx/base/include/cstrike.inc +1287 -0
  15. package/amxmodx/base/include/cstrike_const.inc +521 -0
  16. package/amxmodx/base/include/csx.inc +259 -0
  17. package/amxmodx/base/include/cvars.inc +547 -0
  18. package/amxmodx/base/include/datapack.inc +161 -0
  19. package/amxmodx/base/include/dbi.inc +154 -0
  20. package/amxmodx/base/include/dodconst.inc +152 -0
  21. package/amxmodx/base/include/dodfun.inc +152 -0
  22. package/amxmodx/base/include/dodstats.inc +69 -0
  23. package/amxmodx/base/include/dodx.inc +161 -0
  24. package/amxmodx/base/include/engine.inc +1343 -0
  25. package/amxmodx/base/include/engine_const.inc +310 -0
  26. package/amxmodx/base/include/engine_stocks.inc +248 -0
  27. package/amxmodx/base/include/esf.inc +70 -0
  28. package/amxmodx/base/include/esf_const.inc +74 -0
  29. package/amxmodx/base/include/fakemeta.inc +1127 -0
  30. package/amxmodx/base/include/fakemeta_const.inc +793 -0
  31. package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
  32. package/amxmodx/base/include/fakemeta_util.inc +882 -0
  33. package/amxmodx/base/include/file.inc +666 -0
  34. package/amxmodx/base/include/float.inc +422 -0
  35. package/amxmodx/base/include/fun.inc +333 -0
  36. package/amxmodx/base/include/gameconfig.inc +93 -0
  37. package/amxmodx/base/include/geoip.inc +264 -0
  38. package/amxmodx/base/include/ham_const.inc +4352 -0
  39. package/amxmodx/base/include/hamsandwich.inc +439 -0
  40. package/amxmodx/base/include/hlsdk_const.inc +808 -0
  41. package/amxmodx/base/include/json.inc +777 -0
  42. package/amxmodx/base/include/lang.inc +119 -0
  43. package/amxmodx/base/include/message_const.inc +1130 -0
  44. package/amxmodx/base/include/message_stocks.inc +161 -0
  45. package/amxmodx/base/include/messages.inc +604 -0
  46. package/amxmodx/base/include/newmenus.inc +387 -0
  47. package/amxmodx/base/include/ns.inc +754 -0
  48. package/amxmodx/base/include/ns_const.inc +196 -0
  49. package/amxmodx/base/include/nvault.inc +154 -0
  50. package/amxmodx/base/include/regex.inc +348 -0
  51. package/amxmodx/base/include/sockets.inc +183 -0
  52. package/amxmodx/base/include/sorting.inc +107 -0
  53. package/amxmodx/base/include/sqlx.inc +582 -0
  54. package/amxmodx/base/include/string.inc +786 -0
  55. package/amxmodx/base/include/string_const.inc +156 -0
  56. package/amxmodx/base/include/string_stocks.inc +325 -0
  57. package/amxmodx/base/include/textparse_ini.inc +214 -0
  58. package/amxmodx/base/include/textparse_smc.inc +261 -0
  59. package/amxmodx/base/include/tfcconst.inc +84 -0
  60. package/amxmodx/base/include/tfcstats.inc +62 -0
  61. package/amxmodx/base/include/tfcx.inc +148 -0
  62. package/amxmodx/base/include/time.inc +118 -0
  63. package/amxmodx/base/include/tsconst.inc +154 -0
  64. package/amxmodx/base/include/tsfun.inc +198 -0
  65. package/amxmodx/base/include/tsstats.inc +65 -0
  66. package/amxmodx/base/include/tsx.inc +88 -0
  67. package/amxmodx/base/include/vault.inc +60 -0
  68. package/amxmodx/base/include/vector.inc +131 -0
  69. package/amxmodx/base/include/xs.inc +1570 -0
  70. package/as/amxts.d.ts +153 -0
  71. package/as/constants.ts +4730 -0
  72. package/as/effects.ts +1449 -0
  73. package/as/entities.ts +5482 -0
  74. package/as/events.ts +3054 -0
  75. package/as/facade.ts +4639 -0
  76. package/as/flags.ts +299 -0
  77. package/as/fs.ts +287 -0
  78. package/as/hooks.ts +18536 -0
  79. package/as/kit.ts +25 -0
  80. package/as/lib/check.ts +86 -0
  81. package/as/modules/http.ts +184 -0
  82. package/as/natives.ts +11845 -0
  83. package/as/os.ts +30 -0
  84. package/as/promise.ts +1392 -0
  85. package/as/promise.types.d.ts +82 -0
  86. package/as/remote.ts +288 -0
  87. package/as/tsconfig.json +22 -0
  88. package/as/vector.ts +65 -0
  89. package/bin/amxts.mjs +10 -0
  90. package/includes/menu_core.inc +355 -0
  91. package/includes/order.txt +54 -0
  92. package/includes/sources.json +27 -0
  93. package/includes/universal_config.inc +355 -0
  94. package/lint/oxlint-plugin.mjs +77 -0
  95. package/node_modules/assemblyscript/LICENSE +201 -0
  96. package/node_modules/assemblyscript/NOTICE +93 -0
  97. package/node_modules/assemblyscript/package.json +63 -0
  98. package/node_modules/assemblyscript/std/README.md +6 -0
  99. package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
  100. package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
  101. package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
  102. package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
  103. package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
  104. package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
  105. package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
  106. package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
  107. package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
  108. package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
  109. package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
  110. package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
  111. package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
  112. package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
  113. package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
  114. package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
  115. package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
  116. package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
  117. package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
  118. package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
  119. package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
  120. package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
  121. package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
  122. package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
  123. package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
  124. package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
  125. package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
  126. package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
  127. package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
  128. package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
  129. package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
  130. package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
  131. package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
  132. package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
  133. package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
  134. package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
  135. package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
  136. package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
  137. package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
  138. package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
  139. package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
  140. package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
  141. package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
  142. package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
  143. package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
  144. package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
  145. package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
  146. package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
  147. package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
  148. package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
  149. package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
  150. package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
  151. package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
  152. package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
  153. package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
  154. package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
  155. package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
  156. package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
  157. package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
  158. package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
  159. package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
  160. package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
  161. package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
  162. package/node_modules/assemblyscript/std/assembly.json +16 -0
  163. package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
  164. package/node_modules/assemblyscript/std/portable/index.js +416 -0
  165. package/node_modules/assemblyscript/std/portable.json +11 -0
  166. package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
  167. package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
  168. package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
  169. package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
  170. package/node_modules/assemblyscript/tsconfig-base.json +13 -0
  171. package/package.json +112 -0
  172. package/runtime/deps/assemblyscript/LICENSE +201 -0
  173. package/runtime/deps/assemblyscript/NOTICE +93 -0
  174. package/runtime/deps/assemblyscript/bin/asc.js +35 -0
  175. package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
  176. package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
  177. package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
  178. package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
  179. package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
  180. package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
  181. package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
  182. package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
  183. package/runtime/deps/assemblyscript/package.json +114 -0
  184. package/runtime/host/amxts.inc +85 -0
  185. package/runtime/licenses/AMXX-LICENSE.txt +34 -0
  186. package/runtime/licenses/AssemblyScript-LICENSE +201 -0
  187. package/runtime/licenses/AssemblyScript-NOTICE +93 -0
  188. package/runtime/licenses/Binaryen-LICENSE +201 -0
  189. package/runtime/licenses/Bun-LICENSE.md +84 -0
  190. package/runtime/licenses/GPL-3.0.txt +674 -0
  191. package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
  192. package/runtime/licenses/README.md +25 -0
  193. package/runtime/licenses/WAMR-LICENSE +219 -0
  194. package/runtime/natives.txt +1095 -0
  195. package/runtime/patches/README.md +59 -0
  196. package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
  197. package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
  198. package/scripts/apply-docs.ts +508 -0
  199. package/scripts/asc.ts +27 -0
  200. package/scripts/auto-imports.ts +258 -0
  201. package/scripts/build-wasm.ts +595 -0
  202. package/scripts/check.ts +93 -0
  203. package/scripts/compile-cache.ts +179 -0
  204. package/scripts/compile.ts +401 -0
  205. package/scripts/docker-server.ts +73 -0
  206. package/scripts/docs/as/amxts.ts +210 -0
  207. package/scripts/docs/as/effects.ts +1684 -0
  208. package/scripts/docs/as/facade.ts +3302 -0
  209. package/scripts/docs/as/fs.ts +173 -0
  210. package/scripts/docs/as/lib/check.ts +68 -0
  211. package/scripts/docs/as/modules/http.ts +66 -0
  212. package/scripts/docs/as/os.ts +16 -0
  213. package/scripts/docs/as/promise.ts +132 -0
  214. package/scripts/docs/as/promise.types.ts +63 -0
  215. package/scripts/docs/as/vector.ts +48 -0
  216. package/scripts/docs/entities.ts +2338 -0
  217. package/scripts/docs/events.ts +245 -0
  218. package/scripts/docs/game.ts +497 -0
  219. package/scripts/docs/messages.ts +148 -0
  220. package/scripts/file-contents.ts +74 -0
  221. package/scripts/includes.ts +134 -0
  222. package/scripts/player-fields.ts +866 -0
  223. package/scripts/plugin-cache.ts +92 -0
  224. package/scripts/plugin-natives.ts +1157 -0
  225. package/scripts/prebuilt.ts +268 -0
  226. package/scripts/prepare.ts +134 -0
  227. package/scripts/project.ts +973 -0
  228. package/scripts/run.ts +28 -0
  229. package/scripts/shared-modules.ts +906 -0
  230. package/scripts/system.ts +33 -0
  231. package/scripts/tracked-fs.ts +115 -0
  232. package/scripts/typed-configs.ts +788 -0
  233. package/scripts/ui.ts +77 -0
  234. package/src/cli-api.mjs +175 -0
  235. package/src/parser/include-parser.ts +506 -0
  236. package/src/system.mjs +155 -0
  237. package/src/testing/compile-cache.ts +31 -0
  238. package/src/testing/compile.ts +222 -0
  239. package/src/testing/coroutines.ts +191 -0
  240. package/src/testing/index.ts +39 -0
  241. package/src/testing/kits.ts +55 -0
  242. package/src/testing/memory.ts +125 -0
  243. package/src/testing/natives.ts +925 -0
  244. package/src/testing/server.ts +1874 -0
  245. package/src/testing/setup.ts +63 -0
  246. package/src/testing/tables.ts +139 -0
  247. package/src/types.ts +51 -0
@@ -0,0 +1,439 @@
1
+ // vim: set ts=4 sw=4 tw=99 noet:
2
+ //
3
+ // AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
4
+ // Copyright (C) The AMX Mod X Development Team.
5
+ //
6
+ // This software is licensed under the GNU General Public License, version 3 or higher.
7
+ // Additional exceptions apply. For full license details, see LICENSE.txt or visit:
8
+ // https://alliedmods.net/amxmodx-license
9
+
10
+ //
11
+ // Ham Sandwich Functions
12
+ //
13
+
14
+ /**
15
+ * Ham Sandwich is a module that is used to hook and call virtual functions of
16
+ * entities.
17
+ * Virtual functions are mod-specific functions. This means that in order
18
+ * for this to work on a mod, it needs to be configured with the gamedata
19
+ * file.
20
+ * Be very careful with parameter passing to these functions.
21
+ */
22
+
23
+ #if defined _hamsandwich_included
24
+ #endinput
25
+ #endif
26
+ #define _hamsandwich_included
27
+
28
+ #include <ham_const>
29
+
30
+ #pragma reqlib hamsandwich
31
+ #if !defined AMXMODX_NOAUTOLOAD
32
+ #pragma loadlib hamsandwich
33
+ #endif
34
+
35
+ /**
36
+ * Hooks the virtual table for the specified entity class.
37
+ * An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
38
+ * Look at the Ham enum for parameter lists.
39
+ *
40
+ * @param function The function to hook.
41
+ * @param EntityClass The entity classname to hook.
42
+ * @param callback The forward to call.
43
+ * @param post Whether or not to forward this in post.
44
+ * @param specialbot Whether or not to enable support for bot without "player" classname.
45
+ * @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
46
+ */
47
+ native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0, bool:specialbot = false);
48
+
49
+ /**
50
+ * Hooks the virtual table for the player class.
51
+ * An example would be: RegisterHam(Ham_TakeDamage, "player_hurt");
52
+ * Look at the Ham enum for parameter lists.
53
+ *
54
+ * @param function The function to hook.
55
+ * @param callback The forward to call.
56
+ * @param post Whether or not to forward this in post.
57
+ * @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
58
+ */
59
+ stock HamHook:RegisterHamPlayer(Ham:function, const Callback[], Post=0)
60
+ {
61
+ return RegisterHam(function, "player", Callback, Post, true);
62
+ }
63
+
64
+ /**
65
+ * Hooks the virtual table for the specified entity's class.
66
+ * An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
67
+ * Look at the Ham enum for parameter lists.
68
+ * Note: This will cause hooks for the entire internal class that the entity is
69
+ * not exclusively for the provided entity.
70
+ *
71
+ * @param function The function to hook.
72
+ * @param EntityId The entity classname to hook.
73
+ * @param callback The forward to call.
74
+ * @param post Whether or not to forward this in post.
75
+ * @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
76
+ */
77
+ native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
78
+
79
+
80
+ /**
81
+ * Stops a ham forward from triggering.
82
+ * Use the return value from RegisterHam as the parameter here!
83
+ *
84
+ * @param fwd The forward to stop.
85
+ */
86
+ native DisableHamForward(HamHook:fwd);
87
+
88
+ /**
89
+ * Starts a ham forward back up.
90
+ * Use the return value from RegisterHam as the parameter here!
91
+ *
92
+ * @param fwd The forward to re-enable.
93
+ */
94
+ native EnableHamForward(HamHook:fwd);
95
+
96
+ /**
97
+ * Executes the virtual function on the entity.
98
+ * Look at the Ham enum for parameter lists.
99
+ *
100
+ * @param function The function to call.
101
+ * @param id The id of the entity to execute it on.
102
+ */
103
+ native ExecuteHam(Ham:function, this, any:...);
104
+
105
+ /**
106
+ * Executes the virtual function on the entity, this will trigger all hooks on that function.
107
+ * Be very careful about recursion!
108
+ * Look at the Ham enum for parameter lists.
109
+ *
110
+ * @param function The function to call.
111
+ * @param id The id of the entity to execute it on.
112
+ */
113
+ native ExecuteHamB(Ham:function, this, any:...);
114
+
115
+ /**
116
+ * Gets the return status of the current hook.
117
+ * This is useful to determine what return natives to use.
118
+ *
119
+ * @return The current status of the hook (such as HAM_SUPERCEDE).
120
+ */
121
+ native GetHamReturnStatus();
122
+
123
+ /**
124
+ * Gets the return value of a hook for hooks that return integers or booleans.
125
+ *
126
+ * @param output The variable to store the value in.
127
+ */
128
+ native GetHamReturnInteger(&output);
129
+
130
+ /**
131
+ * Gets the return value of a hook for hooks that return float.
132
+ *
133
+ * @param output The variable to store the value in.
134
+ */
135
+ native GetHamReturnFloat(&Float:output);
136
+
137
+ /**
138
+ * Gets the return value of a hook for hooks that return Vectors.
139
+ *
140
+ * @param output The variable to store the value in.
141
+ */
142
+ native GetHamReturnVector(Float:output[3]);
143
+
144
+ /**
145
+ * Gets the return value of a hook for hooks that return entities.
146
+ *
147
+ * @param output The variable to store the value in. Will be -1 on null.
148
+ */
149
+ native GetHamReturnEntity(&output);
150
+
151
+ /**
152
+ * Gets the return value of a hook for hooks that return strings.
153
+ *
154
+ * @param output The buffer to store the string in.
155
+ * @param size The string size of the buffer.
156
+ */
157
+ native GetHamReturnString(output[], size);
158
+
159
+ /**
160
+ * Gets the original return value of a hook for hooks that return integers or booleans.
161
+ *
162
+ * @param output The variable to store the value in.
163
+ */
164
+ native GetOrigHamReturnInteger(&output);
165
+
166
+ /**
167
+ * Gets the original return value of a hook for hooks that return floats.
168
+ *
169
+ * @param output The variable to store the value in.
170
+ */
171
+ native GetOrigHamReturnFloat(&Float:output);
172
+
173
+ /**
174
+ * Gets the original return value of a hook for hooks that return Vectors.
175
+ *
176
+ * @param output The variable to store the value in.
177
+ */
178
+ native GetOrigHamReturnVector(Float:output[3]);
179
+
180
+ /**
181
+ * Gets the original return value of a hook for hooks that return entities.
182
+ *
183
+ * @param output The variable to store the value in. -1 on null.
184
+ */
185
+ native GetOrigHamReturnEntity(&output);
186
+
187
+ /**
188
+ * Gets the original return value of a hook for hooks that return strings.
189
+ *
190
+ * @param output The buffer to store the string in.
191
+ * @param size The size of the buffer.
192
+ */
193
+ native GetOrigHamReturnString(output[], size);
194
+
195
+
196
+ /**
197
+ * Sets the return value of a hook that returns an integer or boolean.
198
+ * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
199
+ *
200
+ * @param value The value to set the return to.
201
+ */
202
+ native SetHamReturnInteger(value);
203
+
204
+ /**
205
+ * Sets the return value of a hook that returns a float.
206
+ * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
207
+ *
208
+ * @param value The value to set the return to.
209
+ */
210
+ native SetHamReturnFloat(Float:value);
211
+
212
+ /**
213
+ * Sets the return value of a hook that returns a Vector.
214
+ * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
215
+ *
216
+ * @param value The value to set the return to.
217
+ */
218
+ native SetHamReturnVector(const Float:value[3]);
219
+
220
+ /**
221
+ * Sets the return value of a hook that returns an entity. Set to -1 for null.
222
+ * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
223
+ *
224
+ * @param value The value to set the return to.
225
+ */
226
+ native SetHamReturnEntity(value);
227
+
228
+ /**
229
+ * Sets the return value of a hook that returns a string.
230
+ * This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
231
+ *
232
+ * @param value The value to set the return to.
233
+ */
234
+ native SetHamReturnString(const value[]);
235
+
236
+
237
+ /**
238
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
239
+ * Use this on parameters that are integers.
240
+ *
241
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
242
+ * @param value The value to change it to.
243
+ */
244
+ native SetHamParamInteger(which, value);
245
+
246
+ /**
247
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
248
+ * Use this on parameters that are floats.
249
+ *
250
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
251
+ * @param value The value to change it to.
252
+ */
253
+ native SetHamParamFloat(which, Float:value);
254
+
255
+ /**
256
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
257
+ * Use this on parameters that are Vectors.
258
+ *
259
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
260
+ * @param value The value to change it to.
261
+ */
262
+ native SetHamParamVector(which, const Float:value[3]);
263
+
264
+ /**
265
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
266
+ * Use this on parameters that are entities.
267
+ *
268
+ * @note Due to a historical bug, the changes made by this native are not reflected in the corresponding post forward
269
+ * for backward compatibility reasons. Use SetHamParamEntity2 if this is required.
270
+ *
271
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
272
+ * @param value The value to change it to.
273
+ */
274
+ native SetHamParamEntity(which, value);
275
+
276
+ /**
277
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
278
+ * Use this on parameters that are entities.
279
+ *
280
+ * @note Same as SetHamParamEntity except the changes made by this native are reflected in the corresponding post forward.
281
+ *
282
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
283
+ * @param value The value to change it to.
284
+ */
285
+ native SetHamParamEntity2(which, value);
286
+
287
+ /**
288
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
289
+ * Use this on parameters that are strings.
290
+ *
291
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
292
+ * @param ouput The value to change it to.
293
+ */
294
+ native SetHamParamString(which, const output[]);
295
+
296
+ /**
297
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
298
+ * Use this on parameters that are trace result handles.
299
+ *
300
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
301
+ * @param tr_handle The value to change it to.
302
+ */
303
+ native SetHamParamTraceResult(which, tr_handle);
304
+
305
+ /**
306
+ * Sets a parameter on the fly of the current hook. This has no effect in post hooks.
307
+ * Use this on parameters that are trace result handles.
308
+ *
309
+ * @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
310
+ * @param iteminfo_handle The value to change it to.
311
+ */
312
+ native SetHamParamItemInfo(which, iteminfo_handle);
313
+
314
+
315
+ /**
316
+ * Gets a parameter on the fly of the current hook.
317
+ * Use this on parameters that are iteminfo result handles.
318
+ *
319
+ * @param iteminfo_handle Item info handle.
320
+ * @param type Item info type. See HamItemInfo constants.
321
+ */
322
+ native GetHamItemInfo(iteminfo_handle, HamItemInfo:type, any:...);
323
+
324
+ /**
325
+ * Sets a parameter on the fly of the current hook.
326
+ * Use this on parameters that are iteminfo result handles.
327
+ *
328
+ * @param iteminfo_handle Item info handle.
329
+ * @param type Item info type. See HamItemInfo_ constants.
330
+ */
331
+ native SetHamItemInfo(iteminfo_handle, HamItemInfo:type, any:...);
332
+
333
+ /**
334
+ * Creates an ItemInfo handle. This value should never be altered.
335
+ * The handle can be used in Get/SetHamItemInfo.
336
+ *
337
+ * NOTE: You must call FreeHamItemInfo() on every handle made with CreateHamItemInfo().
338
+ *
339
+ * @return A new ItemInfo handle.
340
+ */
341
+ native CreateHamItemInfo();
342
+
343
+ /**
344
+ * Frees an ItemIndo handle created with CreateHamItemInfo(). Do not call
345
+ * this more than once per handle, or on handles not created through
346
+ * CreateHamItemInfo().
347
+ *
348
+ * @param itemInfo_handle ItemInfo handle created via CreateHamItemInfo().
349
+ * @noreturn
350
+ */
351
+ native FreeHamItemInfo(itemInfo_handle);
352
+
353
+
354
+ /**
355
+ * Returns whether or not the function for the specified Ham is valid.
356
+ * Things that would make it invalid would be bounds (an older module version
357
+ * may not have all of the functions), and the function not being found in
358
+ * the mod's hamdata.ini file.
359
+ *
360
+ * @param function The function to look up.
361
+ * @return true if the function is valid, false otherwise.
362
+ */
363
+ native bool:IsHamValid(Ham:function);
364
+
365
+ /**
366
+ * This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
367
+ * This requires the mod to have the pev and base fields set in hamdata.ini.
368
+ * Note this dereferences memory! Improper use of this will crash the server.
369
+ * This will return an index of the corresponding cbase field in private data.
370
+ * Returns -1 on a null entry.
371
+ *
372
+ * @param id The entity to examine the private data.
373
+ * @param offset The windows offset of the data.
374
+ * @param linuxdiff The linux difference of the data.
375
+ * @param macdiff The mac os x difference of the data.
376
+ * @return The index of the corresponding pdata field. -1 for none set.
377
+ */
378
+ native get_pdata_cbase(id, offset, linuxdiff=5, macdiff=5);
379
+
380
+ /**
381
+ * This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
382
+ * This requires the mod to have the pev and base fields set in hamdata.ini.
383
+ * This will set the corresponding cbase field in private data with the index.
384
+ * Pass -1 to null the entry.
385
+ *
386
+ * @param id The entity to examine the private data.
387
+ * @param offset The windows offset of the data.
388
+ * @param value The index to store, -1 for invalid
389
+ * @param linuxdiff The linux difference of the data.
390
+ * @param macdiff The mac os x difference of the data.
391
+ */
392
+ native set_pdata_cbase(id, offset, value, linuxdiff=5, macdiff=5);
393
+
394
+ /**
395
+ * This is similar to the get_pdata_cbase, however it does not dereference memory.
396
+ * This is many times slower than get_pdata_cbase, and this should only be used
397
+ * for testing and finding of offsets, not actual release quality plugins.
398
+ * This will return an index of the corresponding cbase field in private data.
399
+ * Returns -1 on a null entry. -2 on an invalid entry.
400
+ *
401
+ * @param id Entry to examine the private data.
402
+ * @param offset The windows offset of the data.
403
+ * @param linuxdiff The linux difference of the data.
404
+ * @param macdiff The mac os x difference of the data.
405
+ * @return The index of the corresponding pdata field, -1 for null, -2 for invalid.
406
+ */
407
+ native get_pdata_cbase_safe(id, offset, linuxdiff=5, macdiff=5);
408
+
409
+
410
+
411
+
412
+ // This is the callback from the module, this handles any fatal errors.
413
+ // This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists.
414
+ // Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing.
415
+ // Any other return value will fail the plugin.
416
+ // You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin.
417
+ // Do not modify this!
418
+ public __fatal_ham_error(Ham:id, HamError:err, const reason[])
419
+ {
420
+
421
+ new func=get_func_id("HamFilter", -1);
422
+ new bool:fail=true;
423
+
424
+ if (func != -1 && callfunc_begin_i(func, -1)==1)
425
+ {
426
+ callfunc_push_int(_:id);
427
+ callfunc_push_int(_:err);
428
+ callfunc_push_str(reason, false);
429
+ if (callfunc_end()==PLUGIN_HANDLED)
430
+ {
431
+ fail=false;
432
+ }
433
+ }
434
+ if (fail)
435
+ {
436
+ set_fail_state(reason);
437
+ }
438
+
439
+ }