@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,333 @@
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
+ // Fun Functions
12
+ //
13
+
14
+ #if defined _fun_included
15
+ #endinput
16
+ #endif
17
+ #define _fun_included
18
+
19
+ #pragma reqlib fun
20
+ #if !defined AMXMODX_NOAUTOLOAD
21
+ #pragma loadlib fun
22
+ #endif
23
+
24
+
25
+ /**
26
+ * Parts of body for hits, for use with set_user_hitzones().
27
+ */
28
+ const HITZONE_GENERIC = (1 << HIT_GENERIC); // 1
29
+ const HITZONE_HEAD = (1 << HIT_HEAD); // 2
30
+ const HITZONE_CHEST = (1 << HIT_CHEST); // 4
31
+ const HITZONE_STOMACH = (1 << HIT_STOMACH); // 8
32
+ const HITZONE_LEFTARM = (1 << HIT_LEFTARM); // 16
33
+ const HITZONE_RIGHTARM = (1 << HIT_RIGHTARM); // 32
34
+ const HITZONE_LEFTLEG = (1 << HIT_LEFTLEG); // 64
35
+ const HITZONE_RIGHTLEG = (1 << HIT_RIGHTLEG); // 128
36
+ const HITZONES_DEFAULT = HITZONE_GENERIC | HITZONE_HEAD | HITZONE_CHEST | HITZONE_STOMACH |
37
+ HITZONE_LEFTARM | HITZONE_RIGHTARM | HITZONE_LEFTLEG | HITZONE_RIGHTLEG; // 255
38
+
39
+ /**
40
+ * Tells whether receiver hears sender via voice communication.
41
+ *
42
+ * @param receiver Receiver
43
+ * @param sender Sender
44
+ *
45
+ * @return 1 if receiver hears the sender, 0 otherwise.
46
+ * @error If receiver or sender are not connected or not
47
+ * within the range of 1 to MaxClients
48
+ */
49
+ native get_client_listen(receiver, sender);
50
+
51
+ /**
52
+ * Sets who can listen who.
53
+ *
54
+ * @param receiver Receiver
55
+ * @param sender Sender
56
+ * @param listen 1 if receiver should be able to hear sender, 0 if not
57
+ *
58
+ * @return 0 if the setting can't be done for some reason
59
+ * @error If receiver or sender are not connected or not
60
+ * within the range of 1 to MaxClients.
61
+ */
62
+ native set_client_listen(receiver, sender, listen);
63
+
64
+ /**
65
+ * Sets player's godmode.
66
+ *
67
+ * @param index Client index
68
+ * @param godmode 1 to enable godmode, 0 to disable
69
+ *
70
+ * @noreturn
71
+ * @error If player is not connected or not within the range
72
+ * of 1 to MaxClients.
73
+ */
74
+ native set_user_godmode(index, godmode = 0);
75
+
76
+ /**
77
+ * Tells whether a player has godmode on.
78
+ *
79
+ * @param index Client index
80
+ *
81
+ * @return 1 if player has godmode on, 0 if not
82
+ * @error If player is not connected or not within the range
83
+ * of 1 to MaxClients.
84
+ */
85
+ native get_user_godmode(index);
86
+
87
+ /**
88
+ * Sets player's armor amount.
89
+ *
90
+ * @param index Client index
91
+ * @param armor The armor amount to set
92
+ *
93
+ * @noreturn
94
+ * @error If player is not connected or not within the range
95
+ * of 1 to MaxClients.
96
+ */
97
+ native set_user_armor(index, armor);
98
+
99
+ /**
100
+ * Sets player's health amount.
101
+ *
102
+ * @param index Client index
103
+ * @param health The health amount to set
104
+ *
105
+ * @noreturn
106
+ * @error If player is not connected or not within the range
107
+ * of 1 to MaxClients.
108
+ */
109
+ native set_user_health(index, health);
110
+
111
+ /**
112
+ * Moves a player to the given origin.
113
+ *
114
+ * @param index Client index
115
+ * @param origin Origin to move a player to
116
+ *
117
+ * @noreturn
118
+ * @error If player is not connected or not within the range
119
+ * of 1 to MaxClients.
120
+ */
121
+ native set_user_origin(index, const origin[3]);
122
+
123
+ /**
124
+ * Sets player's rendering mode.
125
+ *
126
+ * @note A really useful render modes reference:
127
+ * https://sites.google.com/site/svenmanor/rendermodes
128
+ *
129
+ * @param index Client index
130
+ * @param fx Rendering effects. One of kRenderFx* constants
131
+ * @param r The amount of red color (0 to 255)
132
+ * @param g The amount of green color (0 to 255)
133
+ * @param b The amount of blue color (0 to 255)
134
+ * @param render Render mode. One of kRender* constants
135
+ * @param amount Render amount (0 to 255)
136
+ *
137
+ * @noreturn
138
+ * @error If player is not connected or not within the range
139
+ * of 1 to MaxClients.
140
+ */
141
+ native set_user_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0);
142
+
143
+ /**
144
+ * Gets player's rendering mode.
145
+ *
146
+ * @note A really useful render modes reference:
147
+ * https://sites.google.com/site/svenmanor/rendermodes
148
+ *
149
+ * @param index Client index
150
+ * @param fx Variable to store the rendering effect
151
+ * @param r Variable to store the amount of red color
152
+ * @param g Variable to store the amount of green color
153
+ * @param b Variable to store the amount of blue color
154
+ * @param render Variable to store the render mode
155
+ * @param amount Variable to store the render amount
156
+ *
157
+ * @noreturn
158
+ * @error If player is not connected or not within the range
159
+ * of 1 to MaxClients.
160
+ */
161
+ native get_user_rendering(index, &fx = kRenderFxNone, &r = 0, &g = 0, &b = 0, &render = kRenderNormal, &amount = 0);
162
+
163
+ /**
164
+ * Gives an item to a player.
165
+ *
166
+ * @param index Client index
167
+ * @param item Classname of the item to give. Should start with either
168
+ * "weapon_", "ammo_", "item_" or "tf_weapon_"
169
+ *
170
+ * @return Item entity index. If an invalid item name is
171
+ * given or the item failed to create, it will return 0.
172
+ * If the item was removed, it will return -1
173
+ * @error If player is not connected or not within the range
174
+ * of 1 to MaxClients or item creation fails.
175
+ */
176
+ native give_item(index, const item[]);
177
+
178
+ /**
179
+ * Sets (adds, removes) hit zones for a player.
180
+ *
181
+ * @note This actually sets rules of how any player can hit any other.
182
+ * Example: set_user_hitzones(id, target, 2) - makes @id able to
183
+ * hit @target only in the head.
184
+ *
185
+ * @param index Client index
186
+ * @param target The target player
187
+ * @param body A bitsum of the body parts that can/can't be shot. See HITZONE* constants.
188
+ *
189
+ * @noreturn
190
+ * @error If player is not connected or not within the range
191
+ * of 1 to MaxClients.
192
+ */
193
+ native set_user_hitzones(index = 0, target = 0, body = HITZONES_DEFAULT);
194
+
195
+ /**
196
+ * Gets the set of hit zone "rules" between @index and @target players.
197
+ *
198
+ * @note For the body part bitsum, see HITZONE* constants.
199
+ *
200
+ * @param index Client index
201
+ * @param target The target player
202
+ *
203
+ * @return The bitsum of @target's body parts @index is able to hit
204
+ * @error If player is not connected or not within the range
205
+ * of 1 to MaxClients.
206
+ */
207
+ native get_user_hitzones(index, target);
208
+
209
+ /**
210
+ * Sets player's maximum movement speed.
211
+ *
212
+ * @param index Client index
213
+ * @param speed The maximum speed player will be able to run at
214
+ *
215
+ * @noreturn
216
+ * @error If player is not connected or not within the range
217
+ * of 1 to MaxClients.
218
+ */
219
+ native set_user_maxspeed(index, Float:speed = -1.0);
220
+
221
+ /**
222
+ * Gets player's maximum movement speed.
223
+ *
224
+ * @param index Client index
225
+ *
226
+ * @return Player's maximum movement speed
227
+ * @error If player is not connected or not within the range
228
+ * of 1 to MaxClients.
229
+ */
230
+ native Float:get_user_maxspeed(index);
231
+
232
+ /**
233
+ * Sets player's gravity.
234
+ *
235
+ * @param index Client index
236
+ * @param gravity Gravity value to set, 1.0 being normal gravity (800)
237
+ *
238
+ * @noreturn
239
+ * @error If player is not connected or not within the range
240
+ * of 1 to MaxClients.
241
+ */
242
+ native set_user_gravity(index, Float:gravity = 1.0);
243
+
244
+ /**
245
+ * Gets player's gravity.
246
+ *
247
+ * @param index Client index
248
+ *
249
+ * @return Player's gravity value, 1.0 being normal gravity (800)
250
+ * @error If player is not connected or not within the range
251
+ * of 1 to MaxClients.
252
+ */
253
+ native Float:get_user_gravity(index);
254
+
255
+ /**
256
+ * Spawns an entity.
257
+ *
258
+ * @param index Entity index
259
+ *
260
+ * @noreturn
261
+ * @error If player is not connected or not within the range
262
+ * of 1 to MaxClients.
263
+ */
264
+ native spawn(index);
265
+
266
+ /**
267
+ * Enables or disables player's noclip.
268
+ *
269
+ * @param index Client index
270
+ * @param noclip 1 to enable noclip, 0 to disable
271
+ *
272
+ * @noreturn
273
+ * @error If player is not connected or not within the range
274
+ * of 1 to MaxClients.
275
+ */
276
+ native set_user_noclip(index, noclip = 0);
277
+
278
+ /**
279
+ * Gets whether a player has noclip enabled or not.
280
+ *
281
+ * @param index Client index
282
+ *
283
+ * @return 1 if noclip is enabled, 0 if disabled
284
+ * @error If player is not connected or not within the range
285
+ * of 1 to MaxClients.
286
+ */
287
+ native get_user_noclip(index);
288
+
289
+ /**
290
+ * Tells whether a player has silent footsteps enabled.
291
+ *
292
+ * @param index Client index
293
+ *
294
+ * @return 1 if silent footsteps are enabled, 0 if not
295
+ * @error If player is not connected or not within the range
296
+ * of 1 to MaxClients.
297
+ */
298
+ native get_user_footsteps(index);
299
+
300
+ /**
301
+ * Enables or disables player's silent footsteps.
302
+ *
303
+ * @param index Client index
304
+ * @param set 1 if player should have silent footsteps, 0 otherwise
305
+ *
306
+ * @noreturn
307
+ * @error If player is not connected or not within the range
308
+ * of 1 to MaxClients.
309
+ */
310
+ native set_user_footsteps(id, set = 1);
311
+
312
+ /**
313
+ * Strips all weapons from a player, including their knife.
314
+ *
315
+ * @param index Client index
316
+ *
317
+ * @noreturn
318
+ * @error If player is not connected or not within the range
319
+ * of 1 to MaxClients.
320
+ */
321
+ native strip_user_weapons(index);
322
+
323
+ /**
324
+ * Sets player's frags amount.
325
+ *
326
+ * @param index Client index
327
+ * @param frags The amount of frags to set
328
+ *
329
+ * @noreturn
330
+ * @error If player is not connected or not within the range
331
+ * of 1 to MaxClients.
332
+ */
333
+ native set_user_frags(index, frags);
@@ -0,0 +1,93 @@
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
+ // Game Config Functions
12
+ //
13
+
14
+ #if defined _gameconfigs_included
15
+ #endinput
16
+ #endif
17
+ #define _gameconfigs_included
18
+
19
+ enum GameConfig
20
+ {
21
+ Invalid_GameConfig = 0
22
+ };
23
+
24
+ /**
25
+ * Loads a game config file.
26
+ *
27
+ * @note The file path must be relative to the 'gamedata' folder under the data folder
28
+ * and the extension should be omitted.
29
+ *
30
+ * @param file File to load
31
+ *
32
+ * @return A handle to the game config file
33
+ */
34
+ native GameConfig:LoadGameConfigFile(const file[]);
35
+
36
+ /**
37
+ * Returns an offset value.
38
+ *
39
+ * @param handle Game config handle
40
+ * @param key Key to retrieve from the offset section
41
+ *
42
+ * @return An offset, or -1 on failure
43
+ * @error Invalid game config handle
44
+ */
45
+ native GameConfGetOffset(GameConfig:handle, const key[]);
46
+
47
+ /**
48
+ * Returns an offset value given a classname.
49
+ *
50
+ * @param handle Game config handle
51
+ * @param classname Class name to match from the offset section
52
+ * @param key Key to retrieve from the offset section
53
+ *
54
+ * @return An offset, or -1 on failure
55
+ * @error Invalid game config handle
56
+ */
57
+ native GameConfGetClassOffset(GameConfig:handle, const classname[], const key[]);
58
+
59
+ /**
60
+ * Gets the value of a key from the "Keys" section.
61
+ *
62
+ * @param handle Game config handle
63
+ * @param key Key to retrieve from the Keys section
64
+ * @param buffer Destination string buffer
65
+ * @param maxlen Maximum length of output string buffer
66
+ *
67
+ * @return True if key existed, false otherwise
68
+ * @error Invalid game config handle
69
+ */
70
+ native bool:GameConfGetKeyValue(GameConfig:handle, const key[], buffer[], maxlen);
71
+
72
+ /**
73
+ * Finds an address calculation in a GameConfig file.
74
+ *
75
+ * @param handle Game config handle
76
+ * @param name Name of the property to find
77
+ *
78
+ * @return An address calculated on success, otherwise 0 on failure.
79
+ * @error Invalid game config handle
80
+ */
81
+ native GameConfGetAddress(GameConfig:handle, const name[]);
82
+
83
+ /**
84
+ * Destroys a game config and frees its memory.
85
+ *
86
+ * @note The function automatically sets the variable passed to it to 0 to aid
87
+ * in preventing accidental usage after destroy.
88
+ *
89
+ * @param handle Game config handle
90
+ *
91
+ * @return 1 on success, 0 if an invalid handle was passed in
92
+ */
93
+ native CloseGameConfigFile(&GameConfig:handle);
@@ -0,0 +1,264 @@
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
+ // GeoIP Module Functions
12
+ //
13
+
14
+ #if defined geoip_included
15
+ #endinput
16
+ #endif
17
+ #define _geoip_included
18
+
19
+ #pragma reqlib geoip
20
+ #if !defined AMXMODX_NOAUTOLOAD
21
+ #pragma loadlib geoip
22
+ #endif
23
+
24
+ /**
25
+ * @global IP addresses passed to these natives can contain ports, the ports will be ignored.
26
+ */
27
+
28
+ /**
29
+ * Look up the two character country code for a given IP address.
30
+ * e.g: "US", "CA", etc.
31
+ *
32
+ * @param ip The IP address to lookup.
33
+ * @param result The result buffer. If the lookup does not succeed, the buffer is not modified.
34
+ *
35
+ * @return true on a successful lookup, false on a failed lookup.
36
+ */
37
+ native bool:geoip_code2_ex(const ip[], result[3]);
38
+
39
+ /**
40
+ * Look up the three character country code for a given IP address.
41
+ * e.g: "USA", "cAN", etc.
42
+ *
43
+ * @param ip The IP address to lookup.
44
+ * @param result The result buffer. If the lookup does not succeed, the buffer is not modified.
45
+ *
46
+ * @return true on a successful lookup, false on a failed lookup.
47
+ */
48
+ native bool:geoip_code3_ex(const ip[], result[4]);
49
+
50
+ /**
51
+ * Lookup the two character country code for a given IP address. Sets the buffer to "error" on
52
+ * an unsuccessful lookup.
53
+ *
54
+ * @deprecated This native will overflow the buffer by one cell on an unknown ip lookup!
55
+ * Use geoip_code2_ex instead.
56
+ *
57
+ * @param ip The IP address to lookup.
58
+ * @param result The result buffer.
59
+ *
60
+ * @return The result length.
61
+ */
62
+ #pragma deprecated Use geoip_code2_ex() instead.
63
+ native geoip_code2(const ip[], ccode[3]);
64
+
65
+ /**
66
+ * Lookup the three character country code for a given IP address. Sets the buffer to "error" on
67
+ * an unsuccessful lookup.
68
+ *
69
+ * @deprecated This native will overflow the buffer by one cell on an unknown ip lookup!
70
+ * Use geoip_code3_ex instead.
71
+ *
72
+ * @param ip The IP address to lookup.
73
+ * @param result The result buffer.
74
+ *
75
+ * @return The result length.
76
+ */
77
+ #pragma deprecated Use geoip_code3_ex() instead.
78
+ native geoip_code3(const ip[], result[4]);
79
+
80
+ /**
81
+ * Lookup the full country name for the given IP address. Sets the buffer to "error" on
82
+ * an unsuccessful lookup.
83
+ *
84
+ * @param ip The IP address to lookup.
85
+ * @param result The result of the geoip lookup.
86
+ * @param len The maximum length of the result buffer.
87
+ *
88
+ * @return The result length.
89
+ */
90
+ #pragma deprecated Use geoip_country_ex() instead.
91
+ native geoip_country(const ip[], result[], len = 45);
92
+
93
+ /**
94
+ * Lookup the full country name for the given IP address.
95
+ *
96
+ * @param ip The IP address to lookup.
97
+ * @param result The result of the geoip lookup.
98
+ * @param len The maximum length of the result buffer.
99
+ * @param id An optional player's index in order to return the result
100
+ * in the player's language, if supported.
101
+ * -1: the default language, which is english.
102
+ * 0: the server language. You can use LANG_SERVER define.
103
+ * >=1: the player's language.
104
+ *
105
+ * @return The result length on successful lookup, 0 otherwise.
106
+ */
107
+ native geoip_country_ex(const ip[], result[], len, id = -1);
108
+
109
+ /**
110
+ * Look up the full city name for the given IP address.
111
+ *
112
+ * @note This native requires GeoIP City database, which can be retrieved from:
113
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
114
+ *
115
+ * @param ip The IP address to look up.
116
+ * @param result The result of the geoip look up.
117
+ * @param len The maximum length of the result buffer.
118
+ * @param id An optional player's index in order to return the result
119
+ * in the player's language, if supported.
120
+ * -1: the default language, which is english.
121
+ * 0: the server language. You can use LANG_SERVER define.
122
+ * >=1: the player's language.
123
+ *
124
+ * @return The result length on successful lookup, 0 otherwise.
125
+ */
126
+ native geoip_city(const ip[], result[], len, id = -1);
127
+
128
+ /**
129
+ * Look up the region/state code for the given IP address.
130
+ * e.g. "US-OH", "DE-HH", IT-82, "FR-U", etc.
131
+ *
132
+ * @note This native requires GeoIP City database, which can be retrieved from:
133
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
134
+ *
135
+ * @param ip The IP address to look up.
136
+ * @param result The result of the geoip look up.
137
+ * @param len The maximum length of the result buffer.
138
+ *
139
+ * @return The result length on successful lookup, 0 otherwise.
140
+ */
141
+ native geoip_region_code(const ip[], result[], len);
142
+
143
+ /**
144
+ * Look up the full region/state name for the given IP address.
145
+ *
146
+ * @note This native requires GeoIP City database, which can be retrieved from:
147
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
148
+ *
149
+ * @param ip The IP address to look up.
150
+ * @param result The result of the geoip look up.
151
+ * @param len The maximum length of the result buffer.
152
+ * @param id An optional player's index in order to return the result
153
+ * in the player's language, if supported.
154
+ * -1: the default language, which is english.
155
+ * 0: the server language. You can use LANG_SERVER define.
156
+ * >=1: the player's language.
157
+ *
158
+ * @return The result length on successful lookup, 0 otherwise.
159
+ */
160
+ native geoip_region_name(const ip[], result[], len, id = -1);
161
+
162
+ /**
163
+ * Look up the full time zone for the given IP address.
164
+ * e.g. America/Los_Angeles, Europe/Paris.
165
+ *
166
+ * @note This native requires GeoIP City database, which can be retrieved from:
167
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
168
+ *
169
+ * @param ip The IP address to look up.
170
+ * @param result The result of the geoip look up.
171
+ * @param len The maximum length of the result buffer.
172
+ *
173
+ * @return The result length on successful lookup, 0 otherwise.
174
+ */
175
+ native geoip_timezone(const ip[], result[], len);
176
+
177
+ /**
178
+ * Look up the city's latitude for the given IP address.
179
+ *
180
+ * @note This native requires GeoIP City database, which can be retrieved from:
181
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
182
+ *
183
+ * @param ip The IP address to look up.
184
+ *
185
+ * @return The result of the geoip look up, 0 if latitude is not found.
186
+ */
187
+ native Float:geoip_latitude(const ip[]);
188
+
189
+ /**
190
+ * Look up the city's longitude for the given IP address.
191
+ *
192
+ * @note This native requires GeoIP City database, which can be retrieved from:
193
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
194
+ *
195
+ * @param ip The IP address to look up.
196
+ *
197
+ * @return The result of the geoip look up, 0 if longitude is not found.
198
+ */
199
+ native Float:geoip_longitude(const ip[]);
200
+
201
+ /**
202
+ * Calculate the distance between geographical coordinates, latitude and longitude.
203
+ *
204
+ * @note This native requires GeoIP City database, which can be retrieved from:
205
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
206
+ *
207
+ * @param lat1 The first IP latitude.
208
+ * @param lon1 The first IP longitude.
209
+ * @param lat2 The second IP latitude.
210
+ * @param lon2 The second IP longitude.
211
+ * @param system The system of measurement, 0 = Metric(kilometers) or 1 = English(miles).
212
+ *
213
+ * @return The distance as result in specified system of measurement.
214
+ */
215
+ #define SYSTEM_METRIC 0 // kilometers
216
+ #define SYSTEM_IMPERIAL 1 // statute miles
217
+
218
+ native Float:geoip_distance(Float:lat1, Float:lon1, Float:lat2, Float:lon2, system = SYSTEM_METRIC);
219
+
220
+ /**
221
+ * Look up the continent code for a given IP address.
222
+ *
223
+ * @note This native requires GeoIP City database, which can be retrieved from:
224
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
225
+ * @note The code can be retrieved as integer (See CONTINENT_* constants.) or string (2 characters).
226
+ * @note Possible continent codes are AF, AN, AS, EU, NA, OC, SA for
227
+ * Africa(1), Antarctica(2), Asia(3), Europe(4), North America(5), Oceania(6), South America(7).
228
+ *
229
+ * @param ip The IP address to look up.
230
+ * @param result The result of the geoip look up.
231
+ *
232
+ * @return The continent id on successful lookup, 0 otherwise.
233
+ */
234
+ enum Continent
235
+ {
236
+ CONTINENT_UNKNOWN = 0,
237
+ CONTINENT_AFRICA,
238
+ CONTINENT_ANTARCTICA,
239
+ CONTINENT_ASIA,
240
+ CONTINENT_EUROPE,
241
+ CONTINENT_NORTH_AMERICA,
242
+ CONTINENT_OCEANIA,
243
+ CONTINENT_SOUTH_AMERICA,
244
+ };
245
+ native Continent:geoip_continent_code(const ip[], result[3]);
246
+
247
+ /**
248
+ * Look up the full continent name for the given IP address.
249
+ *
250
+ * @note This native requires GeoIP City database, which can be retrieved from:
251
+ * http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
252
+ *
253
+ * @param ip The IP address to look up.
254
+ * @param result The result of the geoip look up.
255
+ * @param len The maximum length of the result buffer.
256
+ * @param id An optional player's index in order to return the result
257
+ * in the player's language, if supported.
258
+ * -1: the default language, which is english.
259
+ * 0: the server language. You can use LANG_SERVER define.
260
+ * >=1: the player's language.
261
+ *
262
+ * @return The result length on successful lookup, 0 otherwise.
263
+ */
264
+ native geoip_continent_name(const ip[], result[], len, id = -1);