@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,1287 @@
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
+ // Counter-Strike Functions
12
+ //
13
+
14
+ #if defined _cstrike_included
15
+ #endinput
16
+ #endif
17
+ #define _cstrike_included
18
+
19
+ #pragma reqlib cstrike
20
+ #if !defined AMXMODX_NOAUTOLOAD
21
+ #pragma loadlib cstrike
22
+ #endif
23
+
24
+ #include <cstrike_const>
25
+
26
+ /**
27
+ * Returns client's deaths.
28
+ *
29
+ * @param index Client index
30
+ *
31
+ * @return Client deaths
32
+ * @error If the client index is not within the range of 1 to
33
+ * MaxClients, or the client is not connected, an error will be
34
+ * thrown.
35
+ */
36
+ native cs_get_user_deaths(index);
37
+
38
+ /**
39
+ * Sets client's deaths.
40
+ *
41
+ * @param index Client index
42
+ * @param newdeaths New value to set
43
+ * @param scoreboard If true the scoreboard will be updated to reflect the new value.
44
+ *
45
+ * @noreturn
46
+ * @error If the client index is not within the range of 1 to
47
+ * MaxClients, or the client is not connected, an error
48
+ * will be thrown.
49
+ */
50
+ native cs_set_user_deaths(index, newdeaths, bool:scoreboard = true);
51
+
52
+ /**
53
+ * Returns index of the entity that a hostage is following.
54
+ *
55
+ * @note Hostages can theoretically follow any entity in the game, so the
56
+ * returned entity index is not necessarily a client index.
57
+ *
58
+ * @param index Hostage entity index
59
+ *
60
+ * @return Entity index if hostage is following something, 0 otherwise
61
+ * @error If the provided entity index is not a hostage, an error will
62
+ * be thrown.
63
+ */
64
+ native cs_get_hostage_foll(index);
65
+
66
+ /**
67
+ * Sets hostage to follow an entity.
68
+ *
69
+ * @note Hostages can theoretically follow any entity in the game, so the
70
+ * followedindex does not have to be a client index.
71
+ *
72
+ * @param index Hostage entity index
73
+ * @param followedindex New entity to follow
74
+ *
75
+ * @noreturn
76
+ * @error If the provided entity index is not a hostage, an
77
+ * error will be thrown.
78
+ */
79
+ native cs_set_hostage_foll(index, followedindex = 0);
80
+
81
+ /**
82
+ * Returns unique id of a hostage.
83
+ *
84
+ * @param index Hostage entity index
85
+ *
86
+ * @return Unique hostage id
87
+ * @error If the provided entity index is not a hostage, an error will
88
+ * be thrown.
89
+ */
90
+ native cs_get_hostage_id(index);
91
+
92
+ /**
93
+ * Returns amount of ammo in the client's backpack for a specific weapon.
94
+ *
95
+ * @note For a list of possible weapon ids see the CSW_* constants in
96
+ * amxconst.inc
97
+ * @note Some weapons share ammo types and therefore ammo backpack pools. List
98
+ * of ammo types:
99
+ * ammo_338magnum - awp
100
+ * ammo_762nato - scout, ak47, g3sg1
101
+ * ammo_556natobox - m249
102
+ * ammo_556nato - famas, m4a1, aug, sg550, galil, sg552
103
+ * ammo_buckshot - m3, xm1014
104
+ * ammo_45acp - usp, ump45, mac10
105
+ * ammo_57mm - fiveseven, p90
106
+ * ammo_50ae - deagle
107
+ * ammo_357sig - p228
108
+ * ammo_9mm - glock, mp5, tmp, elites
109
+ * / - hegrenade
110
+ * / - flashbang
111
+ * / - smokegrenade
112
+ *
113
+ * @param index Client index
114
+ * @param weapon Weapon id
115
+ *
116
+ * @return Amount of ammo in backpack
117
+ * @error If the client index is not within the range of 1 to
118
+ * MaxClients, the client is not connected, or an invalid
119
+ * weapon id is provided, an error will be thrown.
120
+ */
121
+ native cs_get_user_bpammo(index, weapon);
122
+
123
+ /**
124
+ * Sets amount of ammo in the client's backpack for a specific weapon.
125
+ *
126
+ * @note For a list of possible weapon ids see the CSW_* constants in
127
+ * amxconst.inc
128
+ * @note Some weapons share ammo types and therefore ammo backpack pools. List
129
+ * of ammo types:
130
+ * ammo_338magnum - awp
131
+ * ammo_762nato - scout, ak47, g3sg1
132
+ * ammo_556natobox - m249
133
+ * ammo_556nato - famas, m4a1, aug, sg550, galil, sg552
134
+ * ammo_buckshot - m3, xm1014
135
+ * ammo_45acp - usp, ump45, mac10
136
+ * ammo_57mm - fiveseven, p90
137
+ * ammo_50ae - deagle
138
+ * ammo_357sig - p228
139
+ * ammo_9mm - glock, mp5, tmp, elites
140
+ * / - hegrenade
141
+ * / - flashbang
142
+ * / - smokegrenade
143
+ *
144
+ * @param index Client index
145
+ * @param weapon Weapon id
146
+ * @param amount New backpack ammo amount to set
147
+ *
148
+ * @noreturn
149
+ * @error If the client index is not within the range of 1 to
150
+ * MaxClients, the client is not connected, or an invalid
151
+ * weapon id is provided, an error will be thrown.
152
+ */
153
+ native cs_set_user_bpammo(index, weapon, amount);
154
+
155
+ /**
156
+ * Returns if the client has a defuse kit.
157
+ *
158
+ * @param index Client index
159
+ *
160
+ * @return 1 if the client has a defuse kit, 0 otherwise
161
+ * @error If the client index is not within the range of 1 to
162
+ * MaxClients, the client is not connected, or an invalid
163
+ * weapon id is provided, an error will be thrown.
164
+ */
165
+ native cs_get_user_defuse(index);
166
+
167
+ /**
168
+ * Sets the client's defusekit status and allows to set a custom HUD icon and
169
+ * color.
170
+ *
171
+ * @param index Client index
172
+ * @param defusekit If nonzero the client will have a defusekit, otherwise
173
+ * it will be removed
174
+ * @param r Red component of icon color
175
+ * @param g Green component of icon color
176
+ * @param b Blue component of icon color
177
+ * @param icon HUD sprite to use as icon
178
+ * @param flash If nonzero the icon will flash red
179
+ *
180
+ * @noreturn
181
+ * @error If the client index is not within the range of 1 to
182
+ * MaxClients, or the client is not connected, an error
183
+ * will be thrown.
184
+ */
185
+ native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0);
186
+
187
+ /**
188
+ * Returns if the client is inside a buyzone.
189
+ *
190
+ * @param index Client index
191
+ *
192
+ * @return 1 if the client is inside a buyzone, 0 otherwise
193
+ * @error If the client index is not within the range of 1 to
194
+ * MaxClients, or the client is not connected, an error will be
195
+ * thrown.
196
+ */
197
+ native cs_get_user_buyzone(index);
198
+
199
+ /**
200
+ * Returns if the client has a primary weapon or a shield in the inventory.
201
+ *
202
+ * @param index Client index
203
+ *
204
+ * @return 1 if the client has a primary weapon or shield in the
205
+ * inventory, 0 otherwise
206
+ * @error If the client index is not within the range of 1 to
207
+ * MaxClients, or the client is not connected, an error will be
208
+ * thrown.
209
+ */
210
+ native cs_get_user_hasprim(index);
211
+
212
+ /**
213
+ * Retrieves the client's player model.
214
+ *
215
+ * @param index Client index
216
+ * @param model Buffer to copy model to
217
+ * @param len Maximum buffer size
218
+ *
219
+ * @return Number of cells written to buffer
220
+ * @error If the client index is not within the range of 1 to
221
+ * MaxClients, or the client is not connected, an error will be
222
+ * thrown.
223
+ */
224
+ native cs_get_user_model(index, model[], len);
225
+
226
+ /**
227
+ * Sets the client's player model.
228
+ *
229
+ * @note This is not a one-time set. The CStrike module will remember the
230
+ * selected model and try to prevent attempts at changing the player
231
+ * model, or immediately re-apply it if necessary.
232
+ * @note Updating modelindex is useful for custom models which don't have
233
+ * the same structure as the default ones (hitbox, etc..). Model must
234
+ * be precached before.
235
+ *
236
+ * @param index Client index
237
+ * @param model Model name
238
+ * @param update_index If true, the modelindex is updated as well
239
+ *
240
+ * @noreturn
241
+ * @error If the client index is not within the range of 1 to
242
+ * MaxClients, the client is not connected, the provided
243
+ * model is empty, or if modeindex is updated and the
244
+ * provided model is not precached, an error will be thrown.
245
+ */
246
+ native cs_set_user_model(index, const model[], bool:update_index = false);
247
+
248
+ /**
249
+ * Resets the client's model.
250
+ *
251
+ * @note This lifts the model-lock set by a previous cs_set_user_model() call.
252
+ *
253
+ * @param index Client index
254
+ *
255
+ * @noreturn
256
+ * @error If the client index is not within the range of 1 to
257
+ * MaxClients, or the client is not connected, an error will be
258
+ * thrown.
259
+ */
260
+ native cs_reset_user_model(index);
261
+
262
+ /**
263
+ * Returns the client's amount of money.
264
+ *
265
+ * @param index Client index
266
+ *
267
+ * @return Amount of money
268
+ * @error If the client index is not within the range of 1 to
269
+ * MaxClients, or the client is not connected, an error will be
270
+ * thrown.
271
+ */
272
+ native cs_get_user_money(index);
273
+
274
+ /**
275
+ * Sets the client's amount of money.
276
+ *
277
+ * @param index Client index
278
+ * @param money New amount to set
279
+ * @param flash If nonzero the HUD will flash the difference between new
280
+ * and old amount in red or green
281
+ *
282
+ * @noreturn
283
+ * @error If the client index is not within the range of 1 to
284
+ * MaxClients, or the client is not connected, an error will be
285
+ * thrown.
286
+ */
287
+ native cs_set_user_money(index, money, flash = 1);
288
+
289
+ /**
290
+ * Returns if the client's has night vision goggles.
291
+ *
292
+ * @param index Client index
293
+ *
294
+ * @return 1 if user has NVG, 0 otherwise
295
+ * @error If the client index is not within the range of 1 to
296
+ * MaxClients, or the client is not connected, an error will be
297
+ * thrown.
298
+ */
299
+ native cs_get_user_nvg(index);
300
+
301
+ /**
302
+ * Sets the client's night vision goggles.
303
+ *
304
+ * @param index Client index
305
+ * @param nvgoogles If nonzero the NVG will be added to the client's
306
+ * inventory, otherwise they will be removed from it
307
+ *
308
+ * @noreturn
309
+ * @error If the client index is not within the range of 1 to
310
+ * MaxClients, or the client is not connected, an error
311
+ * will be thrown.
312
+ */
313
+ native cs_set_user_nvg(index, nvgoggles = 1);
314
+
315
+ /**
316
+ * Returns if the client has the ability to plant the bomb.
317
+ *
318
+ * @note Only with this set can the client plant the bomb within the usual bomb
319
+ * target areas. If this is not set the user can not plant the bomb, even
320
+ * when he has one in the inventory.
321
+ *
322
+ * @param index Client index
323
+ *
324
+ * @return 1 if the client is able to plant the bomb, 0 otherwise
325
+ * @error If the client index is not within the range of 1 to
326
+ * MaxClients, or the client is not connected, an error will be
327
+ * thrown.
328
+ */
329
+ native cs_get_user_plant(index);
330
+
331
+ /**
332
+ * Sets the client's ability to plant the bomb and displays or hides the bomb
333
+ * HUD icon.
334
+ *
335
+ * @note Only with this set can the client plant the bomb within the usual bomb
336
+ * target areas. If this is not set the user can not plant the bomb, even
337
+ * when he has one in the inventory. This is only correctly set when the
338
+ * client touches a bomb and picks it up "manually" (only possible for
339
+ * Terrorists), so this should be used if the bomb is added to the
340
+ * inventory through other means.
341
+ *
342
+ * @param index Client index
343
+ * @param plant If nonzero the client will be able to plant the bomb,
344
+ * otherwise he will be unable to
345
+ * @param showbombicon If nonzero the green C4 icon will be displayed on the
346
+ * client's hud, otherwise it will be hidden
347
+ *
348
+ * @return 1 if the client is able to plant the bomb, 0 otherwise
349
+ * @error If the client index is not within the range of 1 to
350
+ * MaxClients, or the client is not connected, an error
351
+ * will be thrown.
352
+ */
353
+ native cs_set_user_plant(index, plant = 1, showbombicon = 1);
354
+
355
+ /**
356
+ * Sets the client's team without killing the player, and sets the client model.
357
+ *
358
+ * @note For a list of valid team ids see the CsTeams enum, and for a list of
359
+ * valid internal model ids see the CsInternalModel enum.
360
+ *
361
+ * @param index Client index
362
+ * @param team Team id
363
+ * @param model Internal model id, if CS_DONTCHANGE the game will choose the model
364
+ * or if CS_NORESET the game will not update it.
365
+ * @param send_teaminfo If true, a TeamInfo message will be sent
366
+ *
367
+ * @noreturn
368
+ * @error If the client index is not within the range of 1 to
369
+ * MaxClients, or the client is not connected, an error will be
370
+ * thrown.
371
+ */
372
+ native cs_set_user_team(index, any:team, any:model = CS_DONTCHANGE, bool:send_teaminfo = true);
373
+
374
+ /**
375
+ * Returns the client's team and optionally the model id.
376
+ *
377
+ * @note For a list of valid team ids see the CsTeams enum, and for a list of
378
+ * valid internal model ids see the CsInternalModel enum.
379
+ *
380
+ * @param index Client index
381
+ * @param model Optional variable to store model id in
382
+ *
383
+ * @return Team id
384
+ * @error If the client index is not within the range of 1 to
385
+ * MaxClients, or the client is not connected, an error will be
386
+ * thrown.
387
+ */
388
+ native CsTeams:cs_get_user_team(index, &any:model = CS_DONTCHANGE);
389
+
390
+ /**
391
+ * Returns if the client is a VIP.
392
+ *
393
+ * @param index Client index
394
+ *
395
+ * @return 1 if the client is a VIP, 0 otherwise
396
+ * @error If the client index is not within the range of 1 to
397
+ * MaxClients, or the client is not connected, an error will be
398
+ * thrown.
399
+ */
400
+ native cs_get_user_vip(index);
401
+
402
+ /**
403
+ * Sets the client's VIP status and displayed model and scoreboard flag.
404
+ *
405
+ * @note This is mostly useful for removing VIP status so the client can change
406
+ * teams and/or buy items properly. It does not alter gameplay, the player
407
+ * that is selected as VIP at the start of a round will retain the
408
+ * internal VIP status and remain the primary objective for the game mode.
409
+ *
410
+ * @param index Client index
411
+ * @param vip If nonzero the client will be made a VIP, otherwise the
412
+ * VIP status will be removed
413
+ * @param model If nonzero the client's model will be changed to the VIP
414
+ * model, otherwise a random CT model will be selected
415
+ * @param scoreboard If nonzero the scoreboard will be updated to reflect the
416
+ * new VIP status
417
+ *
418
+ * @noreturn
419
+ * @error If the client index is not within the range of 1 to
420
+ * MaxClients, or the client is not connected, an error
421
+ * will be thrown.
422
+ */
423
+ native cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1);
424
+
425
+ /**
426
+ * Returns if the client has committed a team kill in the current round.
427
+ *
428
+ * @note If this is set to 1 the client will be punished at the start of the
429
+ * next round depending on the value of the mp_tkpunish cvar. The team
430
+ * kill status is then reset.
431
+ *
432
+ * @param index Client index
433
+ *
434
+ * @return 1 if the client has committed a team kill, 0 otherwise
435
+ * @error If the client index is not within the range of 1 to
436
+ * MaxClients, or the client is not connected, an error will be
437
+ * thrown.
438
+ */
439
+ native cs_get_user_tked(index);
440
+
441
+ /**
442
+ * Sets the client's team kill status, indicating whether the client has
443
+ * committed a team kill in the current round.
444
+ *
445
+ * @note If this is set to 1 the client will be punished at the start of the
446
+ * next round depending on the value of the mp_tkpunish cvar. The team
447
+ * kill status is then reset.
448
+ *
449
+ * @param index Client index
450
+ * @param tk Team kill status
451
+ * @param subtract Amount of frags to subtract, negative values add frags
452
+ *
453
+ * @noreturn
454
+ * @error If the client index is not within the range of 1 to
455
+ * MaxClients, or the client is not connected, an error will be
456
+ * thrown.
457
+ */
458
+ native cs_set_user_tked(index, tk = 1, subtract = 1);
459
+
460
+ /**
461
+ * Returns if the client is currently driving a vehicle and if so, indicates
462
+ * the speed.
463
+ *
464
+ * @param index Client index
465
+ *
466
+ * @return 0 if the client is not driving, 1 if driving a vehicle but
467
+ * not moving, 2 to 4 if driving positive speeds, 5 if
468
+ * driving at a negative speed (backing), see TRAIN_* constants
469
+ * in hlsdk_const.inc
470
+ * @error If the client index is not within the range of 1 to
471
+ * MaxClients, or the client is not connected, an error will be
472
+ * thrown.
473
+ */
474
+ native cs_get_user_driving(index);
475
+
476
+ /**
477
+ * Returns if the client has a shield in the inventory.
478
+ *
479
+ * @param index Client index
480
+ *
481
+ * @return 1 if the client has a shield, 0 otherwise
482
+ * @error If the client index is not within the range of 1 to
483
+ * MaxClients, or the client is not connected, an error will be
484
+ * thrown.
485
+ */
486
+ native cs_get_user_shield(index);
487
+
488
+ /**
489
+ * Returns if the client is using a stationary gun.
490
+ *
491
+ * @param index Client index
492
+ *
493
+ * @return 1 if the client uses a stationary gun, 0 otherwise
494
+ * @error If the client index is not within the range of 1 to
495
+ * MaxClients, or the client is not connected, an error will be
496
+ * thrown.
497
+ */
498
+ native cs_get_user_stationary(index);
499
+
500
+ /**
501
+ * Returns the client's armor value and retrieves the type of armor.
502
+ *
503
+ * @note For a list of possible armor types see the CsArmorType enum.
504
+ *
505
+ * @param index Client index
506
+ * @param armortype Variable to store armor type in
507
+ *
508
+ * @return Amount of armor, 0 if client has no armor
509
+ * @error If the client index is not within the range of 1 to
510
+ * MaxClients, or the client is not connected, an error
511
+ * will be thrown.
512
+ */
513
+ native cs_get_user_armor(index, &CsArmorType:armortype = CS_ARMOR_NONE);
514
+
515
+ /**
516
+ * Sets the client's armor value the type of armor.
517
+ *
518
+ * @note For a list of possible armor types see the CsArmorType enum.
519
+ * @note Sends the appropriate message to update the client's HUD.
520
+ *
521
+ * @param index Client index
522
+ * @param armorvalue Amount of armor to set
523
+ * @param armortype CS armor type
524
+ *
525
+ * @noreturn
526
+ * @error If the client index is not within the range of 1 to
527
+ * MaxClients, or the client is not connected, an error
528
+ * will be thrown.
529
+ */
530
+ native cs_set_user_armor(index, armorvalue, CsArmorType:armortype);
531
+
532
+ /**
533
+ * Returns if the weapon is in burst mode.
534
+ *
535
+ * @note Only the Glock and Famas can return 1 as they are the only guns in the
536
+ * game that have a burst fire mode.
537
+ * @note This native does not verify that the provided entity is a weapon
538
+ * entity. It will return incorrect values for non-weapon entities.
539
+ *
540
+ * @param index Weapon entity index
541
+ *
542
+ * @return 1 if the weapon is in burst mode, 0 otherwise
543
+ * @error If an invalid entity index or a client index is provided,
544
+ * an error will be thrown.
545
+ */
546
+ native cs_get_weapon_burst(index);
547
+
548
+ /**
549
+ * Sets the weapon's burst mode.
550
+ *
551
+ * @note Only the Glock and Famas can be set to burst fire mode as they are the
552
+ * only guns in the game that provide such a mode.
553
+ * @note This native does not verify that the provided entity is a weapon
554
+ * entity. It will result in undefined behavior if used on non-weapon
555
+ * entities.
556
+ *
557
+ * @param index Weapon entity index
558
+ * @param burstmode If nonzero the weapon will be put into burstmode,
559
+ * otherwise the burst mode will be removed
560
+ *
561
+ * @return 1 if burst mode set successfully, 0 if entity is not
562
+ * an applicable weapon
563
+ * @error If an invalid entity index or a client index is
564
+ * provided, an error will be thrown.
565
+ */
566
+ native cs_set_weapon_burst(index, burstmode = 1);
567
+
568
+ /**
569
+ * Returns if the weapon is in silenced mode.
570
+ *
571
+ * @note Only the USP and M4A1 can return 1 as they are the only guns in the
572
+ * game that have a silenced fire mode.
573
+ * @note This native does not verify that the provided entity is a weapon
574
+ * entity. It will return incorrect values for non-weapon entities.
575
+ *
576
+ * @param index Weapon entity index
577
+ *
578
+ * @return 1 if the weapon is in silenced mode, 0 otherwise
579
+ * @error If an invalid entity index or a client index is provided,
580
+ * an error will be thrown.
581
+ */
582
+ native cs_get_weapon_silen(index);
583
+
584
+ /**
585
+ * Sets the weapon's silenced mode.
586
+ *
587
+ * @note Only the USP and M4A1 can be set to silenced fire mode as they are the
588
+ * only guns in the game that provide such a mode.
589
+ * @note This native does not verify that the provided entity is a weapon
590
+ * entity. It will result in undefined behavior if used on non-weapon
591
+ * entities.
592
+ *
593
+ * @param index Weapon entity index
594
+ * @param silence If nonzero the weapon will be put into silenced
595
+ * mode, otherwise the silenced mode will be removed
596
+ * @param draw_animation If 1 and the weapon is currently held by a
597
+ * client, the appropriate weapon animation will be
598
+ * played
599
+ * If 2, same as 1 but follows game behavior by playing
600
+ * the associated player's model sequence and disallowing
601
+ * firing while animation is playing.
602
+ *
603
+ * @return 1 if silenced mode set successfully, 0 if entity is
604
+ * not an applicable weapon
605
+ * @error If an invalid entity index or a client index is
606
+ * provided, an error will be thrown.
607
+ */
608
+ native cs_set_weapon_silen(index, silence = 1, draw_animation = 1);
609
+
610
+ /**
611
+ * Returns the amount of ammo in weapon's magazine.
612
+ *
613
+ * @note This native does not verify that the provided entity is a weapon
614
+ * entity. It will return incorrect values for non-weapon entities.
615
+ *
616
+ * @param index Weapon entity index
617
+ *
618
+ * @return Amount of ammo in magazine
619
+ * @error If an invalid entity index or a client index is provided,
620
+ * an error will be thrown.
621
+ */
622
+ native cs_get_weapon_ammo(index);
623
+
624
+ /**
625
+ * Sets the amount of ammo in weapon's clip.
626
+ *
627
+ * @note This native does not verify that the provided entity is a weapon
628
+ * entity. It will result in undefined behavior if used on non-weapon
629
+ * entities.
630
+ *
631
+ * @param index Weapon entity index
632
+ * @param newammo New ammo amount
633
+ *
634
+ * @noreturn
635
+ * @error If an invalid entity index or a client index is provided,
636
+ * an error will be thrown.
637
+ */
638
+ native cs_set_weapon_ammo(index, newammo);
639
+
640
+ /**
641
+ * Returns the weapon id of an entity.
642
+ *
643
+ * @note For a list of possible weapon ids see the CSW_* constants in
644
+ * amxconst.inc
645
+ * @note This native does not verify that the provided entity is a weapon
646
+ * entity. It will return incorrect values for non-weapon entities.
647
+ *
648
+ * @param index Weapon entity index
649
+ *
650
+ * @return Weapon id
651
+ * @error If an invalid entity index or a client index is provided,
652
+ * an error will be thrown.
653
+ */
654
+ native cs_get_weapon_id(index);
655
+
656
+ /**
657
+ * Returns if "no knives" mode is enabled.
658
+ *
659
+ * @note "No knives" mode means that the CStrike module will prevent the game
660
+ * from creating (and thus attaching) "weapon_knife" entities. This means
661
+ * that clients will spawn without knives, but knives can still be put
662
+ * into the client inventories directly.
663
+ *
664
+ * @return 1 if "no knives" mode is enabled, 0 otherwise
665
+ */
666
+ native cs_get_no_knives();
667
+
668
+ /**
669
+ * Enables or disables the "no knives" mode.
670
+ *
671
+ * @note "No knives" mode means that the CStrike module will prevent the game
672
+ * from creating (and thus attaching) "weapon_knife" entities. This means
673
+ * that clients will spawn without knives, but knives can still be put
674
+ * into the client inventories directly.
675
+ *
676
+ * @param noknives If nonzero enable "no knives" mode, disable otherwise
677
+ *
678
+ * @noreturn
679
+ */
680
+ native cs_set_no_knives(noknives = 0);
681
+
682
+ /**
683
+ * Sets a dead client up for spawning.
684
+ *
685
+ * @note This sets the client deadflag and triggers a client think, effectively
686
+ * making the game respawn the client. Should only be used on dead
687
+ * clients.
688
+ *
689
+ * @param player Client index
690
+ *
691
+ * @noreturn
692
+ * @error If the client index is not within the range of 1 to
693
+ * MaxClients, or the client is not connected, an error will be
694
+ * thrown.
695
+ */
696
+ native cs_user_spawn(player);
697
+
698
+ /**
699
+ * Returns the armoury entity's weapon id.
700
+ *
701
+ * @note Not all weapon ids are supported by Counter-Strike, an armoury entity
702
+ * can not be a pistol, a knife or a bomb for exmaple. The full list is:
703
+ * CSW_SCOUT, CSW_HEGRENADE, CSW_XM1014, CSW_MAC10, CSW_AUG,
704
+ * CSW_SMOKEGRENADE, CSW_AWP, CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1,
705
+ * CSW_TMP, CSW_G3SG1, CSW_VEST, CSW_VESTHELM, CSW_FLASHBANG,
706
+ * CSW_SG552, CSW_AK47, CSW_P90
707
+ *
708
+ * @param index Armoury entity index
709
+ * @param count Optional variable to store in the number of times that an item can be retrieved
710
+ * from the same entity before being hidden
711
+ *
712
+ * @return Weapon id
713
+ * @error If a non-armoury entity is provided, an error will be
714
+ * thrown.
715
+ */
716
+ native cs_get_armoury_type(index, &count = 1);
717
+
718
+ /**
719
+ * Sets the amoury entity type.
720
+ *
721
+ * @note Not all weapon ids are supported by Counter-Strike, an armoury entity
722
+ * can not be a pistol, a knife or a bomb for exmaple. The full list is:
723
+ * CSW_SCOUT, CSW_HEGRENADE, CSW_XM1014, CSW_MAC10, CSW_AUG,
724
+ * CSW_SMOKEGRENADE, CSW_AWP, CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1,
725
+ * CSW_TMP, CSW_G3SG1, CSW_VEST, CSW_VESTHELM, CSW_FLASHBANG,
726
+ * CSW_SG552, CSW_AK47, CSW_P90
727
+ * @note This does not update the entity model.
728
+ * @note On restart, entity is always unhidden and the count is restored (this can not be below 1).
729
+ *
730
+ * @param index Armoury entity index
731
+ * @param type Weapon id
732
+ * @param count Number of times that an item can be retrieved from
733
+ * the same entity before being hidden
734
+ * If zero, the entity is hidden
735
+ * If below zero, nothing is set
736
+ * @noreturn
737
+ * @error If a non-armoury entity is provided, an error will be
738
+ * thrown.
739
+ */
740
+ native cs_set_armoury_type(index, type, count = -1);
741
+
742
+ /**
743
+ * Returns the weapon entity index that was packed into a weaponbox.
744
+ *
745
+ * @param weaponboxIndex Weaponbox entity index
746
+ *
747
+ * @return Weapon entity index on success or 0 if no weapon can be found
748
+ * @error If a non-weaponbox entity is provided or the entity is invalid, an error will be
749
+ * thrown.
750
+ */
751
+ native cs_get_weaponbox_item(weaponboxIndex);
752
+
753
+ /**
754
+ * Returns the map zones the client is inside of as a bitflag value.
755
+ *
756
+ * @note If the user does not have the ability to plant (cs_get_user_plant()
757
+ * returns 0) then the bitflag will not contain CS_MAPZONE_BOMBTARGET.
758
+ * @nore For a list of possible zone flags see the CS_MAPZONE_* constants.
759
+ *
760
+ * @param index Client index
761
+ *
762
+ * @return Bitflag value of map zones
763
+ * @error If the client index is not within the range of 1 to
764
+ * MaxClients, or the client is not connected, an error will be
765
+ * thrown.
766
+ */
767
+ native cs_get_user_mapzones(index);
768
+
769
+ /**
770
+ * Sets a zoom type on the client.
771
+ *
772
+ * @note Zoom types are not tied to their intended weapons, so any zoom type can
773
+ * be combined with any weapon.
774
+ * @note For a list of possible zoom types see the zoom type enum above
775
+ * (CS_*_ZOOM constants).
776
+ *
777
+ * @param index Client index
778
+ * @param type Zoom type
779
+ * @param mode If zero (blocking) the client will be forced to use the zoom
780
+ * type set and won't be able to change it until it is reset
781
+ * with CS_RESET_ZOOM, otherwise the user can restore back to
782
+ * normal as usual
783
+ *
784
+ * @noreturn
785
+ * @error If the client index is not within the range of 1 to
786
+ * MaxClients, the client is not connected, or an invalid zoom
787
+ * type is provided, an error will be thrown.
788
+ */
789
+ native cs_set_user_zoom(index, type, mode);
790
+
791
+ /**
792
+ * Returns if the client is zooming.
793
+ *
794
+ * @note For a list of possible zoom types see the zoom type enum above
795
+ * (CS_*_ZOOM constants).
796
+ *
797
+ * @param index Client index
798
+ *
799
+ * @return Zoom type if the user is zoomed in, 0 otherwise
800
+ * @error If the client index is not within the range of 1 to
801
+ * MaxClients, or the client is not connected, an error will be
802
+ * thrown.
803
+ */
804
+ native cs_get_user_zoom(index);
805
+
806
+ /**
807
+ * Returns if a submodel is set on the client.
808
+ *
809
+ * @note In Counter-Strike the submodel setting determines whether the user has
810
+ * a bomb backpack (if a Terrorist) or a defuse kit (if a CT) on their
811
+ * model.
812
+ *
813
+ * @param index Client index
814
+ *
815
+ * @return 1 if submodel is set, 0 otherwise
816
+ * @error If the client index is not within the range of 1 to
817
+ * MaxClients, or the client is not connected, an error will be
818
+ * thrown.
819
+ */
820
+ native cs_get_user_submodel(index);
821
+
822
+ /**
823
+ * Sets the submodel on a client.
824
+ *
825
+ * @note In Counter-Strike the submodel setting determines whether the user has
826
+ * a bomb backpack (if a Terrorist) or a defuse kit (if a CT) on their
827
+ * model.
828
+ *
829
+ * @param index Client index
830
+ * @param value If nonzero the submodel is set, otherwise it is removed
831
+ *
832
+ * @noreturn
833
+ * @error If the client index is not within the range of 1 to
834
+ * MaxClients, or the client is not connected, an error will be
835
+ */
836
+ native cs_set_user_submodel(index, value);
837
+
838
+ /**
839
+ * Returns the client's last activity time.
840
+ *
841
+ * @note This is the time that the internal Counter-Strike afk kicker uses to
842
+ * see who has been inactive too long.
843
+ *
844
+ * @param index Client index
845
+ *
846
+ * @return Last activity time
847
+ * @error If the client index is not within the range of 1 to
848
+ * MaxClients, or the client is not connected, an error will be
849
+ */
850
+ native Float:cs_get_user_lastactivity(index);
851
+
852
+ /**
853
+ * Sets the client's last activity time.
854
+ *
855
+ * @note This is the time that the internal Counter-Strike afk kicker uses to
856
+ * see who has been inactive too long.
857
+ *
858
+ * @param index Client index
859
+ * @param value New last activity time
860
+ *
861
+ * @noreturn
862
+ * @error If the client index is not within the range of 1 to
863
+ * MaxClients, or the client is not connected, an error will be
864
+ */
865
+ native cs_set_user_lastactivity(index, Float:value);
866
+
867
+ /**
868
+ * Returns the amount of hostages that the client has killed.
869
+ *
870
+ * @note This is the value that the internal Counter-Strike hostage punisher
871
+ * uses to determine if a client should be kicked, depending on the
872
+ * value of the mp_hostagepenalty value.
873
+ *
874
+ * @param index Client index
875
+ *
876
+ * @return Amount of hostages killed
877
+ * @error If the client index is not within the range of 1 to
878
+ * MaxClients, or the client is not connected, an error will be
879
+ */
880
+ native cs_get_user_hostagekills(index);
881
+
882
+ /**
883
+ * Sets the amount of hostages that the client has killed.
884
+ *
885
+ * @note This is the value that the internal Counter-Strike hostage punisher
886
+ * uses to determine if a client should be kicked, depending on the
887
+ * value of the mp_hostagepenalty value. The punisher only checks this
888
+ * value when a hostage is killed, so setting this will not cause the
889
+ * client to be kicked until they actually kill a hostage.
890
+ *
891
+ * @param index Client index
892
+ * @param value New amount of hostages killed
893
+ *
894
+ * @noreturn
895
+ * @error If the client index is not within the range of 1 to
896
+ * MaxClients, or the client is not connected, an error will be
897
+ */
898
+ native cs_set_user_hostagekills(index, value);
899
+
900
+ /**
901
+ * Returns the last time a hostage was used.
902
+ *
903
+ * @param index Hostage entity
904
+ *
905
+ * @return Last use time
906
+ * @error If the provided entity index is not a hostage, an error will
907
+ * be thrown.
908
+ */
909
+ native Float:cs_get_hostage_lastuse(index);
910
+
911
+ /**
912
+ * Sets the last time a hostage was used.
913
+ *
914
+ * @param index Hostage entity
915
+ * @param value New last use time
916
+ *
917
+ * @noreturn
918
+ * @error If the provided entity index is not a hostage, an error will
919
+ * be thrown.
920
+ */
921
+ native cs_set_hostage_lastuse(index, Float:value);
922
+
923
+ /**
924
+ * Returns the next time a hostage can be used.
925
+ *
926
+ * @param index Hostage entity
927
+ *
928
+ * @return Next use time
929
+ * @error If the provided entity index is not a hostage, an error will
930
+ * be thrown.
931
+ */
932
+ native Float:cs_get_hostage_nextuse(index);
933
+
934
+ /**
935
+ * Sets the next time a hostage can be used.
936
+ *
937
+ * @param index Hostage entity
938
+ * @param value New next use time
939
+ *
940
+ * @noreturn
941
+ * @error If the provided entity index is not a hostage, an error will
942
+ * be thrown.
943
+ */
944
+ native cs_set_hostage_nextuse(index, Float:value);
945
+
946
+ /**
947
+ * Returns the game time at which the bomb will explode.
948
+ *
949
+ * @param index C4 entity
950
+ *
951
+ * @return Explosion time
952
+ * @error If the provided entity index is not a bomb, an error will be
953
+ * thrown.
954
+ */
955
+ native Float:cs_get_c4_explode_time(index);
956
+
957
+ /**
958
+ * Sets the game time at which the bomb will explode.
959
+ *
960
+ * @param index C4 entity
961
+ * @param value New explosion time
962
+ *
963
+ * @noreturn
964
+ * @error If the provided entity index is not a bomb, an error will be
965
+ * thrown.
966
+ */
967
+ native cs_set_c4_explode_time(index, Float:value);
968
+
969
+ /**
970
+ * Returns if the bomb is being defused.
971
+ *
972
+ * @param c4index C4 entity
973
+ *
974
+ * @return 1 if the bomb is being defused, 0 otherwise
975
+ * @error If the provided entity index is not a bomb, an error will be
976
+ * thrown.
977
+ */
978
+ native bool:cs_get_c4_defusing(c4index);
979
+
980
+ /**
981
+ * Sets if the bomb is being defused.
982
+ *
983
+ * @param c4index C4 entity
984
+ * @param defusing True if the bomb should be defused, false otherwise
985
+ *
986
+ * @noreturn
987
+ * @error If the provided entity index is not a bomb, an error will be
988
+ * thrown.
989
+ */
990
+ native cs_set_c4_defusing(c4index, bool:defusing);
991
+
992
+ /**
993
+ * Creates an entity using Counter-Strike's custom CreateNamedEntity wrapper.
994
+ *
995
+ * @note Unlike other mods CS keeps track of entities using a custom hashtable.
996
+ * This function adds entities to this hashtable, providing benefits over
997
+ * the default CreateNamedEntity (used by create_entity() for example):
998
+ * - Storing entities in a hashtable allows CS to improve classname lookup
999
+ * performance compared to functions like FindEntityByString (used by
1000
+ * find_ent_by_class() for example) that usually have to loop
1001
+ * through all entities incrementally.
1002
+ * - As CS exclusively uses the hashtable for classname lookup, entities
1003
+ * created using the default engine functions will not be found by the
1004
+ * game. For example "weaponbox" entities are supposed to be
1005
+ * automatically cleaned up on round restart but are not considered if
1006
+ * they have not been added to the hashtable.
1007
+ * @note The faster hashtable lookup can be utilized with cs_find_ent_by_class()
1008
+ * @note When creating an entity the classname has to be valid in the mod, as
1009
+ * the engine needs to link the entity to an existing class internally.
1010
+ * The classname string that is stored in the entvar struct
1011
+ * (EV_SZ_classname) is separate from this association and can later be
1012
+ * freely changed to serve other purposes.
1013
+ *
1014
+ * @param classname Entity class name
1015
+ *
1016
+ * @return Index of the created entity (> 0), 0 otherwise
1017
+ */
1018
+ native cs_create_entity(const classname[]);
1019
+
1020
+ /**
1021
+ * Finds an entity in the world using Counter-Strike's custom FindEntityByString
1022
+ * wrapper.
1023
+ *
1024
+ * @note Unlike other mods CS keeps track of entities using a custom hashtable.
1025
+ * This function utilizes the hasthable and allows for considerably faster
1026
+ * classname lookup compared to the default FindEntityByString (used by
1027
+ * find_ent_by_class() for example).
1028
+ * @note This exclusively considers entities in the hashtable, created by the
1029
+ * game itself, using cs_create_entity(), or added via cs_set_ent_class().
1030
+ *
1031
+ * @param start_index Entity index to start searching from. -1 to start from
1032
+ * the first entity
1033
+ * @param classname Classname to search for
1034
+ *
1035
+ * @return Entity index > 0 if found, 0 otherwise
1036
+ */
1037
+ native cs_find_ent_by_class(start_index, const classname[]);
1038
+
1039
+ /**
1040
+ * Finds an entity in the world using Counter-Strike's custom FindEntityByString
1041
+ * wrapper, matching by owner.
1042
+ *
1043
+ * @note Unlike other mods CS keeps track of entities using a custom hashtable.
1044
+ * This function utilizes the hasthable and allows for considerably faster
1045
+ * classname lookup compared to the default FindEntityByString (used by
1046
+ * find_ent_by_owner() for example).
1047
+ * @note This exclusively considers entities in the hashtable, created by the
1048
+ * game itself, using cs_create_entity(), or added via cs_set_ent_class().
1049
+ *
1050
+ * @param start_index Entity index to start searching from. -1 to start from
1051
+ * the first entity
1052
+ * @param classname Classname to search for
1053
+ * @param owner Entity index to search for entity's owner
1054
+ *
1055
+ * @return Entity index > 0 if found, 0 otherwise
1056
+ */
1057
+ native cs_find_ent_by_owner(start_index, const classname[], owner);
1058
+
1059
+ /**
1060
+ * Sets a custom classname of an entity.
1061
+ *
1062
+ * @note Unlike other mods CS keeps track of entities using a custom hashtable.
1063
+ * This function adds or updates the classname in the hasthable as well.
1064
+ * This is useful for use with cs_find_ent_by_class() and cs_find_ent_by_owner().
1065
+ *
1066
+ * @param index Entity index
1067
+ * @param classname Classname to update for
1068
+ *
1069
+ * @noreturn
1070
+ */
1071
+ native cs_set_ent_class(index, const classname[]);
1072
+
1073
+ /**
1074
+ * Returns the item id associated with an item name and its aliases.
1075
+ *
1076
+ * @note The item name is case sensitive an can be with or without
1077
+ * weapon_ and item_ prefixes. This can be a command alias as well.
1078
+ * Values examples: ak47, weapon_ak47, kevlar, item_kevlar, vest, bullpup, ...
1079
+ *
1080
+ * @param name Alias or classname
1081
+ * @param classid If item is a weapon, variable to store the associated
1082
+ * weapon class id in (CS_WEAPONCLASS_* constants)
1083
+ *
1084
+ * @return Item id (CSI_* constants)
1085
+ */
1086
+ native any:cs_get_item_id(const name[], &CsWeaponClassType:classid = CS_WEAPONCLASS_NONE);
1087
+
1088
+ /**
1089
+ * Returns the alias name associated with an item index.
1090
+ *
1091
+ * @param itemid Item id (CSI_* constants)
1092
+ * @param name Buffer to store alias name to
1093
+ * @param name_maxlen Maximum buffer size
1094
+ * @param altname Optional buffer to store if available alternative alias name to
1095
+ * @param altname_maxlen Maximum buffer size
1096
+ *
1097
+ * @return True if alias is found, false otherwise
1098
+ */
1099
+ native bool:cs_get_item_alias(itemid, name[], name_maxlen, altname[] = "", altname_maxlen = 0);
1100
+
1101
+ /**
1102
+ * Returns an item name associated with a command alias.
1103
+ *
1104
+ * @note The alias is case sensitive.
1105
+ * @note If not an alias to a weapon, buffer will be set with the original alias.
1106
+ *
1107
+ * @param alias Alias name
1108
+ * @param itemname Buffer to store item name to
1109
+ * @param maxlength Maximum buffer size
1110
+ *
1111
+ * @return True if alias is translated, false otherwise
1112
+ */
1113
+ native bool:cs_get_translated_item_alias(const alias[], itemname[], maxlength);
1114
+
1115
+ /**
1116
+ * Returns some information about a weapon.
1117
+ *
1118
+ * @param weapon_id Weapon id, see CSW_* constants
1119
+ * @param type Info type, see CS_WEAPONINFO_* constants
1120
+ *
1121
+ * @return Weapon information value
1122
+ * @error If weapon_id and type are out of bound, an error will be thrown.
1123
+ */
1124
+ native any:cs_get_weapon_info(weapon_id, CsWeaponInfo:type);
1125
+
1126
+ /**
1127
+ * Returns active weapon entity.
1128
+ *
1129
+ * @param playerIndex Player index
1130
+ *
1131
+ * @return Weapon entity index on success or 0 if there is no active weapon
1132
+ * @error If the client index is not within the range of 1 to
1133
+ * maxClients, or the client is not connected, an error will be
1134
+ * thrown.
1135
+ */
1136
+ native cs_get_user_weapon_entity(playerIndex);
1137
+
1138
+ /**
1139
+ * Returns weapon index of the active weapon.
1140
+ *
1141
+ * @note More reliable than get_user_weapon.
1142
+ *
1143
+ * @param playerIndex Player index
1144
+ * @param clip Optional variable to store clip ammo to
1145
+ * @param ammo Optional variable to store backpack ammo to
1146
+ *
1147
+ * @return Weapon index on success or 0 if there is no active weapon
1148
+ * @error If the client index is not within the range of 1 to
1149
+ * maxClients, or the client is not connected, an error will be
1150
+ * thrown.
1151
+ */
1152
+ native cs_get_user_weapon(playerIndex, &clip = 0, &ammo = 0);
1153
+
1154
+ /**
1155
+ * Returns a weapon class id associated with a weapon id.
1156
+ *
1157
+ * @param weapon_id Weapon id (CSI_* constants)
1158
+ *
1159
+ * @return Weapon class id (CS_WEAPONCLASS_* constants)
1160
+ */
1161
+ stock CsWeaponClassType:cs_get_weapon_class(weapon_id)
1162
+ {
1163
+ new CsWeaponClassType:type = CS_WEAPONCLASS_NONE;
1164
+
1165
+ if (cs_is_valid_itemid(weapon_id, .weapon_only = true) || weapon_id == CSI_SHIELD)
1166
+ {
1167
+ switch (weapon_id)
1168
+ {
1169
+ case CSI_SHIELDGUN, CSI_SHIELD:
1170
+ {
1171
+ type = CS_WEAPONCLASS_PISTOL;
1172
+ }
1173
+ case CSI_KNIFE:
1174
+ {
1175
+ type = CS_WEAPONCLASS_KNIFE;
1176
+ }
1177
+ default:
1178
+ {
1179
+ new const bits = (1 << weapon_id);
1180
+
1181
+ if(bits & CSI_ALL_PISTOLS)
1182
+ {
1183
+ type = CS_WEAPONCLASS_PISTOL;
1184
+ }
1185
+ else if(bits & CSI_ALL_GRENADES)
1186
+ {
1187
+ type = CS_WEAPONCLASS_GRENADE;
1188
+ }
1189
+ else if(bits & CSI_ALL_SMGS)
1190
+ {
1191
+ type = CS_WEAPONCLASS_SUBMACHINEGUN;
1192
+ }
1193
+ else if(bits & CSI_ALL_SHOTGUNS)
1194
+ {
1195
+ type = CS_WEAPONCLASS_SHOTGUN;
1196
+ }
1197
+ else if(bits & CSI_ALL_MACHINEGUNS)
1198
+ {
1199
+ type = CS_WEAPONCLASS_MACHINEGUN;
1200
+ }
1201
+ else if(bits & CSI_ALL_RIFLES)
1202
+ {
1203
+ type = CS_WEAPONCLASS_RIFLE;
1204
+ }
1205
+ else if(bits & CSI_ALL_SNIPERRIFLES)
1206
+ {
1207
+ type = CS_WEAPONCLASS_SNIPERRIFLE;
1208
+ }
1209
+ }
1210
+ }
1211
+ }
1212
+
1213
+ return type;
1214
+ }
1215
+
1216
+ /**
1217
+ * Checks whether an item id is not out of bounds.
1218
+ *
1219
+ * @param id Item id (CSI_* constants)
1220
+ * @param weapon_only If true, only the real weapon ids will be checked,
1221
+ * including shield as well
1222
+ *
1223
+ * @return True if item id is valid, false otherwise
1224
+ */
1225
+ stock bool:cs_is_valid_itemid(id, bool:weapon_only = false)
1226
+ {
1227
+ if (id <= CSI_NONE)
1228
+ {
1229
+ return false;
1230
+ }
1231
+
1232
+ if (id > CSI_LAST_WEAPON && id != CSI_SHIELDGUN && weapon_only)
1233
+ {
1234
+ return false;
1235
+ }
1236
+
1237
+ if (id >= CSI_MAX_COUNT)
1238
+ {
1239
+ return false;
1240
+ }
1241
+
1242
+ return true;
1243
+ }
1244
+
1245
+ /**
1246
+ * Called when CS internally fires a command to a player.
1247
+ *
1248
+ * @note This is most notably used by the rebuy/autobuy functionality,
1249
+ * Condition Zero also uses this to pass commands to bots internally.
1250
+ *
1251
+ * @param id Client index
1252
+ * @param cmd Command string
1253
+ *
1254
+ * @return PLUGIN_CONTINUE to let the command continue
1255
+ * PLUGIN_HANDLED to block the command
1256
+ */
1257
+ forward CS_InternalCommand(id, const cmd[]);
1258
+
1259
+ /**
1260
+ * Called when a client attempts to purchase an item.
1261
+ *
1262
+ * @note This is called immediately when the client issues a buy command. The
1263
+ * game has not yet checked if the client can actually buy the weapon.
1264
+ * @note For a list of possible item ids see the CSI_* constants.
1265
+ *
1266
+ * @param index Client index
1267
+ * @param item Item id
1268
+ *
1269
+ * @return PLUGIN_CONTINUE to let the buy attempt continue
1270
+ * PLUGIN_HANDLED to block the buy attempt
1271
+ */
1272
+ forward CS_OnBuyAttempt(index, item);
1273
+
1274
+ /**
1275
+ * Called when a client purchases an item.
1276
+ *
1277
+ * @note This is called right before the user receives the item and before the
1278
+ * money is deducted from their cash reserves.
1279
+ * @note For a list of possible item ids see the CSI_* constants.
1280
+ *
1281
+ * @param index Client index
1282
+ * @param item Item id
1283
+ *
1284
+ * @return PLUGIN_CONTINUE to let the buy continue
1285
+ * PLUGIN_HANDLED to block the buy
1286
+ */
1287
+ forward CS_OnBuy(index, item);