@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,1127 @@
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
+ // Fakemeta Functions
12
+ //
13
+
14
+ #if defined _fakemeta_included
15
+ #endinput
16
+ #endif
17
+ #define _fakemeta_included
18
+
19
+ #include <fakemeta_const>
20
+
21
+ #pragma reqlib fakemeta
22
+ #if !defined AMXMODX_NOAUTOLOAD
23
+ #pragma loadlib fakemeta
24
+ #endif
25
+
26
+ /**
27
+ * Returns entvar data from an entity. Use the pev_* enum (in fakemeta_const.inc) to specify which data you want retrieved.
28
+ *
29
+ * @note This function uses "read_data" style data syntax. It returns integer values,
30
+ * by-references float data, and sets a buffer for string data.
31
+ *
32
+ * @note If retrieving strings, you may optionally get a pointer into the global string table. Depending on
33
+ * your situation, there are two ways to do this.
34
+ * 1: This simply gets the pointer.
35
+ * new ptr = pev(entid, pev_classname)
36
+ * 2: The pointer will be stored in ptr AND the actual string is retrieved.
37
+ * new ptr, classname[32]
38
+ * pev(entid, pev_classname, ptr, classname, 31)
39
+ *
40
+ * @param _index The entity index to lookup.
41
+ * @param _value The pev field to lookup (look in fakemeta_const.inc)
42
+ */
43
+ native pev(_index,_value,any:...);
44
+
45
+ /**
46
+ * Sets entvar data for an entity. Use the pev_* enum from fakemeta_const.inc for reference.
47
+ *
48
+ * @note Setting string data will automatically allocate a new string (via AllocString)
49
+ * If you have a string already allocated with your own call to AllocString, use
50
+ * set_pev_string_ptr instead.
51
+ *
52
+ * @param _index The entity index to set the value on.
53
+ * @param _value The pev field to set, (look in fakemeta_const.inc)
54
+ */
55
+ native set_pev(_index,_value,any:...);
56
+
57
+ /**
58
+ * Use this native to set a pev field to a string that is already allocated (via a function such
59
+ * as EngFunc_AllocString).
60
+ *
61
+ * @note If you specify _value as anything other than string fields, an error will be thrown.
62
+ * @note Pass 0 as the _string field to set it to an empty string.
63
+ *
64
+ * @param _index The entity index to set the value on.
65
+ * @param _value The pev field to set - MUST be a string field.
66
+ * @param _string The string handle, retrieved from places like AllocString.
67
+ */
68
+ native set_pev_string(_index, _value, _string);
69
+
70
+
71
+ /**
72
+ * Checks the validity of an entity.
73
+ *
74
+ * @param entindex The entity id to check.
75
+ *
76
+ * @return 0 on invalid entity
77
+ * 1 on entity is valid
78
+ * 2 on entity is valid and it has private data (safe to use pdata natives on).
79
+ */
80
+ native pev_valid(entindex);
81
+
82
+ /**
83
+ * Returns the serial number for each entity. The serial number is a unique identity
84
+ * generated when an entity is created.
85
+ *
86
+ * @param entindex The entity id.
87
+ *
88
+ * @return The serial number for the entity.
89
+ */
90
+ native pev_serial(entindex);
91
+
92
+ /* Returns any global variable inside globalvars_t structure. Use the glb_* enum.
93
+ *
94
+ * When returning data from glb_pStringBase (the global string table), you may give a pointer into that table
95
+ * in order to get different strings.
96
+ * Example:
97
+ * new model[128]
98
+ * new ptr = pev(id, pev_viewmodel)
99
+ * global_get(glb_pStringBase, ptr, model, 127)
100
+ */
101
+ native global_get(_value, any:...);
102
+
103
+ /**
104
+ * Returns a integer from an entity's private data.
105
+ *
106
+ * _linuxdiff value is what to add to the _Offset for linux servers.
107
+ * _macdiff value is what to add to the _Offset for os x servers.
108
+ *
109
+ * A log error is thrown on invalid _index and _Offset.
110
+ *
111
+ * @param _index Entity index.
112
+ * @param _Offset Offset to search.
113
+ * @param _linuxdiff Linux difference.
114
+ * @param _macdiff Mac OS X difference.
115
+ * @return An integer value is returned.
116
+ */
117
+ native get_pdata_int(_index, _Offset, _linuxdiff = 5, _macdiff = 5);
118
+
119
+ /**
120
+ * Sets an integer to an entity's private data.
121
+ *
122
+ * _linuxdiff value is what to add to the _Offset for linux servers.
123
+ * _macdiff value is what to add to the _Offset for os x servers.
124
+ *
125
+ * A log error is thrown on invalid _index and _Offset.
126
+ *
127
+ * @param _index Entity index.
128
+ * @param _Offset Offset to search.
129
+ * @param _Value Value to set.
130
+ * @param _linuxdiff Linux difference.
131
+ * @param _macdiff Mac OS X difference.
132
+ * @return 1 on success.
133
+ */
134
+ native set_pdata_int(_index, _Offset, _Value, _linuxdiff = 5, _macdiff = 5);
135
+
136
+ /**
137
+ * Returns a float from an entity's private data.
138
+ *
139
+ * _linuxdiff value is what to add to the _Offset for linux servers.
140
+ * _macdiff value is what to add to the _Offset for os x servers.
141
+ *
142
+ * A log error is thrown on invalid _index and _Offset.
143
+ *
144
+ * @param _index Entity index.
145
+ * @param _Offset Offset to search.
146
+ * @param _linuxdiff Linux difference.
147
+ * @param _macdiff Mac OS X difference.
148
+ * @return An float value is returned.
149
+ */
150
+ native Float:get_pdata_float(_index, _Offset, _linuxdiff = 5, _macdiff = 5);
151
+
152
+ /**
153
+ * Sets a float to an entity's private data.
154
+ *
155
+ * _linuxdiff value is what to add to the _Offset for linux servers.
156
+ * _macdiff value is what to add to the _Offset for os x servers.
157
+ *
158
+ * A log error is thrown on invalid _index and _Offset.
159
+ *
160
+ * @param _index Entity index.
161
+ * @param _Offset Offset to search.
162
+ * @param _Value Value to set.
163
+ * @param _linuxdiff Linux difference.
164
+ * @param _macdiff Mac OS X difference.
165
+ * @return 1 on success.
166
+ */
167
+ native set_pdata_float(_index, _Offset, Float:_Value, _linuxdiff = 5, _macdiff = 5);
168
+
169
+ /**
170
+ * Tries to retrieve an edict pointer from an entity's private data.
171
+ *
172
+ * This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
173
+ * get_pdata_ent searches in increments of 1.
174
+ *
175
+ * _linuxdiff value is what to add to the _offset for linux servers.
176
+ * _macdiff value is what to add to the _offset for os x servers.
177
+ *
178
+ * A log error is thrown on invalid _index and _Offset.
179
+ *
180
+ * @param _index Entity index.
181
+ * @param _offset Offset to search.
182
+ * @param _linuxdiff Linux difference.
183
+ * @param _macdiff Mac OS X difference.
184
+ * @return -2 if an invalid entity was found.
185
+ * -1 if an empty entity was found.
186
+ * Otherwise, an entity index is returned.
187
+ */
188
+ native get_pdata_ent(_index, _offset, _linuxdiff = 20, _macdiff = 20);
189
+
190
+ /**
191
+ * Sets an edict pointer to an entity's private data.
192
+ *
193
+ * This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
194
+ * set_pdata_ent searches in increments of 1.
195
+ *
196
+ * _linuxdiff value is what to add to the _offset for linux servers.
197
+ * _macdiff value is what to add to the _offset for os x servers.
198
+ *
199
+ * A log error is thrown on invalid _index and _offset.
200
+ *
201
+ * @param _index Entity index.
202
+ * @param _offset Offset to search.
203
+ * @param _value Value to set.
204
+ * @param _linuxdiff Linux difference.
205
+ * @param _macdiff Mac OS X difference.
206
+ * @return 1 on success.
207
+ */
208
+ native set_pdata_ent(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
209
+
210
+ /**
211
+ * Returns a boolean from an entity's private data.
212
+ *
213
+ * This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
214
+ * get_pdata_bool searches in increments of 1.
215
+ *
216
+ * _linuxdiff value is what to add to the _offset for linux servers.
217
+ * _macdiff value is what to add to the _offset for os x servers.
218
+ *
219
+ * A log error is thrown on invalid _index and _offset.
220
+ *
221
+ * @param _index Entity index.
222
+ * @param _offset Offset to search.
223
+ * @param _linuxdiff Linux difference.
224
+ * @param _macdiff Mac OS X difference.
225
+ * @return An boolean value is returned.
226
+ */
227
+ native bool:get_pdata_bool(_index, _offset, _linuxdiff = 20, _macdiff = 20);
228
+
229
+ /**
230
+ * Sets a boolean to an entity's private data.
231
+ *
232
+ * This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
233
+ * set_pdata_bool searches in increments of 1.
234
+ *
235
+ * _linuxdiff value is what to add to the _offset for linux servers.
236
+ * _macdiff value is what to add to the _offset for os x servers.
237
+ *
238
+ * A log error is thrown on invalid _index and _offset.
239
+ *
240
+ * @param _index Entity index.
241
+ * @param _offset Offset to search.
242
+ * @param _value Value to set.
243
+ * @param _linuxdiff Linux difference.
244
+ * @param _macdiff Mac OS X difference.
245
+ * @return 1 on success.
246
+ */
247
+ native set_pdata_bool(_index, _offset, bool:_value, _linuxdiff = 20, _macdiff = 20);
248
+
249
+ /**
250
+ * Returns a byte value from an entity's private data.
251
+ *
252
+ * This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
253
+ * get_pdata_byte searches in increments of 1.
254
+ *
255
+ * _linuxdiff value is what to add to the _offset for linux servers.
256
+ * _macdiff value is what to add to the _offset for os x servers.
257
+ *
258
+ * A log error is thrown on invalid _index and _offset.
259
+ *
260
+ * @param _index Entity index.
261
+ * @param _offset Offset to search.
262
+ * @param _linuxdiff Linux difference.
263
+ * @param _macdiff Mac OS X difference.
264
+ * @return A byte value is returned.
265
+ */
266
+ native get_pdata_byte(_index, _offset, _linuxdiff = 20, _macdiff = 20);
267
+
268
+ /**
269
+ * Sets a byte value to an entity's private data.
270
+ *
271
+ * This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
272
+ * set_pdata_byte searches in increments of 1.
273
+ *
274
+ * _linuxdiff value is what to add to the _offset for linux servers.
275
+ * _macdiff value is what to add to the _offset for os x servers.
276
+ *
277
+ * A log error is thrown on invalid _index and _offset.
278
+ *
279
+ * @param _index Entity index.
280
+ * @param _offset Offset to search.
281
+ * @param _value Value to set.
282
+ * @param _linuxdiff Linux difference.
283
+ * @param _macdiff Mac OS X difference.
284
+ * @return 1 on success.
285
+ */
286
+ native set_pdata_byte(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
287
+
288
+ /**
289
+ * Returns a short value from an entity's private data.
290
+ *
291
+ * This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
292
+ * get_pdata_short searches in increments of 1.
293
+ *
294
+ * _linuxdiff value is what to add to the _offset for linux servers.
295
+ * _macdiff value is what to add to the _offset for os x servers.
296
+ *
297
+ * A log error is thrown on invalid _index and _offset.
298
+ *
299
+ * @param _index Entity index.
300
+ * @param _offset Offset to search.
301
+ * @param _linuxdiff Linux difference.
302
+ * @param _macdiff Mac OS X difference.
303
+ * @return A short value is returned.
304
+ */
305
+ native get_pdata_short(_index, _offset, _linuxdiff = 20, _macdiff = 20);
306
+
307
+ /**
308
+ * Sets a short value to an entity's private data.
309
+ *
310
+ * This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
311
+ * set_pdata_short searches in increments of 1.
312
+ *
313
+ * _linuxdiff value is what to add to the _offset for linux servers.
314
+ * _macdiff value is what to add to the _offset for os x servers.
315
+ *
316
+ * A log error is thrown on invalid _index and _offset.
317
+ *
318
+ * @param _index Entity index.
319
+ * @param _offset Offset to search.
320
+ * @param _value Value to set.
321
+ * @param _linuxdiff Linux difference.
322
+ * @param _macdiff Mac OS X difference.
323
+ * @return 1 on success.
324
+ */
325
+ native set_pdata_short(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
326
+
327
+ /**
328
+ * Returns a vector from an entity's private data.
329
+ *
330
+ * This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
331
+ * get_pdata_vector searches in increments of 1.
332
+ *
333
+ * _linuxdiff value is what to add to the _offset for linux servers.
334
+ * _macdiff value is what to add to the _offset for os x servers.
335
+ *
336
+ * A log error is thrown on invalid _index and _offset.
337
+ *
338
+ * @param _index Entity index.
339
+ * @param _offset Offset to search.
340
+ * @param _output Vector returned by reference.
341
+ * @param _linuxdiff Linux difference.
342
+ * @param _macdiff Mac OS X difference.
343
+ * @return 1 on success.
344
+ */
345
+ native get_pdata_vector(_index, _offset, Float:_output[3], _linuxdiff = 20, _macdiff = 20);
346
+
347
+ /**
348
+ * Sets a vector to an entity's private data.
349
+ *
350
+ * This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
351
+ * set_pdata_vector searches in increments of 1.
352
+ *
353
+ * _linuxdiff value is what to add to the _offset for linux servers.
354
+ * _macdiff value is what to add to the _offset for os x servers.
355
+ *
356
+ * A log error is thrown on invalid _index and _Offset.
357
+ *
358
+ * @param _index Entity index.
359
+ * @param _offset Offset to search.
360
+ * @param _origin Value to set.
361
+ * @param _linuxdiff Linux difference.
362
+ * @param _macdiff Mac OS X difference.
363
+ * @return 1 on success.
364
+ */
365
+ native set_pdata_vector(_index, _offset, Float:_origin[3], _linuxdiff = 20, _macdiff = 20);
366
+
367
+ /**
368
+ * Tries to retrieve an edict (entity encapsulation) pointer from an entity's private data.
369
+ *
370
+ * This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
371
+ * get_pdata_ehandle searches in increments of 1.
372
+ *
373
+ * _linuxdiff value is what to add to the _offset for linux servers.
374
+ * _macdiff value is what to add to the _offset for os x servers.
375
+ *
376
+ * A log error is thrown on invalid _index and _offset.
377
+ *
378
+ * @param _index Entity index.
379
+ * @param _offset Offset to search.
380
+ * @param _linuxdiff Linux difference.
381
+ * @param _macdiff Mac OS X difference.
382
+ * @return -2 if an invalid entity was found.
383
+ * -1 if an empty entity was found.
384
+ * 0 if serialnumber is not matching.
385
+ * Otherwise, an entity index is returned.
386
+ */
387
+ native get_pdata_ehandle(_index, _offset, _linuxdiff = 20, _macdiff = 20);
388
+
389
+ /**
390
+ * Sets an edict (entity encapsulation) pointer to an entity's private data.
391
+ *
392
+ * This function is byte-addressable. Unlike set_pdata_int() which searches in byte increments of 4,
393
+ * set_pdata_ehandle searches in increments of 1.
394
+ *
395
+ * _linuxdiff value is what to add to the _offset for linux servers.
396
+ * _macdiff value is what to add to the _offset for os x servers.
397
+ *
398
+ * A log error is thrown on invalid _index and _Offset.
399
+ *
400
+ * @param _index Entity index.
401
+ * @param _offset Offset to search.
402
+ * @param _value Value to set.
403
+ * @param _linuxdiff Linux difference.
404
+ * @param _macdiff Mac OS X difference.
405
+ * @return 1 on success.
406
+ */
407
+ native set_pdata_ehandle(_index, _offset, _value, _linuxdiff = 20, _macdiff = 20);
408
+
409
+ /* Registers a forward.
410
+ * Returns an id you can pass to unregister_forward
411
+ */
412
+ native register_forward(_forwardType,const _function[],_post=0);
413
+
414
+ /* Unregisters a forward.
415
+ * The registerId must be from register_forward, and
416
+ * post/forwardtype must match what you registered the forward as.
417
+ */
418
+ native unregister_forward(_forwardType, registerId, post=0);
419
+
420
+ /* Returns data for metamod */
421
+ native forward_return(type,any:...);
422
+
423
+ /* Returns the original return value of an engine function.
424
+ * This is only valid in forwards that were registered as post.
425
+ *
426
+ * get_orig_retval() - no params, retrieves integer return value
427
+ * get_orig_retval(&Float:value) - retrieves float return value by reference
428
+ * get_orig_retval(value[], len) - retrives string return value
429
+ */
430
+ native get_orig_retval(any:...);
431
+
432
+ native engfunc(type,any:...);
433
+ native dllfunc(type,any:...);
434
+
435
+ //only use this with functions that pass a Trace
436
+ // get: zero extra params - return int, one extra param = byref float or vector
437
+ // set: use anything
438
+ native get_tr(TraceResult:tr_member, any:...);
439
+ native set_tr(TraceResult:tr_member, any:...);
440
+
441
+ //Upgraded version takes in a TraceResult handle, optionally passed in as the last parameter to the
442
+ //TraceResult forward. Use 0 to specify the global traceresult handle set from calling
443
+ // some of the Engfucs.
444
+ native get_tr2(tr_handle, any:tr_member, any:...);
445
+ native set_tr2(tr_handle, any:tr_member, any:...);
446
+
447
+ /**
448
+ * Creates a traceresult handle. This value should never be altered.
449
+ * The handle can be used in get/set_tr2 and various traceresult engine functions.
450
+ *
451
+ * NOTE: You must call free_tr2() on every handle made with create_tr2().
452
+ *
453
+ * @return A new TraceResult handle.
454
+ */
455
+ native create_tr2();
456
+
457
+ /**
458
+ * Frees a traceresult handle created with free_tr2(). Do not call
459
+ * this more than once per handle, or on handles not created through
460
+ * create_tr2().
461
+ *
462
+ * @param tr_handle TraceResult handle created via create_tr2().
463
+ * @noreturn
464
+ */
465
+ native free_tr2(tr_handle);
466
+
467
+ //Same as above, use either a kvd_handle or 0 for global reserved kvd data
468
+ //kvd_handle is passed by the kvd hook, last param
469
+ native get_kvd(kvd_handle, KeyValueData:member, any:...);
470
+
471
+ //Using set_kvd with the handle from the hook for anything under KV_fHandled
472
+ // is considered an undefined operation (it could crash). You should fire a new
473
+ // keyvalues structure rather than changing the internal engine strings.
474
+ native set_kvd(kvd_handle, KeyValueData:member, any:...);
475
+
476
+ /**
477
+ * Creates a KeyValueData handle.
478
+ *
479
+ * @note Handles should be freed using free_kvd().
480
+ *
481
+ * @return New KeyValueData handle
482
+ */
483
+ native create_kvd();
484
+
485
+ /**
486
+ * Frees a KeyValueData handle.
487
+ *
488
+ * @param kvd_handle KeyValueData handle
489
+ *
490
+ * @noreturn
491
+ */
492
+ native free_kvd(kvd_handle);
493
+
494
+ // These functions are used with the clientdata data structure (FM_UpdateClientData)
495
+ // Get: 0 extra params - Return integer; 1 extra param - by ref float or vector; 2 extra params - string and length
496
+ // Set: Use anything
497
+ // Use 0 for cd_handle to specify the global clientdata handle
498
+ native get_cd(cd_handle, ClientData:member, any:...);
499
+ native set_cd(cd_handle, ClientData:member, any:...);
500
+
501
+ // These functions are used with the entity_state data structure (FM_AddToFullPack)
502
+ // Get: 0 extra params - Return integer; 1 extra param - by ref float or vector or array
503
+ // Set: Use anything
504
+ // Use 0 for es_handle to specify the global entity_state handle
505
+ native get_es(es_handle, EntityState:member, any:...);
506
+ native set_es(es_handle, EntityState:member, any:...);
507
+
508
+ // These functions are used with the usercmd data structure (FM_CmdStart)
509
+ // Get: 0 extra params - Return integer; 1 extra param - by ref float or vector
510
+ // Set: Use anything
511
+ // Use 0 for uc_handle to specify the global usercmd handle
512
+ native get_uc(uc_handle, UserCmd:member, any:...);
513
+ native set_uc(uc_handle, UserCmd:member, any:...);
514
+
515
+ //NOTE that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset
516
+ //In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half.
517
+ //Gets a string from a private offset. If byref is false, the string is treated as static rather than dynamic.
518
+ //linux value is what to add to the offset for linux servers.
519
+ //mac value is what to add to the offset for os x servers. Default (cellmin) means that linux value will be used.
520
+ //this cannot use a default value due to older version using an awkward default value.
521
+ native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux, mac=cellmin);
522
+
523
+ //Sets a string in a private offset.
524
+ //realloc = -1 - nonbyref copy (static
525
+ //realloc = 0 - copy byref, no realloc *(char **)
526
+ //realloc = 1 - reallocate new string with free+malloc
527
+ //realloc = 2 - reallocate new string with delete[]+new[]
528
+ //linux value is what to add to the offset for linux servers.
529
+ //mac value iswhat to add to the offset for os x servers.
530
+ //this cannot use a default value due to older version using an awkward default value.
531
+ native set_pdata_string(entity, offset, const source[], realloc=2, linux, mac=cellmin);
532
+
533
+ // Copies the given infoBuffer pointer into out[]
534
+ // An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer
535
+ native copy_infokey_buffer(infoBuffer, out[], maxlen);
536
+
537
+
538
+ /**
539
+ * Looks up the sequence for the entity.
540
+ *
541
+ * @param entity The entity id to lookup.
542
+ * @param name The sequence name to lookup, case insensitive. ("JUMP" would match "jump")
543
+ * @param framerate The framerate of the sequence, if found.
544
+ * @param loops Whether or not the sequence loops.
545
+ * @param groundspeed The groundspeed setting of the sequence.
546
+ * @return -1 on failed lookup, the sequence number on successful lookup.
547
+ */
548
+ native lookup_sequence(entity, const name[], &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
549
+
550
+ /**
551
+ * Sets a bone controller with the specified value.
552
+ *
553
+ * @param entity The entity id to set the value on.
554
+ * @param controller Which controller to set (0 through 3).
555
+ * @param value The value to set it to.
556
+ * @return The percentage that the controller is extended (0.0 through 1.0)
557
+ */
558
+ native Float:set_controller(entity, controller, Float:value);
559
+
560
+ /**
561
+ * Retrieves an integer value from an entity's private data based off a class
562
+ * and member name.
563
+ *
564
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
565
+ * member offset into the plugin, this native instead retrieves the
566
+ * necessary offset from the AMXX gamedata files at runtime, based on the
567
+ * provided class and member name.
568
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
569
+ * offset and typing checks.
570
+ * @note This native is used to access the following (C++/engine) data types:
571
+ * integer, boolean, short, character, pointer, structure, class,
572
+ * stringint and function. Unsigned variants (if applicable) are supported
573
+ * and will be converted automatically.
574
+ *
575
+ * @param entity Entity index
576
+ * @param class Class name
577
+ * @param member Member name
578
+ * @param element Element to retrieve (starting from 0) if member is an array
579
+ *
580
+ * @return Integer value
581
+ * @error If an invalid entity is provided, either class or member is
582
+ * empty, no offset is found or an invalid offset is retrieved,
583
+ * or the data type does not match, an error will be thrown.
584
+ */
585
+ native any:get_ent_data(entity, const class[], const member[], element = 0);
586
+
587
+ /**
588
+ * Sets an integer value to an entity's private data based off a class
589
+ * and member name.
590
+ *
591
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
592
+ * member offset into the plugin, this native instead retrieves the
593
+ * necessary offset from the AMXX gamedata files at runtime, based on the
594
+ * provided class and member name.
595
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
596
+ * offset and typing checks.
597
+ * @note This native is used to access the following (C++/engine) data types:
598
+ * integer, boolean, short, character, pointer, stringint and function.
599
+ * Unsigned variants (if applicable) are supported and will be converted
600
+ * automatically.
601
+ *
602
+ * @param entity Entity index
603
+ * @param class Class name
604
+ * @param member Member name
605
+ * @param value Value to set
606
+ * @param element Element to set (starting from 0) if member is an array
607
+ *
608
+ * @noreturn
609
+ * @error If an invalid entity is provided, either class or member is
610
+ * empty, no offset is found or an invalid offset is retrieved,
611
+ * or the data type does not match, an error will be thrown.
612
+ */
613
+ native set_ent_data(entity, const class[], const member[], any:value, element = 0);
614
+
615
+ /**
616
+ * Retrieves a float value from an entity's private data based off a class
617
+ * and member name.
618
+ *
619
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
620
+ * member offset into the plugin, this native instead retrieves the
621
+ * necessary offset from the AMXX gamedata files at runtime, based on the
622
+ * provided class and member name.
623
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
624
+ * offset and typing checks.
625
+ *
626
+ * @param entity Entity index
627
+ * @param class Class name
628
+ * @param member Member name
629
+ * @param element Element to retrieve (starting from 0) if member is an array
630
+ *
631
+ * @return Float value
632
+ * @error If an invalid entity is provided, either class or member is
633
+ * empty, no offset is found or an invalid offset is retrieved,
634
+ * or the data type does not match, an error will be thrown.
635
+ */
636
+ native Float:get_ent_data_float(entity, const class[], const member[], element = 0);
637
+
638
+ /**
639
+ * Sets a float value to an entity's private data based off a class
640
+ * and member name.
641
+ *
642
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
643
+ * member offset into the plugin, this native instead retrieves the
644
+ * necessary offset from the AMXX gamedata files at runtime, based on the
645
+ * provided class and member name.
646
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
647
+ * offset and typing checks.
648
+ *
649
+ * @param entity Entity index
650
+ * @param class Class name
651
+ * @param member Member name
652
+ * @param value Value to set
653
+ * @param element Element to set (starting from 0) if member is an array
654
+ *
655
+ * @noreturn
656
+ * @error If an invalid entity is provided, either class or member is
657
+ * empty, no offset is found or an invalid offset is retrieved,
658
+ * or the data type does not match, an error will be thrown.
659
+ */
660
+ native set_ent_data_float(entity, const class[], const member[], Float:value, element = 0);
661
+
662
+ /**
663
+ * Retrieves a vector from an entity's private data based off a class and member name.
664
+ *
665
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
666
+ * member offset into the plugin, this native instead retrieves the
667
+ * necessary offset from the AMXX gamedata files at runtime, based on the
668
+ * provided class and member name.
669
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
670
+ * offset and typing checks.
671
+ *
672
+ * @param entity Entity index
673
+ * @param class Class name
674
+ * @param member Member name
675
+ * @param value Vector buffer to store data in
676
+ * @param element Element to retrieve (starting from 0) if member is an array
677
+ *
678
+ * @noreturn
679
+ * @error If an invalid entity is provided, either class or member is
680
+ * empty, no offset is found or an invalid offset is retrieved,
681
+ * or the data type does not match, an error will be thrown.
682
+ */
683
+ native get_ent_data_vector(entity, const class[], const member[], Float:value[3], element = 0);
684
+
685
+ /**
686
+ * Sets a vector to an entity's private data based off a class and member name.
687
+ *
688
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
689
+ * member offset into the plugin, this native instead retrieves the
690
+ * necessary offset from the AMXX gamedata files at runtime, based on the
691
+ * provided class and member name.
692
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
693
+ * offset and typing checks.
694
+ *
695
+ * @param entity Entity index
696
+ * @param class Class name
697
+ * @param member Member name
698
+ * @param value Vector to set
699
+ * @param element Element to set (starting from 0) if member is an array
700
+ *
701
+ * @noreturn
702
+ * @error If an invalid entity is provided, either class or member is
703
+ * empty, no offset is found or an invalid offset is retrieved,
704
+ * or the data type does not match, an error will be thrown.
705
+ */
706
+ native set_ent_data_vector(entity, const class[], const member[], Float:value[3], element = 0);
707
+
708
+ /**
709
+ * Retrieves an entity index from an entity's private data based off a class
710
+ * and member name.
711
+ *
712
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
713
+ * member offset into the plugin, this native instead retrieves the
714
+ * necessary offset from the AMXX gamedata files at runtime, based on the
715
+ * provided class and member name.
716
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
717
+ * offset and typing checks.
718
+ * @note This native is used to access the following (C++/engine) data types:
719
+ * classptr, entvars, edict and ehandle.
720
+ *
721
+ * @param entity Entity index
722
+ * @param class Class name
723
+ * @param member Member name
724
+ * @param element Element to retrieve (starting from 0) if member is an array
725
+ *
726
+ * @return Entity index if found, -1 otherwise
727
+ * @error If an invalid entity is provided, either class or member is
728
+ * empty, no offset is found or an invalid offset is retrieved,
729
+ * or the data type does not match, an error will be thrown.
730
+ */
731
+ native get_ent_data_entity(entity, const class[], const member[], element = 0);
732
+
733
+ /**
734
+ * Sets an entity index to an entity's private data based off a class
735
+ * and member name.
736
+ *
737
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
738
+ * member offset into the plugin, this native instead retrieves the
739
+ * necessary offset from the AMXX gamedata files at runtime, based on the
740
+ * provided class and member name.
741
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
742
+ * offset and typing checks.
743
+ * @note This native is used to access the following (C++/engine) data types:
744
+ * classptr, entvars, edict and ehandle.
745
+ * @note Pass -1 as value to act as C++ NULL.
746
+ *
747
+ * @param entity Entity index
748
+ * @param class Class name
749
+ * @param member Member name
750
+ * @param value Entity index to set
751
+ * @param element Element to set (starting from 0) if member is an array
752
+ *
753
+ * @noreturn
754
+ * @error If an invalid entity or value is provided, either class or member
755
+ * is empty, no offset is found or an invalid offset is retrieved,
756
+ * or the data type does not match, an error will be thrown.
757
+ */
758
+ native set_ent_data_entity(entity, const class[], const member[], value, element = 0);
759
+
760
+ /**
761
+ * Retrieves a string from an entity's private data based off a class and member name.
762
+ *
763
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
764
+ * member offset into the plugin, this native instead retrieves the
765
+ * necessary offset from the AMXX gamedata files at runtime, based on the
766
+ * provided class and member name.
767
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
768
+ * offset and typing checks.
769
+ * @note This native is used to access the following (C++/engine) data types:
770
+ * string, stringptr.
771
+ *
772
+ * @param entity Entity index
773
+ * @param class Class name
774
+ * @param member Member name
775
+ * @param value Buffer to store data in
776
+ * @param maxlen Maximum size of the buffer
777
+ * @param element Element to retrieve (starting from 0) if member is an array
778
+ *
779
+ * @return Number of cells written to buffer
780
+ * @error If an invalid entity is provided, either class or member is
781
+ * empty, no offset is found or an invalid offset is retrieved,
782
+ * or the data type does not match, an error will be thrown.
783
+ */
784
+ native get_ent_data_string(entity, const class[], const member[], value[], maxlen, element = 0);
785
+
786
+ /**
787
+ * Sets a string to an entity's private data based off a class and member name.
788
+ *
789
+ * @note Unlike the [get|set]_pdata_* natives that require compiling the class
790
+ * member offset into the plugin, this native instead retrieves the
791
+ * necessary offset from the AMXX gamedata files at runtime, based on the
792
+ * provided class and member name.
793
+ * @note This native is safer than [get|set]_pdata_* as it can perform stricter
794
+ * offset and typing checks.
795
+ * @note This native is used to access the following (C++/engine) data types:
796
+ * string, stringptr.
797
+ *
798
+ * @param entity Entity index
799
+ * @param class Class name
800
+ * @param member Member name
801
+ * @param value String to set
802
+ * @param element Element to set (starting from 0) if member is an array
803
+ *
804
+ * @return Number of cells written to buffer
805
+ * @error If an invalid entity is provided, either class or member is
806
+ * empty, no offset is found or an invalid offset is retrieved,
807
+ * or the data type does not match, an error will be thrown.
808
+ */
809
+ native set_ent_data_string(entity, const class[], const member[], const value[], element = 0);
810
+
811
+ /**
812
+ * Retrieves the size of array of n entity class member.
813
+ *
814
+ * @param class Class name
815
+ * @param member Member name
816
+ *
817
+ * @return Size of array (in elements), otherwise 1 if member is not an array
818
+ * @error If either class or member is empty, no offset is found or an invalid
819
+ * offset is retrieved, an error will be thrown.
820
+ */
821
+ native get_ent_data_size(const class[], const member[]);
822
+
823
+ /**
824
+ * Finds a offset based off an entity class and member name.
825
+ *
826
+ * @param class Class name
827
+ * @param member Member name
828
+ * @param type Optional variable to store member type in (FIELD_* constants)
829
+ * @param arraysize Optional variable to store array size in, if member is an array
830
+ * @param unsigned Optional variable to store whether member is unsigned (short and char types only)
831
+ *
832
+ * @return Class member offset
833
+ * @error If either class or member is empty, no offset is found or an invalid
834
+ * offset is retrieved, an error will be thrown.
835
+ */
836
+ native find_ent_data_info(const class[], const member[], &FieldType:type = FIELD_NONE, &arraysize = 0, &bool:unsigned = false);
837
+
838
+
839
+ /**
840
+ * Retrieves an integer value from the gamerules object based off a class
841
+ * and member name.
842
+ *
843
+ * @note This native is used to access the following (C++/engine) data types:
844
+ * integer, boolean, short, character, pointer, structure, class,
845
+ * stringint and function. Unsigned variants (if applicable) are supported
846
+ * and will be converted automatically.
847
+ *
848
+ * @param class Class name
849
+ * @param member Member name
850
+ * @param element Element to retrieve (starting from 0) if member is an array
851
+ *
852
+ * @return Integer value
853
+ * @error If member is empty, no offset is found or an invalid offset
854
+ * is retrieved, or the data type does not match, an error will
855
+ * be thrown.
856
+ */
857
+ native any:get_gamerules_int(const class[], const member[], element = 0);
858
+
859
+ /**
860
+ * Sets an integer value to the gamerules objecta based off a class
861
+ * and member name.
862
+ *
863
+ * @note This native is used to access the following (C++/engine) data types:
864
+ * integer, boolean, short, character, pointer, stringint and function.
865
+ * Unsigned variants (if applicable) are supported and will be converted
866
+ * automatically.
867
+ *
868
+ * @param class Class name
869
+ * @param member Member name
870
+ * @param value Value to set
871
+ * @param element Element to set (starting from 0) if member is an array
872
+ *
873
+ * @noreturn
874
+ * @error If member is empty, no offset is found or an invalid offset
875
+ * is retrieved, or the data type does not match, an error will
876
+ * be thrown.
877
+ */
878
+ native set_gamerules_int(const class[], const member[], any:value, element = 0);
879
+
880
+ /**
881
+ * Retrieves a float value from the gamerules object based off a class
882
+ * and member name.
883
+ *
884
+ * @param class Class name
885
+ * @param member Member name
886
+ * @param element Element to retrieve (starting from 0) if member is an array
887
+ *
888
+ * @return Float value
889
+ * @error If member is empty, no offset is found or an invalid offset
890
+ * is retrieved, or the data type does not match, an error will
891
+ * be thrown.
892
+ */
893
+ native Float:get_gamerules_float(const class[], const member[], element = 0);
894
+
895
+ /**
896
+ * Sets a float value to the gamerules object based off a class
897
+ * and member name.
898
+ *
899
+ * @param class Class name
900
+ * @param member Member name
901
+ * @param value Value to set
902
+ * @param element Element to set (starting from 0) if member is an array
903
+ *
904
+ * @noreturn
905
+ * @error If member is empty, no offset is found or an invalid offset
906
+ * is retrieved, or the data type does not match, an error will
907
+ * be thrown.
908
+ */
909
+ native set_gamerules_float(const class[], const member[], Float:value, element = 0);
910
+
911
+ /**
912
+ * Retrieves a vector from the gamerules object based off a class and member name.
913
+ *
914
+ * @param class Class name
915
+ * @param member Member name
916
+ * @param value Vector buffer to store data in
917
+ * @param element Element to retrieve (starting from 0) if member is an array
918
+ *
919
+ * @noreturn
920
+ * @error If member is empty, no offset is found or an invalid offset
921
+ * is retrieved, or the data type does not match, an error will
922
+ * be thrown.
923
+ */
924
+ native get_gamerules_vector(const class[], const member[], Float:value[3], element = 0);
925
+
926
+ /**
927
+ * Sets a vector to the gamerules object based off a class and member name.
928
+ *
929
+ * @param class Class name
930
+ * @param member Member name
931
+ * @param value Vector to set
932
+ * @param element Element to set (starting from 0) if member is an array
933
+ *
934
+ * @noreturn
935
+ * @error If member is empty, no offset is found or an invalid offset
936
+ * is retrieved, or the data type does not match, an error will
937
+ * be thrown.
938
+ */
939
+ native set_gamerules_vector(const class[], const member[], Float:value[3], element = 0);
940
+
941
+ /**
942
+ * Retrieves an entity index from the gamerules object based off a class
943
+ * and member name.
944
+ *
945
+ * @note This native is used to access the following (C++/engine) data types:
946
+ * classptr, entvars, edict and ehandle.
947
+ *
948
+ * @param class Class name
949
+ * @param member Member name
950
+ * @param element Element to retrieve (starting from 0) if member is an array
951
+ *
952
+ * @return Entity index if found, -1 otherwise
953
+ * @error If member is empty, no offset is found or an invalid offset
954
+ * is retrieved, or the data type does not match, an error will
955
+ * be thrown.
956
+ */
957
+ native get_gamerules_entity(const class[], const member[], element = 0);
958
+
959
+ /**
960
+ * Sets an entity index to the gamerules object based off a class
961
+ * and member name.
962
+ *
963
+ * @note This native is used to access the following (C++/engine) data types:
964
+ * classptr, entvars, edict and ehandle.
965
+ * @note Pass -1 as value to act as C++ NULL.
966
+ *
967
+ * @param class Class name
968
+ * @param member Member name
969
+ * @param value Entity index to set
970
+ * @param element Element to set (starting from 0) if member is an array
971
+ *
972
+ * @noreturn
973
+ * @error If member is empty, no offset is found or an invalid offset
974
+ * is retrieved, or the data type does not match, an error will
975
+ * be thrown.
976
+ */
977
+ native set_gamerules_entity(const class[], const member[], value, element = 0);
978
+
979
+ /**
980
+ * Retrieves a string from the gamerules object based off a class and member name.
981
+ *
982
+ * @note This native is used to access the following (C++/engine) data types:
983
+ * string, stringptr.
984
+ *
985
+ * @param class Class name
986
+ * @param member Member name
987
+ * @param value Buffer to store data in
988
+ * @param maxlen Maximum size of the buffer
989
+ * @param element Element to retrieve (starting from 0) if member is an array
990
+ *
991
+ * @return Number of cells written to buffer
992
+ * @error If member is empty, no offset is found or an invalid offset
993
+ * is retrieved, or the data type does not match, an error will
994
+ * be thrown.
995
+ */
996
+ native get_gamerules_string(const class[], const member[], value[], maxlen, element = 0);
997
+
998
+ /**
999
+ * Sets a string to the gamerules object based off a class and member name.
1000
+ *
1001
+ * @note This native is used to access the following (C++/engine) data types:
1002
+ * string, stringptr.
1003
+ *
1004
+ * @param class Class name
1005
+ * @param member Member name
1006
+ * @param value String to set
1007
+ * @param element Element to set (starting from 0) if member is an array
1008
+ *
1009
+ * @return Number of cells written to buffer
1010
+ * @error If member is empty, no offset is found or an invalid offset
1011
+ * is retrieved, or the data type does not match, an error will
1012
+ * be thrown.
1013
+ */
1014
+ native set_gamerules_string(const class[], const member[], const value[], element = 0);
1015
+
1016
+ /**
1017
+ * Retrieves the size of array of a gamerules class member.
1018
+ *
1019
+ * @param class Class name
1020
+ * @param member Member name
1021
+ *
1022
+ * @return Size of array (in elements), otherwise 1 if member is not an array
1023
+ * @error If either class or member is empty, no offset is found or an invalid
1024
+ * offset is retrieved, an error will be thrown.
1025
+ */
1026
+ native get_gamerules_size(const class[], const member[]);
1027
+
1028
+ /**
1029
+ * Finds a gamerules offset based off a class and member name.
1030
+ *
1031
+ * @param class Class name
1032
+ * @param member Member name
1033
+ * @param type Optional variable to store member type in (FIELD_* constants)
1034
+ * @param arraysize Optional variable to store array size in, if member is an array
1035
+ * @param unsigned Optional variable to store whether member is unsigned (short and char types only)
1036
+ *
1037
+ * @return Class member offset
1038
+ * @error If either class or member is empty, no offset is found or an invalid
1039
+ * offset is retrieved, an error will be thrown.
1040
+ */
1041
+ native find_gamerules_info(const class[], const member[], &FieldType:type = FIELD_NONE, &arraysize = 0, &bool:unsigned = false);
1042
+
1043
+ /**
1044
+ * Returns the data field base type based off a specific field type.
1045
+ *
1046
+ * @note From an AMXX plugin perspective, the (C++/engine) data types can be grouped
1047
+ * in five base types: integer, float, vector, entity and string. This stock is
1048
+ * essentially for convenience and debug purpose.
1049
+ *
1050
+ * @param type Class member type (FIELD_* constants)
1051
+ * @param type_name Optional buffer to store base type name in
1052
+ * @param maxlen Maximum size of the buffer
1053
+ *
1054
+ * @return Base field type (BASEFIELD_* constants)
1055
+ */
1056
+ stock BaseFieldType:get_field_basetype(FieldType:type, type_name[] = "", maxlen = 0)
1057
+ {
1058
+ static const baseFieldTypeNames[BaseFieldType][] =
1059
+ {
1060
+ "none",
1061
+ "integer",
1062
+ "float",
1063
+ "vector",
1064
+ "entity",
1065
+ "string",
1066
+ };
1067
+
1068
+ new BaseFieldType:baseType = BASEFIELD_NONE;
1069
+
1070
+ switch (type)
1071
+ {
1072
+ case FIELD_INTEGER, FIELD_STRINGINT, FIELD_SHORT , FIELD_CHARACTER,
1073
+ FIELD_CLASS , FIELD_STRUCTURE, FIELD_POINTER, FIELD_FUNCTION,
1074
+ FIELD_BOOLEAN:
1075
+ {
1076
+ baseType = BASEFIELD_INTEGER;
1077
+ }
1078
+ case FIELD_FLOAT:
1079
+ {
1080
+ baseType = BASEFIELD_FLOAT;
1081
+ }
1082
+ case FIELD_VECTOR:
1083
+ {
1084
+ baseType = BASEFIELD_VECTOR;
1085
+ }
1086
+ case FIELD_CLASSPTR, FIELD_ENTVARS, FIELD_EDICT, FIELD_EHANDLE:
1087
+ {
1088
+ baseType = BASEFIELD_ENTITY;
1089
+ }
1090
+ case FIELD_STRINGPTR, FIELD_STRING:
1091
+ {
1092
+ baseType = BASEFIELD_STRING;
1093
+ }
1094
+ }
1095
+
1096
+ if (maxlen > 0)
1097
+ {
1098
+ copy(type_name, maxlen, baseFieldTypeNames[baseType]);
1099
+ }
1100
+
1101
+ return baseType;
1102
+ }
1103
+
1104
+
1105
+ enum
1106
+ {
1107
+ Model_DefaultSize = -2,
1108
+ Model_CurrentSequence = -1,
1109
+ };
1110
+
1111
+ /**
1112
+ * Gets size of a model bounding box.
1113
+ *
1114
+ * @param entity The entity index to use.
1115
+ * @param mins The local negative bounding box distance.
1116
+ * @param maxs The local positive bounding box distance.
1117
+ * @param sequence The animation sequence to retrieve.
1118
+ * Model_DefaultSize retrieves ideal moevement hull size.
1119
+ * Model_CurrentSequence retrieves hull size of the current sequence.
1120
+ * Values >= 0 will specify which sequence to retrieve size from.
1121
+ *
1122
+ * @return 1 on success, 0 on faillure.
1123
+ *
1124
+ * @error Invalid entity.
1125
+ * Invalid model pointer.
1126
+ */
1127
+ native GetModelBoundingBox(entity, Float:mins[3], Float:maxs[3], sequence = Model_DefaultSize);