@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,1343 @@
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
+ // Special thanks to Vexd and mahnsawce.
6
+ //
7
+ // This software is licensed under the GNU General Public License, version 3 or higher.
8
+ // Additional exceptions apply. For full license details, see LICENSE.txt or visit:
9
+ // https://alliedmods.net/amxmodx-license
10
+
11
+ //
12
+ // Engine Functions
13
+ //
14
+
15
+ #if defined _engine_included
16
+ #endinput
17
+ #endif
18
+ #define _engine_included
19
+
20
+ #include <engine_const>
21
+
22
+ #pragma reqlib engine
23
+ #if !defined AMXMODX_NOAUTOLOAD
24
+ #pragma loadlib engine
25
+ #endif
26
+
27
+ /**
28
+ * Retrieves a result from the global engine module trace handle.
29
+ *
30
+ * @note For a list of trace results available see the TR_* constants in
31
+ * engine_const.inc.
32
+ * @note Usage examples:
33
+ * value = traceresult(TR_AllSolid);
34
+ * traceresult(TR_Fraction, floatvalue);
35
+ * traceresult(TR_EndPos, vector);
36
+ *
37
+ * @param type Result to retrieve
38
+ * @param ... Depending on the result type a different number of
39
+ * additional parameters should be provided:
40
+ * int - Returns the result integer value directly, no
41
+ * additional parameters required
42
+ * float - Stores the result float value into the
43
+ * variable provided as the second parameter
44
+ * vector - Copies the result vector to the Float:array[3]
45
+ * provided in the second parameter
46
+ *
47
+ * @return Changes depending on the result type:
48
+ * int - Returns the result integer value
49
+ * float - Returns 1
50
+ * vector - Returns 1
51
+ */
52
+ native traceresult(type, any:...);
53
+
54
+ /**
55
+ * Registers a function to be called on a client impulse.
56
+ *
57
+ * @note The function will be called in the following manner:
58
+ *
59
+ * public impulse_handler(client, impulse)
60
+ *
61
+ * client - Client index
62
+ * impulse - Impulse triggered by the client
63
+ *
64
+ * @note The callback should return PLUGIN_CONTINUE to ignore the impulse,
65
+ * PLUGIN_HANDLED or higher to nullify it (CmdStart() is not blocked).
66
+ * @note When returning PLUGIN_HANDLED or higher from the callback, Engine will
67
+ * still fire other impulse functions. This includes the client_impulse()
68
+ * and client_cmdStart() forwards.
69
+ *
70
+ * @param impulse Impulse to hook
71
+ * @param function Name of callback function
72
+ *
73
+ * @return Impulse forward id
74
+ */
75
+ native register_impulse(impulse, const function[]);
76
+
77
+ /**
78
+ * Registers a function to be called on a touch action between entities of
79
+ * specified classes.
80
+ *
81
+ * @note The function will be called in the following manner:
82
+ *
83
+ * public touch_handler(touched, toucher)
84
+ *
85
+ * touched - Index of entity being touched
86
+ * toucher - Index of entity touching
87
+ *
88
+ * @note The callback should return PLUGIN_CONTINUE to ignore the touch,
89
+ * PLUGIN_HANDLED or higher to block it.
90
+ * @note When returning PLUGIN_HANDLED from the callback, Engine will still fire
91
+ * other touch functions like the pfn_touch() forward before actually
92
+ * blocking the touch. To immediately block return PLUGIN_HANDLED_MAIN
93
+ * instead.
94
+ *
95
+ * @param Touched Entity classname being touched, "*" or "" for any class
96
+ * @param Toucher Entity classname touching, "*" or "" for any class
97
+ * @param function Name of callback function
98
+ *
99
+ * @return Touch forward id
100
+ */
101
+ native register_touch(const Touched[], const Toucher[], const function[]);
102
+
103
+ /**
104
+ * Registers a function to be called on entity think on all entities of a
105
+ * specified class.
106
+ *
107
+ * @note The function will be called in the following manner:
108
+ *
109
+ * public think_handler(entity)
110
+ *
111
+ * entity - Index of entity thinking
112
+ *
113
+ * @note The callback should return PLUGIN_CONTINUE to ignore the think,
114
+ * PLUGIN_HANDLED or higher to block it.
115
+ * @note When returning PLUGIN_HANDLED from the callback, Engine will still fire
116
+ * other think functions like the pfn_think() forward before actually
117
+ * blocking the think. To immediately block return PLUGIN_HANDLED_MAIN
118
+ * instead.
119
+ *
120
+ * @param Classname Entity classname to hook
121
+ * @param function Name of callback function
122
+ *
123
+ * @return Think forward id
124
+ */
125
+ native register_think(const Classname[], const function[]);
126
+
127
+ /**
128
+ * Removes a previously registered impulse hook.
129
+ *
130
+ * @param registerid Impulse forward id
131
+ *
132
+ * @return 1 on success, 0 if nothing was removed
133
+ */
134
+ native unregister_impulse(registerid);
135
+
136
+ /**
137
+ * Removes a previously registered touch hook.
138
+ *
139
+ * @param registerid Touch forward id
140
+ *
141
+ * @return 1 on success, 0 if nothing was removed
142
+ */
143
+ native unregister_touch(registerid);
144
+
145
+ /**
146
+ * Removes a previously registered think hook.
147
+ *
148
+ * @param registerid Think forward id
149
+ *
150
+ * @return 1 on success, 0 if nothing was removed
151
+ */
152
+ native unregister_think(registerid);
153
+
154
+ /**
155
+ * Sets the engine module speak flags on a client.
156
+ *
157
+ * @note For a list of available flags see the SPEAK_* constants in
158
+ * engine_const.inc
159
+ *
160
+ * @param iIndex Client index
161
+ * @param iSpeakFlags New flags to set
162
+ *
163
+ * @noreturn
164
+ * @error If the client index is not within the range of 1 to
165
+ * MaxClients, or the client is not connected, an error
166
+ * will be thrown.
167
+ */
168
+ native set_speak(iIndex, iSpeakFlags);
169
+
170
+ /**
171
+ * Returns the engine module speak flags currently set on a client.
172
+ *
173
+ * @note For a list of available flags see the SPEAK_* constants in
174
+ * engine_const.inc
175
+ *
176
+ * @param iIndex Client index
177
+ *
178
+ * @return Client speak flags
179
+ * @error If the client index is not within the range of 1 to
180
+ * MaxClients, or the client is not connected, an error will be
181
+ * thrown.
182
+ */
183
+ native get_speak(iIndex);
184
+
185
+ /**
186
+ * Uses the DROP_TO_FLOOR() engine function on an entity, which attempts to put
187
+ * it down on the floor.
188
+ *
189
+ * @note This engine function traces 256 units straight downwards from the
190
+ * entity origin. If the trace hits the floor, the origin is updated to
191
+ * the end position of the trace, FL_ONGROUND is added to the flags and
192
+ * EV_ENT_groundentity is updated. When the trace does not hit anything or
193
+ * the entity would be stuck inside something, the function does nothing
194
+ * and returns 0.
195
+ *
196
+ * @param entity Entity index
197
+ *
198
+ * @return 1 if entity is on the floor, 0 otherwise
199
+ */
200
+ native drop_to_floor(entity);
201
+
202
+ /**
203
+ * Retrieves keyvalue buffer from a client or the server.
204
+ *
205
+ * @note There are three different types of keyvalue buffers, depending on the
206
+ * index passed:
207
+ * -1 - "local" buffer (various server information and config values)
208
+ * 0 - server buffer (usually contains "*gamedir" only)
209
+ * >0 - client buffer ("name", "rate" and other client info)
210
+ * @note The buffer is formatted as "\key1\value1\key2\value2\...\keyN\valueN"
211
+ *
212
+ * @param id Server/client index
213
+ * @param buffer Buffer to copy keybuffer to
214
+ * @param length Maximum size of buffer
215
+ *
216
+ * @return Number of cells written to buffer
217
+ * @error If an invalid entity index is provided or, if the index is a
218
+ * client index, the client is not connected, an error will be
219
+ * thrown.
220
+ */
221
+ native get_info_keybuffer(id, buffer[], length);
222
+
223
+ /**
224
+ * Forces an entity (such as a player) to use another entity (such as a button).
225
+ *
226
+ * @param entUsed Index of entity being used
227
+ * @param entUser Index of entity using
228
+ *
229
+ * @noreturn
230
+ * @error If an invalid entity index is provided or, if either index
231
+ * is a client index, that client is not connected, an error
232
+ * will be thrown.
233
+ */
234
+ native force_use(entUsed, entUser);
235
+
236
+ /**
237
+ * Returns a float type value from the server globals.
238
+ *
239
+ * @note For a list of valid float type entries, see the GL_* constants in
240
+ * engine_const.inc under the "Float" section.
241
+ *
242
+ * @param variable Entry to retrieve from
243
+ *
244
+ * @return Value of specified entry
245
+ * @error If an invalid entry is provided, an error will be thrown.
246
+ */
247
+ native Float:get_global_float(variable);
248
+
249
+ /**
250
+ * Returns a integer type value from the server globals.
251
+ *
252
+ * @note For a list of valid integer type entries, see the GL_* constants in
253
+ * engine_const.inc under the "Int" section.
254
+ *
255
+ * @param variable Entry to retrieve from
256
+ *
257
+ * @return Value of specified entry
258
+ * @error If an invalid entry is provided, an error will be thrown.
259
+ */
260
+ native get_global_int(variable);
261
+
262
+ /**
263
+ * Retrieves a global string type value from the server.
264
+ *
265
+ * @note For a list of valid string type entries, see the GL_* constants in
266
+ * engine_const.inc under the "String" section.
267
+ *
268
+ * @param variable Entry to retrieve from
269
+ * @param string Buffer to copy value to
270
+ * @param maxlen Maximum size of buffer
271
+ *
272
+ * @return Number of cells written to buffer
273
+ * @error If an invalid entry is provided, an error will be thrown.
274
+ */
275
+ native get_global_string(variable, string[], maxlen);
276
+
277
+ /**
278
+ * Returns a vector type value from the server globals.
279
+ *
280
+ * @note For a list of valid vector type entries, see the GL_* constants in
281
+ * engine_const.inc under the "Vector" section.
282
+ *
283
+ * @param variable Entry to retrieve from
284
+ * @param vector Array to store vector in
285
+ *
286
+ * @noreturn
287
+ * @error If an invalid entry is provided, an error will be thrown.
288
+ */
289
+ native get_global_vector(variable, Float:vector[3]);
290
+
291
+ /**
292
+ * Returns a edict type value from the server globals.
293
+ *
294
+ * @note For a list of valid edict type entries, see the GL_* constants in
295
+ * engine_const.inc under the "Edict" section.
296
+ * @note This native returns 0 as an error value if the edict retrieved is an
297
+ * invalid entity. As 0 is an entity index that is considered to be a
298
+ * valid value for some globals ("worldspawn"), this native can
299
+ * potentially return a misleading value. Use get_global_edict2() for a
300
+ * safe version.
301
+ *
302
+ * @param variable Entry to retrieve from
303
+ *
304
+ * @return Value of specified entry
305
+ * @error If an invalid entry is provided, an error will be thrown.
306
+ */
307
+ native get_global_edict(variable);
308
+
309
+ /**
310
+ * Returns a edict type value from the server globals.
311
+ *
312
+ * @note For a list of valid edict type entries, see the GL_* constants in
313
+ * engine_const.inc under the "Edict" section.
314
+ * @note This native returns -1 as a safe error value if the edict retrieved is
315
+ * an invalid entity. Otherwise it is identical to get_global_edict().
316
+ *
317
+ * @param variable Entry to retrieve from
318
+ *
319
+ * @return Value of specified entry
320
+ * @error If an invalid entry is provided, an error will be thrown.
321
+ */
322
+ native get_global_edict2(variable);
323
+
324
+ /**
325
+ * Sets the size of the entity bounding box, as described by the minimum and
326
+ * maximum vectors relative to the origin.
327
+ *
328
+ * @param index Entity index
329
+ * @param mins Vector containing the minimum point relative to the origin
330
+ * @param maxs Vector containing the maximum point relative to the origin
331
+ *
332
+ * @noreturn
333
+ * @error If an invalid entity index is provided, an error will be
334
+ * thrown.
335
+ */
336
+ native entity_set_size(index, const Float:mins[3], const Float:maxs[3]);
337
+
338
+ /**
339
+ * Returns the index of a decal.
340
+ *
341
+ * @param szDecalName Decal name
342
+ *
343
+ * @return Decal index >= 0, or -1 if decal was not found
344
+ */
345
+ native get_decal_index(const szDecalName[]);
346
+
347
+ /**
348
+ * Returns the distance between two entities.
349
+ *
350
+ * @param ida Entity index 1
351
+ * @param idb Entity index 2
352
+ *
353
+ * @return Distance between the entities
354
+ * @error If an invalid entity index is provided or, if either index is a
355
+ * client index, that client is not connected, an error will be
356
+ * thrown.
357
+ */
358
+ native Float:entity_range(ida, idb);
359
+
360
+ /**
361
+ * Returns if two entities bounding boxes intersect by comparing their absolute
362
+ * minimum and maximum origins.
363
+ *
364
+ * @param entity Entity index 1
365
+ * @param other Entity index 2
366
+ *
367
+ * @return True if entities intersect, false otherwise
368
+ * @error If an invalid entity index is provided, an error will be
369
+ * thrown.
370
+ */
371
+ native bool:entity_intersects(entity, other);
372
+
373
+ /**
374
+ * Returns an integer type value from an entities entvar struct.
375
+ *
376
+ * @note For a list of valid integer type entries, see the EV_INT_* constants in
377
+ * engine_const.inc
378
+ *
379
+ * @param iIndex Entity index
380
+ * @param iKey Entry to retrieve from
381
+ *
382
+ * @return Value of specified entry
383
+ * @error If an invalid entity index is provided, an error will be
384
+ * thrown.
385
+ */
386
+ native entity_get_int(iIndex, iKey);
387
+
388
+ /**
389
+ * Sets an integer type value in an entities entvar struct.
390
+ *
391
+ * @note For a list of valid integer type entries, see the EV_INT_* constants in
392
+ * engine_const.inc
393
+ *
394
+ * @param iIndex Entity index
395
+ * @param iKey Entry to write to
396
+ * @param iVal Value to set
397
+ *
398
+ * @return 1 if value was sucessfully set, 0 if an invalid entry was
399
+ * specified
400
+ * @error If an invalid entity index is provided, an error will be
401
+ * thrown.
402
+ */
403
+ native entity_set_int(iIndex, iKey, iVal);
404
+
405
+ /**
406
+ * Returns a float type value from an entities entvar struct.
407
+ *
408
+ * @note For a list of valid float type entries, see the EV_FL_* constants in
409
+ * engine_const.inc
410
+ *
411
+ * @param iIndex Entity index
412
+ * @param iKey Entry to retrieve from
413
+ *
414
+ * @return Value of specified entry, or 0 if an invalid entry was
415
+ * specified
416
+ * @error If an invalid entity index is provided, an error will be
417
+ * thrown.
418
+ */
419
+ native Float:entity_get_float(iIndex, iKey);
420
+
421
+ /**
422
+ * Sets a float type value in an entities entvar struct.
423
+ *
424
+ * @note For a list of valid float type entries, see the EV_FL_* constants in
425
+ * engine_const.inc
426
+ *
427
+ * @param iIndex Entity index
428
+ * @param iKey Entry to write to
429
+ * @param iVal Value to set
430
+ *
431
+ * @return 1 if value was sucessfully set, 0 if an invalid entry was
432
+ * specified
433
+ * @error If an invalid entity index is provided, an error will be
434
+ * thrown.
435
+ */
436
+ native entity_set_float(iIndex, iKey, Float:iVal);
437
+
438
+ /**
439
+ * Retrieves a vector type value from an entities entvar struct.
440
+ *
441
+ * @note For a list of valid vector type entries, see the EV_VEC_* constants in
442
+ * engine_const.inc
443
+ *
444
+ * @param iIndex Entity index
445
+ * @param iKey Entry to retrieve from
446
+ * @param vRetVector Array to store vector in
447
+ *
448
+ * @return 1 if value was sucessfully retrieved, 0 if an invalid
449
+ * entry was specified
450
+ * @error If an invalid entity index is provided, an error will be
451
+ * thrown.
452
+ */
453
+ native entity_get_vector(iIndex, iKey, Float:vRetVector[3]);
454
+
455
+ /**
456
+ * Sets a vector type value in an entities entvar struct.
457
+ *
458
+ * @note For a list of valid vector type entries, see the EV_VEC_* constants in
459
+ * engine_const.inc
460
+ *
461
+ * @param iIndex Entity index
462
+ * @param iKey Entry to write to
463
+ * @param vNewVector Array to copy to the entity
464
+ *
465
+ * @return 1 if value was sucessfully set, 0 if an invalid entry
466
+ * was specified
467
+ * @error If an invalid entity index is provided, an error will be
468
+ * thrown.
469
+ */
470
+ native entity_set_vector(iIndex, iKey, const Float:vNewVector[3]);
471
+
472
+ /**
473
+ * Returns an edict type value from an entities entvar struct.
474
+ *
475
+ * @note For a list of valid edict type entries, see the EV_ENT_* constants in
476
+ * engine_const.inc
477
+ * @note This native returns 0 as an error value if the edict retrieved from the
478
+ * entvar is an invalid entity. As 0 is an entity index that is
479
+ * considered to be a valid value for some entvars ("worldspawn"), this
480
+ * native can potentially return a misleading value. Use
481
+ * entity_get_edict2() for a safe version.
482
+ *
483
+ * @param iIndex Entity index
484
+ * @param iKey Entry to retrieve from
485
+ *
486
+ * @return Entity index in specified entry, 0 if the edict in the
487
+ * entvar is not a valid entity or an invalid entry was
488
+ * specified
489
+ * @error If an invalid entity index is provided, an error will be
490
+ * thrown.
491
+ */
492
+ native entity_get_edict(iIndex, iKey);
493
+
494
+ /**
495
+ * Returns an edict type value from an entities entvar struct.
496
+ *
497
+ * @note For a list of valid edict type entries, see the EV_ENT_* constants in
498
+ * engine_const.inc
499
+ * @note This native returns -1 as a safe error value if the edict retrieved
500
+ * from the entvar is an invalid entity. Otherwise it is identical to
501
+ * entity_get_edict().
502
+ *
503
+ * @param iIndex Entity index
504
+ * @param iKey Entry to retrieve from
505
+ *
506
+ * @return Entity index in specified entry, -1 if the edict in the
507
+ * entvar is not a valid entity or an invalid entry was
508
+ * specified
509
+ * @error If an invalid entity index is provided, an error will be
510
+ * thrown.
511
+ */
512
+ native entity_get_edict2(iIndex, iKey);
513
+
514
+ /**
515
+ * Sets an edict type value in an entities entvar struct.
516
+ *
517
+ * @note For a list of valid edict type entries, see the EV_ENT_* constants in
518
+ * engine_const.inc
519
+ * @note This native will crash the server if an invalid entity index is
520
+ * provided in iNewIndex.
521
+ *
522
+ * @param iIndex Entity index
523
+ * @param iKey Entry to write to
524
+ * @param iNewIndex Entity index to set
525
+ *
526
+ * @return 1 if value was sucessfully set, 0 if an invalid entry
527
+ * was specified
528
+ * @error If an invalid entity index is provided, an error will be
529
+ * thrown.
530
+ */
531
+ native entity_set_edict(iIndex, iKey, iNewIndex);
532
+
533
+ /**
534
+ * Retrieves a string type value from an entities entvar struct.
535
+ *
536
+ * @note For a list of valid string type entries, see the EV_SZ_* constants in
537
+ * engine_const.inc
538
+ *
539
+ * @param iIndex Entity index
540
+ * @param iKey Entry to retrieve from
541
+ * @param szReturn Buffer to copy value to
542
+ * @param iRetLen Maximum size of buffer
543
+ *
544
+ * @return Number of cells written to buffer, 0 if an invalid entry
545
+ * was specified
546
+ * @error If an invalid entity index is provided, an error will be
547
+ * thrown.
548
+ */
549
+ native entity_get_string(iIndex, iKey, szReturn[], iRetLen);
550
+
551
+ /**
552
+ * Sets a string type value in an entities entvar struct.
553
+ *
554
+ * @note For a list of valid string type entries, see the EV_SZ_* constants in
555
+ * engine_const.inc
556
+ *
557
+ * @param iIndex Entity index
558
+ * @param iKey Entry to retrieve from
559
+ * @param szNewVal String to copy to the entity
560
+ *
561
+ * @return 1 if value was sucessfully set, 0 if an invalid entry was
562
+ * specified
563
+ * @error If an invalid entity index is provided, an error will be
564
+ * thrown.
565
+ */
566
+ native entity_set_string(iIndex, iKey, const szNewVal[]);
567
+
568
+ /**
569
+ * Returns a bytearray type value from an entities entvar struct.
570
+ *
571
+ * @note For a list of valid bytearray type entries, see the EV_BYTE_* constants
572
+ * in engine_const.inc
573
+ *
574
+ * @param iIndex Entity index
575
+ * @param iKey Entry to retrieve from
576
+ *
577
+ * @return Value of specified entry, 0 if an invalid entry was
578
+ * specified
579
+ * @error If an invalid entity index is provided, an error will be
580
+ * thrown.
581
+ */
582
+ native entity_get_byte(iIndex, iKey);
583
+
584
+ /**
585
+ * Sets a bytearray type value in an entities entvar struct.
586
+ *
587
+ * @note For a list of valid bytearray type entries, see the EV_BYTE_* constants
588
+ * in engine_const.inc
589
+ * @note The value is automatically clamped to [0,255].
590
+ *
591
+ * @param iIndex Entity index
592
+ * @param iKey Entry to write to
593
+ * @param iVal Value to set
594
+ *
595
+ * @return 1 if value was sucessfully set, 0 if an invalid entry was
596
+ * specified
597
+ * @error If an invalid entity index is provided, an error will be
598
+ * thrown.
599
+ */
600
+ native entity_set_byte(iIndex, iKey, iVal);
601
+
602
+ /**
603
+ * Creates an entity.
604
+ *
605
+ * @note When creating an entity the classname has to be valid in the mod, as
606
+ * the engine needs to link the entity to an existing class internally.
607
+ * The classname string that is stored in the entvar struct
608
+ * (EV_SZ_classname) is separate from this association and can later be
609
+ * freely changed to serve other purposes.
610
+ *
611
+ * @param szClassname Entity classname
612
+ *
613
+ * @return Entity index > 0 on success, 0 otherwise
614
+ */
615
+ native create_entity(const szClassname[]);
616
+
617
+ /**
618
+ * Removes an entity from the world.
619
+ *
620
+ * @param iIndex Entity index
621
+ *
622
+ * @return 1 if entity was sucessfully removed, 0 if an invalid entity
623
+ * was provided
624
+ * @error If an entity index in the range of 0 to MaxClients is
625
+ * provided, an error will be thrown.
626
+ */
627
+ native remove_entity(iIndex);
628
+
629
+ /**
630
+ * Returns the current number of entities in the world.
631
+ *
632
+ * @return Number of entities
633
+ */
634
+ native entity_count();
635
+
636
+ /**
637
+ * Returns if an entity index is valid (as required by other engine natives).
638
+ *
639
+ * @note Engine considers an entity index valid if it is in the range between 1
640
+ * and the maximum number of entities possible. The index also has to
641
+ * point to an existing entity or, if it is a client index, the client has
642
+ * to be connected.
643
+ *
644
+ * @param iIndex Entity index
645
+ *
646
+ * @return 1 if entity is valid, 0 otherwise
647
+ */
648
+ native is_valid_ent(iIndex);
649
+
650
+ /**
651
+ * Searches entities in the world, starting at a specified index and matching by
652
+ * classname.
653
+ *
654
+ * @param iIndex Entity index to start from
655
+ * @param szClass Classname to match
656
+ *
657
+ * @return Entity index if an entity was found, 0 otherwise
658
+ */
659
+ native find_ent_by_class(iIndex, const szClass[]);
660
+
661
+ /**
662
+ * Searches entities in the world, starting at a specified index, matching by
663
+ * owner and a configurable entity field.
664
+ *
665
+ * @param iIndex Entity index to start from
666
+ * @param szClass String to match
667
+ * @param iOwner Owner entity index to match
668
+ * @param iJghgType Entity field to match string against:
669
+ * 0 - Classname
670
+ * 1 - Target
671
+ * 2 - Targetname
672
+ *
673
+ * @return Entity index if an entity was found, 0 otherwise
674
+ */
675
+ native find_ent_by_owner(iIndex, const szClass[], iOwner, iJghgType = 0);
676
+
677
+ /**
678
+ * Searches entities in the world, starting at a specified index and matching by
679
+ * target.
680
+ *
681
+ * @param iIndex Entity index to start from
682
+ * @param szClass Target to match
683
+ *
684
+ * @return Entity index if an entity was found, 0 otherwise
685
+ */
686
+ native find_ent_by_target(iIndex, const szClass[]);
687
+
688
+ /**
689
+ * Searches entities in the world, starting at a specified index and matching by
690
+ * targetname.
691
+ *
692
+ * @param iIndex Entity index to start from
693
+ * @param szClass Targetname to match
694
+ *
695
+ * @return Entity index if an entity was found, 0 otherwise
696
+ */
697
+ native find_ent_by_tname(iIndex, const szClass[]);
698
+
699
+ /**
700
+ * Searches entities in the world, starting at a specified index and matching by
701
+ * classname and model.
702
+ *
703
+ * @param iIndex Entity index to start from
704
+ * @param szClass Classname to match
705
+ * @param szModel Model to match
706
+ *
707
+ * @return Entity index if an entity was found, 0 otherwise
708
+ */
709
+ native find_ent_by_model(iIndex, const szClass[], const szModel[]);
710
+
711
+ /**
712
+ * Searches for entities inside a sphere, starting at a specified index.
713
+ *
714
+ * @param start_from_ent Entity index to start from
715
+ * @param origin Center of sphere
716
+ * @param radius Sphere radius
717
+ *
718
+ * @return Entity index if an entity was found, 0 otherwise
719
+ */
720
+ native find_ent_in_sphere(start_from_ent, const Float:origin[3], Float:radius);
721
+
722
+ /**
723
+ * Searches for entities inside a sphere around a specified entity or origin,
724
+ * matching by classname.
725
+ *
726
+ * @note This native always starts searching from entity index 0, there is no
727
+ * way to specify the starting point. If the entlist array is not big
728
+ * enough to accomodate all entities, the results will be truncated.
729
+ *
730
+ * @param aroundent Entity index to center sphere around, < 1 to use
731
+ * origin
732
+ * @param _lookforclassname Classname to match
733
+ * @param radius Sphere radius
734
+ * @param entlist Array to store entities in
735
+ * @param maxents Maximum size of array
736
+ * @param origin Center of sphere, used if aroundent < 1
737
+ *
738
+ * @return Number of entities stored in entlist
739
+ * @error If an invalid entity index is provided or, if
740
+ * the index is a client index, the client is not
741
+ * connected, an error will be thrown.
742
+ */
743
+ native find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3] = {0.0, 0.0, 0.0});
744
+
745
+ /**
746
+ * Sets the origin of an entity.
747
+ *
748
+ * @note This native uses engine functions to set the origin, keeping it
749
+ * properly updated with the game. Directly writing to EV_VEC_origin is an
750
+ * error and will cause problems.
751
+ *
752
+ * @param iIndex Entity index
753
+ * @param fNewOrigin New origin
754
+ *
755
+ * @noreturn
756
+ * @error If an invalid entity index is provided, an error will be
757
+ * thrown.
758
+ */
759
+ native entity_set_origin(iIndex, const Float:fNewOrigin[3]);
760
+
761
+ /**
762
+ * Sets the model of an entity.
763
+ *
764
+ * @note This native uses an engine function to set the model, keeping it
765
+ * properly updated with the game. Simply writing to EV_SZ_model is an
766
+ * error and will cause problems.
767
+ *
768
+ * @param iIndex Entity index
769
+ * @param szModel Model to set
770
+ *
771
+ * @noreturn
772
+ * @error If an invalid entity index is provided, an error will be
773
+ * thrown.
774
+ */
775
+ native entity_set_model(iIndex, const szModel[]);
776
+
777
+ /**
778
+ * Sets rendering options of an entity.
779
+ *
780
+ * @note For a list of valid rendering effects see the kRenderFx* constants in
781
+ * amxconst.inc
782
+ * @note For a list of valid rendering modes see the kRender* constants in
783
+ * amxconst.inc
784
+ * @note Rendering amount has different meanings depending on the rendering
785
+ * effect and mode used on the entity.
786
+ *
787
+ * @param index Entity index
788
+ * @param fx Rendering effect
789
+ * @param r Red component of rendering color
790
+ * @param g Green component of rendering color
791
+ * @param b Blue component of rendering color
792
+ * @param render Rendering mode
793
+ * @param amount Rendering amount
794
+ *
795
+ * @noreturn
796
+ * @error If an invalid entity index is provided, an error will be
797
+ * thrown.
798
+ */
799
+ native set_ent_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0);
800
+
801
+ /**
802
+ * Calls the DispatchThink() game DLL function on an entity, triggering it to
803
+ * think if applicable.
804
+ *
805
+ * @note DispatchThink() checks the entity for the FL_DORMANT flag - if it is
806
+ * set, the entity will not proceed to think. It will first call the
807
+ * class-specific think function and eventually CBaseEntity::Think(), thus
808
+ * triggering other think hooks and forwards.
809
+ *
810
+ * @param entity Entity index
811
+ *
812
+ * @noreturn
813
+ * @error If an invalid entity index is provided, an error will be
814
+ * thrown.
815
+ */
816
+ native call_think(entity);
817
+
818
+ /**
819
+ * Forces an entity to touch another entity.
820
+ *
821
+ * @note This calls the game touch function even when the entities do not
822
+ * intersect. It doesn't change their origins and/or bounding boxes.
823
+ *
824
+ * @param entTouched Index of entity being touched
825
+ * @param entToucher Index of entity touching
826
+ *
827
+ * @noreturn
828
+ * @error If an invalid entity index is provided or, if the index
829
+ * is a client index, the client is not connected, an error
830
+ * will be thrown.
831
+ */
832
+ native fake_touch(entTouched, entToucher);
833
+
834
+ /**
835
+ * Calls the spawn function on an entity.
836
+ *
837
+ * @param iIndex Entity index
838
+ *
839
+ * @noreturn
840
+ * @error If an invalid entity index is provided or, if the index is a
841
+ * client index, the client is not connected, an error will be
842
+ * thrown.
843
+ */
844
+ native DispatchSpawn(iIndex);
845
+
846
+ /**
847
+ * Fires/sets a keyvalue on an entity.
848
+ *
849
+ * @param ... (1) To fire a new keyvalue struct, three parameters should be
850
+ * provided in the following manner:
851
+ * DispatchKeyValue(entity, "KeyName", "Value");
852
+ * The "szClassName" value will automatically use the classname
853
+ * of the specified entity, "fHandled" will be set to 0.
854
+ * (2) Inside the pfn_keyvalue() forward this native can be used to
855
+ * modify the keyvalue struct inline, two parameters should be
856
+ * provided in the following manner:
857
+ * DispatchKeyValue("KeyName", "Value");
858
+ * The "szClassName" or "fHandled" values can not be changed.
859
+ *
860
+ * @noreturn
861
+ * @error For variant (1), if an invalid entity index is provided, an
862
+ * error will be thrown. For variant (2), if it is used outside of
863
+ * the pfn_keyvalue() forward, an error will be thrown.
864
+ */
865
+ native DispatchKeyValue(...);
866
+
867
+ /**
868
+ * Retrieves a value from an entities keyvalues.
869
+ *
870
+ * @param entity Entity index
871
+ * @param szKey Key to retrieve value of
872
+ * @param value Buffer to copy value to
873
+ * @param maxLength Maximum size of buffer
874
+ *
875
+ * @return Number of cells written to buffer
876
+ * @error If an invalid entity index is provided or, if the index
877
+ * is a client index, the client is not connected, an error
878
+ * will be thrown.
879
+ */
880
+ native get_keyvalue(entity, const szKey[], value[], maxLength);
881
+
882
+ /**
883
+ * Retrieves buffers from the keyvalue structure.
884
+ *
885
+ * @note Can only be used inside the pfn_keyvalue() forward.
886
+ *
887
+ * @param szClassName Buffer to copy classname to
888
+ * @param sizea Maximum size of classname buffer
889
+ * @param szKeyName Buffer to copy keyname to
890
+ * @param sizeb Maximum size of keyname buffer
891
+ * @param szVlaue Buffer to copy value to
892
+ * @param sizec Maximum size of value buffer
893
+ *
894
+ * @return 1 on success, 0 if used outside the pfn_keyvalue()
895
+ * forward
896
+ */
897
+ native copy_keyvalue(szClassName[], sizea, szKeyName[], sizeb, szValue[], sizec);
898
+
899
+ /**
900
+ * Hurts (and kills, if applicable) players in a sphere.
901
+ *
902
+ * @note Players that have the DAMAGE_NO flag set in EV_INT_flags will be
903
+ * ignored.
904
+ * @note The sphere has four different damage zones. Below is pseudo-code of the
905
+ * algorithm, indicating how damage will be dealt to players:
906
+ * if (distance <= 5 * radius) damage(10 + random(1 * dmg_multi))
907
+ * if (distance <= 4 * radius) damage(25 + random(2 * dmg_multi))
908
+ * if (distance <= 3 * radius) damage(50 + random(3 * dmg_multi))
909
+ * if (distance <= 2 * radius) kill()
910
+ *
911
+ * @param fExplodeAt Center origin of sphere
912
+ * @param iDamageMultiplier Damage multiplier
913
+ * @param iRadiusMultiplier Sphere radius
914
+ *
915
+ * @noreturn
916
+ */
917
+ native radius_damage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
918
+
919
+ /**
920
+ * Returns the contents value of an origin.
921
+ *
922
+ * @note For a list of valid contents values see the CONTENTS_* constants in
923
+ * hlsdk_const.inc
924
+ *
925
+ * @param fCheckAt Origin to retrieve contents of
926
+ *
927
+ * @return Contents value
928
+ */
929
+ native point_contents(const Float:fCheckAt[3]);
930
+
931
+ /**
932
+ * Returns if an origin is in an entities view cone. Derived from SDK.
933
+ *
934
+ * @note This uses the entities EV_FL_fov value in the calculations and applies
935
+ * it on all axes. It might be unreliable depending on the use-case.
936
+ *
937
+ * @param entity Entity index
938
+ * @param origin Origin
939
+ * @param use3d If zero the calculation will ignore the z axis (height), if
940
+ * nonzero it is done in 3D
941
+ *
942
+ * @return 1 if origin is in view code, 0 otherwise
943
+ */
944
+ native is_in_viewcone(entity, const Float:origin[3], use3d = 0);
945
+
946
+ /**
947
+ * Returns if an entity is visible to another entity. Derived from SDK.
948
+ *
949
+ * @note If the target entity has the FL_NOTARGET flag set, this native always
950
+ * returns 0.
951
+ * @note This native fires a traceline between the view-offset origins of the
952
+ * entities. If the traceline is unobstructed it returns true. This is not
953
+ * a full 3D visibility check.
954
+ *
955
+ * @param entity Entity index
956
+ * @param target Target entity index
957
+ *
958
+ * @return 1 if entity is visible, 0 otherwise
959
+ * @error If an invalid entity index is provided or, if the index is a
960
+ * client index, the client is not connected, an error will be
961
+ * thrown.
962
+ */
963
+ native is_visible(entity, target);
964
+
965
+ /**
966
+ * Fires a trace line between two origins, retrieving the end point and entity
967
+ * hit.
968
+ *
969
+ * @note This native writes to the global engine module trace handle. Additional
970
+ * trace results can be retrieved using traceresult().
971
+ * @note This native returns 0 if the trace did not hit anything. As 0 is an
972
+ * entity index that is considered to be a valid value for a trace hit
973
+ * ("worldspawn"), this native can potentially return a misleading value.
974
+ * Check other components of the trace result to verify the entity index.
975
+ *
976
+ * @param iIgnoreEnt Entity index that trace will ignore, -1 if trace should
977
+ * not ignore any entities
978
+ * @param fStart Trace starting point
979
+ * @param fEnd Trace target point
980
+ * @param vReturn Vector to copy trace end point to
981
+ *
982
+ * @return Entity index if trace hit an entity, 0 otherwise
983
+ */
984
+ native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
985
+
986
+ /**
987
+ * Fires a trace line between two origins, retrieving the trace normal.
988
+ *
989
+ * @note This native writes to the global engine module trace handle. Additional
990
+ * trace results can be retrieved using traceresult().
991
+ *
992
+ * @param iIgnoreEnt Entity index that trace will ignore, -1 if trace should
993
+ * not ignore any entities
994
+ * @param fStart Trace starting point
995
+ * @param fEnd Trace target point
996
+ * @param vReturn Vector to copy trace normal to
997
+ *
998
+ * @return 1 if a normal is available (trace hit something), 0
999
+ * otherwise
1000
+ */
1001
+ native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
1002
+
1003
+ /**
1004
+ * Fires a trace hull on a specified origin or between two origins.
1005
+ *
1006
+ * @note This native writes to the global engine module trace handle. Additional
1007
+ * trace results can be retrieved using traceresult().
1008
+ * @note For a list of valid hull types see the HULL_* constants in
1009
+ * hlsdk_const.inc
1010
+ * @note For a list of valid ignore types see the *IGNORE_* constants in
1011
+ * hlsdk_const.inc
1012
+ *
1013
+ * @param origin Trace start point (and end point if not specified)
1014
+ * @param hull Hull type
1015
+ * @param ignoredent Entity index that trace will ignore
1016
+ * @param ignoremonsters Entity ignore type
1017
+ * @param end Trace end point, pass NULL_VECTOR to use start point
1018
+ *
1019
+ * @return Custom bitflag sum of relevant trace results
1020
+ * StartSolid (1), AllSolid (2) and InOpen (4)
1021
+ */
1022
+ native trace_hull(const Float:origin[3], hull, ignoredent = 0, ignoremonsters = 0, const Float:end[3] = NULL_VECTOR);
1023
+
1024
+ /**
1025
+ * Attempts to describe an obstacle by firing trace lines in a specified
1026
+ * direction, offset on the z-axis around an origin.
1027
+ *
1028
+ * @note The functionality of this native can mostly be replaced by a single
1029
+ * hull trace. This native does not write to the global engine module
1030
+ * trace handle.
1031
+ * @note This native is intended to examine an obstacle in front of a standing
1032
+ * player. Start should usually be the origin of a client while angle
1033
+ * should be its forward angle vector. 73 traces are fired, each offset by
1034
+ * one unit on the z-axis from the last, starting at -36 and moving up to
1035
+ * +36. This is because a standing player model is 72 units high, so 73
1036
+ * units of clearance are required to fit them. The values stored in the
1037
+ * various parameters then attempt to describe the obstacle.
1038
+ * @note To fully understand the nuances of the algorithm it is necessary to
1039
+ * view its source code located in engine.cpp of the engine module.
1040
+ *
1041
+ * @param start Starting origin
1042
+ * @param angle Trace line direction
1043
+ * @param give Units that a trace line can be longer than the
1044
+ * shortest trace line to still be considered hitting
1045
+ * the same obstacle
1046
+ * @param ignoreEnt Entity index that traces will ignore, -1 if traces
1047
+ * should not ignore any entities
1048
+ * @param hitX Variable to store X axis value of shortest trace
1049
+ * line endpoint in
1050
+ * @param hitY Variable to store Y axis value of shortest trace
1051
+ * line endpoint in
1052
+ * @param shortestDistance Variable to store length of shortest trace line in
1053
+ * @param shortestDistLow Variable to store Z axis offset of shortest trace
1054
+ * line in
1055
+ * @param shortestDistHigh Variable to store Z axis offset of highest trace
1056
+ * line that satisfies "give" condition in
1057
+ *
1058
+ * @noreturn
1059
+ */
1060
+ native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh);
1061
+
1062
+ /**
1063
+ * Finds a grenade entity, matching by owner.
1064
+ *
1065
+ * @param id Owner entity index to match
1066
+ * @param model Buffer to copy grenade model to
1067
+ * @param len Maximum length of buffer
1068
+ * @param grenadeid Entity index to start searching from
1069
+ *
1070
+ * @return Grenade entity index > 0 if found, 0 otherwise
1071
+ * @error If an invalid entity index is provided, an error will be
1072
+ * thrown.
1073
+ */
1074
+ native get_grenade_id(id, model[], len, grenadeid = 0);
1075
+
1076
+ /**
1077
+ * Returns the game time based on the game tick.
1078
+ *
1079
+ * @note This time is counted up from map start. If the engine is not processing
1080
+ * this function will return the same value between calls, which makes it
1081
+ * unusable for profiling purposes.
1082
+ *
1083
+ * @return Game time, in seconds
1084
+ */
1085
+ native Float:halflife_time();
1086
+
1087
+ /**
1088
+ * Sets the map lighting level.
1089
+ *
1090
+ * @note After setting the map lighting level, the engine module enforces it by
1091
+ * continuously re-applying it until it is reset.
1092
+ *
1093
+ * @param Lighting Map lighting level (described by a character a-z), #OFF to
1094
+ * reset
1095
+ *
1096
+ * @noreturn
1097
+ */
1098
+ native set_lights(const Lighting[]);
1099
+
1100
+ /**
1101
+ * Attaches a clients viewport to an entity.
1102
+ *
1103
+ * @note To reset the clients viewport, call this function with the client index
1104
+ * as the target entity.
1105
+ *
1106
+ * @param iIndex Client index
1107
+ * @param iTargetIndex Index of entity to attach to
1108
+ *
1109
+ *
1110
+ * @error If the client index is not within the range of 1 to
1111
+ * MaxClients, or the client is not connected, an error
1112
+ * will be thrown.
1113
+ */
1114
+ native attach_view(iIndex, iTargetIndex);
1115
+
1116
+ /**
1117
+ * Sets the engine module view mode on a client.
1118
+ *
1119
+ * @note For a list of valid view modes see the CAMERA_* constants in
1120
+ * engine_const.inc
1121
+ * @note The engine module uses a custom entity to achieve the camera effects
1122
+ * and requires "models/rpgrocket.mdl" to be precached by the plugin.
1123
+ *
1124
+ * @param iIndex Client index
1125
+ * @param ViewType View mode
1126
+ */
1127
+ native set_view(iIndex, ViewType);
1128
+
1129
+ /**
1130
+ * Plays back an event on the client. Most prominently used for gun firing
1131
+ * animations.
1132
+ *
1133
+ * @note Event indexes can be acquired using precache_event() with the sc dummy
1134
+ * files in the events folder.
1135
+ *
1136
+ * @param flags Event flags
1137
+ * @param invoker Index of entity to invoke event on
1138
+ * @param eventindex Index of event in the precache table
1139
+ * @param delay Time until the event is played
1140
+ * @param origin Origin to play event from
1141
+ * @param angles Angles to play event with
1142
+ * @param fparam1 Float parameter 1 to pass along into/with the event
1143
+ * @param fparam2 Float parameter 2 to pass along into/with the event
1144
+ * @param iparam1 Integer parameter 1 to pass along into/with the event
1145
+ * @param iparam2 Integer parameter 2 to pass along into/with the event
1146
+ * @param bparam1 Boolean parameter 1 to pass along into/with the event
1147
+ * @param bparam2 Boolean parameter 2 to pass along into/with the event
1148
+ *
1149
+ * @noreturn
1150
+ */
1151
+ native playback_event(flags, invoker, eventindex, Float:delay, const Float:origin[3], const Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2);
1152
+
1153
+ /**
1154
+ * Retrieves a value from a usercmd struct.
1155
+ *
1156
+ * @note This native can only be used inside the client_cmdStart() forward. If
1157
+ * it is used outside this forward it will not retrieve any results and
1158
+ * always return 0.
1159
+ * @note For a list of valid usercmd entries see the usercmd_* constants in
1160
+ * engine_const.inc
1161
+ *
1162
+ * @param type Entry to retrieve from
1163
+ * @param ... Depending on the entry type a different number of
1164
+ * additional parameters should be provided:
1165
+ * int - Returns the entry integer value directly, no
1166
+ * additional parameters required
1167
+ * float - Stores the entry float value into the
1168
+ * variable provided as the second parameter
1169
+ * vector - Copies the entry vector to the Float:array[3]
1170
+ * provided in the second parameter
1171
+ *
1172
+ * @return Changes depending on the entry type:
1173
+ * int - Returns the entry integer value
1174
+ * float - Returns 1
1175
+ * vector - Returns 1
1176
+ */
1177
+ native get_usercmd(type, any:...);
1178
+
1179
+ /**
1180
+ * Sets a value in a usercmd struct.
1181
+ *
1182
+ * @note This native can only be used inside the client_cmdStart() forward.
1183
+ * @note For a list of valid usercmd entries see the usercmd_* constants in
1184
+ * engine_const.inc
1185
+ * @note Changes will be immediately reflected in get_usercmd() for all plugins.
1186
+ *
1187
+ * @param type Entry to write to
1188
+ * @param ... Depending on the entry type a different additional parameter
1189
+ * should be provided:
1190
+ * int - Second parameter should be an integer variable
1191
+ * float - Second parameter should be a float variable
1192
+ * vector - Second parameter should be a Float:array[3]
1193
+ *
1194
+ * @noreturn
1195
+ */
1196
+ native set_usercmd(type, any:...);
1197
+
1198
+ /**
1199
+ * Retrieves a string from the engine string table.
1200
+ *
1201
+ * @param _string String table index
1202
+ * @param _returnString Buffer to copy string to
1203
+ * @param _len Maximum size of buffer
1204
+ *
1205
+ * @return Number of cells written to buffer
1206
+ */
1207
+ native eng_get_string(_string, _returnString[], _len);
1208
+
1209
+ /**
1210
+ * @section Forwards
1211
+ */
1212
+
1213
+ /**
1214
+ * Called when two entities touch.
1215
+ *
1216
+ * @param ptr Index of entity being touched
1217
+ * @param ptd Index of entity touching
1218
+ *
1219
+ * @return PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
1220
+ */
1221
+ forward pfn_touch(ptr, ptd);
1222
+
1223
+ /**
1224
+ * Called at the start of every server frame.
1225
+ *
1226
+ * @note Using his forward can easily become performance-critical. More specific
1227
+ * hooks and forwards should be used whenever possible.
1228
+ *
1229
+ * @noreturn
1230
+ */
1231
+ forward server_frame();
1232
+
1233
+ /**
1234
+ * Called when a client types kill in console.
1235
+ *
1236
+ * @param id Client index
1237
+ *
1238
+ * @return PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
1239
+ */
1240
+ forward client_kill(id);
1241
+
1242
+ /**
1243
+ * Called at the start of each client think.
1244
+ *
1245
+ * @note Using his forward can easily become performance-critical. More specific
1246
+ * hooks and forwards should be used whenever possible.
1247
+ *
1248
+ * @param id Client index
1249
+ *
1250
+ * @noreturn
1251
+ */
1252
+ forward client_PreThink(id);
1253
+
1254
+ /**
1255
+ * Called after each client think.
1256
+ *
1257
+ * @note Using his forward can easily become performance-critical. More specific
1258
+ * hooks and forwards should be used whenever possible.
1259
+ *
1260
+ * @param id Client index
1261
+ *
1262
+ * @noreturn
1263
+ */
1264
+ forward client_PostThink(id);
1265
+
1266
+ /**
1267
+ * Called when a client triggers an impulse.
1268
+ *
1269
+ * @param id Client index
1270
+ * @param impulse Impulse triggered by client
1271
+ *
1272
+ * @param PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to
1273
+ * nullify impulse (CmdStart() is not blocked)
1274
+ */
1275
+ forward client_impulse(id, impulse);
1276
+
1277
+ /**
1278
+ * Called for CmdStart() on a client.
1279
+ *
1280
+ * @note Use [get|set]_usercmd() to read and modify information in the usercmd
1281
+ * struct.
1282
+ *
1283
+ * @param id Client index
1284
+ *
1285
+ * @return PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
1286
+ */
1287
+ forward client_cmdStart(id);
1288
+
1289
+ /**
1290
+ * Called when an entity thinks.
1291
+ *
1292
+ * @param entid Entity index
1293
+ *
1294
+ * @return PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
1295
+ */
1296
+ forward pfn_think(entid);
1297
+
1298
+ /**
1299
+ * Called when an event is played.
1300
+ *
1301
+ * @param flags Event flags
1302
+ * @param entid Index of entity to invoke event on
1303
+ * @param eventid Index of event in the precache table
1304
+ * @param delay Time until the event is played
1305
+ * @param Origin Origin to play event from
1306
+ * @param Angles Angles to play event with
1307
+ * @param fparam1 Float parameter 1 to pass along into/with the event
1308
+ * @param fparam2 Float parameter 2 to pass along into/with the event
1309
+ * @param iparam1 Integer parameter 1 to pass along into/with the event
1310
+ * @param iparam2 Integer parameter 2 to pass along into/with the event
1311
+ * @param bparam1 Boolean parameter 1 to pass along into/with the event
1312
+ * @param bparam2 Boolean parameter 2 to pass along into/with the event
1313
+ *
1314
+ * @return PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
1315
+ */
1316
+ forward pfn_playbackevent(flags, entid, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2);
1317
+
1318
+ /**
1319
+ * Called when a keyvalue pair is sent to an entity.
1320
+ *
1321
+ * @note Use copy_keyvalue() to retrieve the keyvalue information, and
1322
+ * DispatchKeyVaue() to modify it.
1323
+ *
1324
+ * @param entid Entity index
1325
+ *
1326
+ * @return PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
1327
+ */
1328
+ forward pfn_keyvalue(entid);
1329
+
1330
+ /**
1331
+ * Called when an entity is spawned.
1332
+ *
1333
+ * @param entid Entity index
1334
+ *
1335
+ * @return PLUGIN_CONTINUE to ignore, PLUGIN_HANDLED or higher to block
1336
+ */
1337
+ forward pfn_spawn(entid);
1338
+
1339
+ /**
1340
+ * @endsection
1341
+ */
1342
+
1343
+ #include <engine_stocks>