@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.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/README.ru.md +162 -0
- package/amxmodx/base/include/amxconst.inc +594 -0
- package/amxmodx/base/include/amxmisc.inc +902 -0
- package/amxmodx/base/include/amxmodx.inc +3447 -0
- package/amxmodx/base/include/amxmodx_version.inc +20 -0
- package/amxmodx/base/include/cellarray.inc +525 -0
- package/amxmodx/base/include/cellstack.inc +166 -0
- package/amxmodx/base/include/celltrie.inc +412 -0
- package/amxmodx/base/include/core.inc +202 -0
- package/amxmodx/base/include/csstats.inc +298 -0
- package/amxmodx/base/include/csstats_const.inc +29 -0
- package/amxmodx/base/include/cstrike.inc +1287 -0
- package/amxmodx/base/include/cstrike_const.inc +521 -0
- package/amxmodx/base/include/csx.inc +259 -0
- package/amxmodx/base/include/cvars.inc +547 -0
- package/amxmodx/base/include/datapack.inc +161 -0
- package/amxmodx/base/include/dbi.inc +154 -0
- package/amxmodx/base/include/dodconst.inc +152 -0
- package/amxmodx/base/include/dodfun.inc +152 -0
- package/amxmodx/base/include/dodstats.inc +69 -0
- package/amxmodx/base/include/dodx.inc +161 -0
- package/amxmodx/base/include/engine.inc +1343 -0
- package/amxmodx/base/include/engine_const.inc +310 -0
- package/amxmodx/base/include/engine_stocks.inc +248 -0
- package/amxmodx/base/include/esf.inc +70 -0
- package/amxmodx/base/include/esf_const.inc +74 -0
- package/amxmodx/base/include/fakemeta.inc +1127 -0
- package/amxmodx/base/include/fakemeta_const.inc +793 -0
- package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
- package/amxmodx/base/include/fakemeta_util.inc +882 -0
- package/amxmodx/base/include/file.inc +666 -0
- package/amxmodx/base/include/float.inc +422 -0
- package/amxmodx/base/include/fun.inc +333 -0
- package/amxmodx/base/include/gameconfig.inc +93 -0
- package/amxmodx/base/include/geoip.inc +264 -0
- package/amxmodx/base/include/ham_const.inc +4352 -0
- package/amxmodx/base/include/hamsandwich.inc +439 -0
- package/amxmodx/base/include/hlsdk_const.inc +808 -0
- package/amxmodx/base/include/json.inc +777 -0
- package/amxmodx/base/include/lang.inc +119 -0
- package/amxmodx/base/include/message_const.inc +1130 -0
- package/amxmodx/base/include/message_stocks.inc +161 -0
- package/amxmodx/base/include/messages.inc +604 -0
- package/amxmodx/base/include/newmenus.inc +387 -0
- package/amxmodx/base/include/ns.inc +754 -0
- package/amxmodx/base/include/ns_const.inc +196 -0
- package/amxmodx/base/include/nvault.inc +154 -0
- package/amxmodx/base/include/regex.inc +348 -0
- package/amxmodx/base/include/sockets.inc +183 -0
- package/amxmodx/base/include/sorting.inc +107 -0
- package/amxmodx/base/include/sqlx.inc +582 -0
- package/amxmodx/base/include/string.inc +786 -0
- package/amxmodx/base/include/string_const.inc +156 -0
- package/amxmodx/base/include/string_stocks.inc +325 -0
- package/amxmodx/base/include/textparse_ini.inc +214 -0
- package/amxmodx/base/include/textparse_smc.inc +261 -0
- package/amxmodx/base/include/tfcconst.inc +84 -0
- package/amxmodx/base/include/tfcstats.inc +62 -0
- package/amxmodx/base/include/tfcx.inc +148 -0
- package/amxmodx/base/include/time.inc +118 -0
- package/amxmodx/base/include/tsconst.inc +154 -0
- package/amxmodx/base/include/tsfun.inc +198 -0
- package/amxmodx/base/include/tsstats.inc +65 -0
- package/amxmodx/base/include/tsx.inc +88 -0
- package/amxmodx/base/include/vault.inc +60 -0
- package/amxmodx/base/include/vector.inc +131 -0
- package/amxmodx/base/include/xs.inc +1570 -0
- package/as/amxts.d.ts +153 -0
- package/as/constants.ts +4730 -0
- package/as/effects.ts +1449 -0
- package/as/entities.ts +5482 -0
- package/as/events.ts +3054 -0
- package/as/facade.ts +4639 -0
- package/as/flags.ts +299 -0
- package/as/fs.ts +287 -0
- package/as/hooks.ts +18536 -0
- package/as/kit.ts +25 -0
- package/as/lib/check.ts +86 -0
- package/as/modules/http.ts +184 -0
- package/as/natives.ts +11845 -0
- package/as/os.ts +30 -0
- package/as/promise.ts +1392 -0
- package/as/promise.types.d.ts +82 -0
- package/as/remote.ts +288 -0
- package/as/tsconfig.json +22 -0
- package/as/vector.ts +65 -0
- package/bin/amxts.mjs +10 -0
- package/includes/menu_core.inc +355 -0
- package/includes/order.txt +54 -0
- package/includes/sources.json +27 -0
- package/includes/universal_config.inc +355 -0
- package/lint/oxlint-plugin.mjs +77 -0
- package/node_modules/assemblyscript/LICENSE +201 -0
- package/node_modules/assemblyscript/NOTICE +93 -0
- package/node_modules/assemblyscript/package.json +63 -0
- package/node_modules/assemblyscript/std/README.md +6 -0
- package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
- package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
- package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
- package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
- package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
- package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
- package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
- package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
- package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
- package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
- package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
- package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
- package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
- package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
- package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
- package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
- package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
- package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
- package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
- package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
- package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
- package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
- package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
- package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
- package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
- package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
- package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
- package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
- package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
- package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
- package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
- package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
- package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
- package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
- package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
- package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
- package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
- package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
- package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
- package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
- package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
- package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
- package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
- package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
- package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
- package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
- package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
- package/node_modules/assemblyscript/std/assembly.json +16 -0
- package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
- package/node_modules/assemblyscript/std/portable/index.js +416 -0
- package/node_modules/assemblyscript/std/portable.json +11 -0
- package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
- package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
- package/node_modules/assemblyscript/tsconfig-base.json +13 -0
- package/package.json +112 -0
- package/runtime/deps/assemblyscript/LICENSE +201 -0
- package/runtime/deps/assemblyscript/NOTICE +93 -0
- package/runtime/deps/assemblyscript/bin/asc.js +35 -0
- package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
- package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
- package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
- package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
- package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
- package/runtime/deps/assemblyscript/package.json +114 -0
- package/runtime/host/amxts.inc +85 -0
- package/runtime/licenses/AMXX-LICENSE.txt +34 -0
- package/runtime/licenses/AssemblyScript-LICENSE +201 -0
- package/runtime/licenses/AssemblyScript-NOTICE +93 -0
- package/runtime/licenses/Binaryen-LICENSE +201 -0
- package/runtime/licenses/Bun-LICENSE.md +84 -0
- package/runtime/licenses/GPL-3.0.txt +674 -0
- package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
- package/runtime/licenses/README.md +25 -0
- package/runtime/licenses/WAMR-LICENSE +219 -0
- package/runtime/natives.txt +1095 -0
- package/runtime/patches/README.md +59 -0
- package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
- package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
- package/scripts/apply-docs.ts +508 -0
- package/scripts/asc.ts +27 -0
- package/scripts/auto-imports.ts +258 -0
- package/scripts/build-wasm.ts +595 -0
- package/scripts/check.ts +93 -0
- package/scripts/compile-cache.ts +179 -0
- package/scripts/compile.ts +401 -0
- package/scripts/docker-server.ts +73 -0
- package/scripts/docs/as/amxts.ts +210 -0
- package/scripts/docs/as/effects.ts +1684 -0
- package/scripts/docs/as/facade.ts +3302 -0
- package/scripts/docs/as/fs.ts +173 -0
- package/scripts/docs/as/lib/check.ts +68 -0
- package/scripts/docs/as/modules/http.ts +66 -0
- package/scripts/docs/as/os.ts +16 -0
- package/scripts/docs/as/promise.ts +132 -0
- package/scripts/docs/as/promise.types.ts +63 -0
- package/scripts/docs/as/vector.ts +48 -0
- package/scripts/docs/entities.ts +2338 -0
- package/scripts/docs/events.ts +245 -0
- package/scripts/docs/game.ts +497 -0
- package/scripts/docs/messages.ts +148 -0
- package/scripts/file-contents.ts +74 -0
- package/scripts/includes.ts +134 -0
- package/scripts/player-fields.ts +866 -0
- package/scripts/plugin-cache.ts +92 -0
- package/scripts/plugin-natives.ts +1157 -0
- package/scripts/prebuilt.ts +268 -0
- package/scripts/prepare.ts +134 -0
- package/scripts/project.ts +973 -0
- package/scripts/run.ts +28 -0
- package/scripts/shared-modules.ts +906 -0
- package/scripts/system.ts +33 -0
- package/scripts/tracked-fs.ts +115 -0
- package/scripts/typed-configs.ts +788 -0
- package/scripts/ui.ts +77 -0
- package/src/cli-api.mjs +175 -0
- package/src/parser/include-parser.ts +506 -0
- package/src/system.mjs +155 -0
- package/src/testing/compile-cache.ts +31 -0
- package/src/testing/compile.ts +222 -0
- package/src/testing/coroutines.ts +191 -0
- package/src/testing/index.ts +39 -0
- package/src/testing/kits.ts +55 -0
- package/src/testing/memory.ts +125 -0
- package/src/testing/natives.ts +925 -0
- package/src/testing/server.ts +1874 -0
- package/src/testing/setup.ts +63 -0
- package/src/testing/tables.ts +139 -0
- package/src/types.ts +51 -0
|
@@ -0,0 +1,547 @@
|
|
|
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
|
+
#if defined _cvars_included
|
|
11
|
+
#endinput
|
|
12
|
+
#endif
|
|
13
|
+
#define _cvars_included
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* CVAR flags for create_cvar() and register_cvar().
|
|
17
|
+
*/
|
|
18
|
+
#define FCVAR_NONE 0 // No special behavior
|
|
19
|
+
#define FCVAR_ARCHIVE 1 // Cvar will be saved to vars.rc Set to cause it to be saved to vars.rc
|
|
20
|
+
#define FCVAR_USERINFO 2 // Cvar changes the client's info string
|
|
21
|
+
#define FCVAR_SERVER 4 // Clients get notified when cvar value is changed
|
|
22
|
+
#define FCVAR_EXTDLL 8 // Defined by an external DLL
|
|
23
|
+
#define FCVAR_CLIENTDLL 16 // Defined by the client DLL
|
|
24
|
+
#define FCVAR_PROTECTED 32 // Cvar value is masked from outside access, should be used for sensitive cvars like passwords
|
|
25
|
+
#define FCVAR_SPONLY 64 // Cvar can't be changed by clients connected to a multiplayer server
|
|
26
|
+
#define FCVAR_PRINTABLEONLY 128 // The cvar string value can not contain unprintable characters
|
|
27
|
+
#define FCVAR_UNLOGGED 256 // If the cvar is FCVAR_SERVER, don't log changes to a file/the console
|
|
28
|
+
#define FCVAR_NOEXTRAWHITEPACE 512 // Automatically strips trailing/leading white space from the string value
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Cvar bound constants used with [get|set]_pcvar_bounds().
|
|
32
|
+
*/
|
|
33
|
+
enum CvarBounds
|
|
34
|
+
{
|
|
35
|
+
CvarBound_Upper = 0,
|
|
36
|
+
CvarBound_Lower
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new cvar for the engine.
|
|
41
|
+
*
|
|
42
|
+
* @note This has the same effect as register_cvar() but provides more options.
|
|
43
|
+
* @note For a list of possible cvar flags see FCVAR_* constants above.
|
|
44
|
+
* @note If an already existing cvar is registered it will not be duplicated.
|
|
45
|
+
* The default value is only set when the cvar is registered for the very
|
|
46
|
+
* first time since the server was started. Cvar bounds are overwritten
|
|
47
|
+
* by the create_cvar() call just as if they were re-set using
|
|
48
|
+
* set_pcvar_bounds().
|
|
49
|
+
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
|
50
|
+
* set_pcvar_* set of functions.
|
|
51
|
+
*
|
|
52
|
+
* @param name Cvar name
|
|
53
|
+
* @param string Default cvar value
|
|
54
|
+
* @param flags Optional bitsum of flags specifying cvar behavior
|
|
55
|
+
* @param description Optional description of the cvar
|
|
56
|
+
* @param has_min Optional boolean that specifies if the cvar has a
|
|
57
|
+
* minimum value
|
|
58
|
+
* @param min_val Minimum floating point value
|
|
59
|
+
* @param has_max Optional boolean that specifies if the cvar has a
|
|
60
|
+
* maximum value
|
|
61
|
+
* @param max_val Maximum floating point value
|
|
62
|
+
*
|
|
63
|
+
* @return Unique cvar pointer
|
|
64
|
+
* @error If invalid bounds are provided (min_val > max_val or
|
|
65
|
+
* vice versa), an error will be thrown.
|
|
66
|
+
*/
|
|
67
|
+
native create_cvar(const name[], const string[], flags = FCVAR_NONE, const description[] = "", bool:has_min = false, Float:min_val = 0.0, bool:has_max = false, Float:max_val = 0.0);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Registers a new cvar for the engine.
|
|
71
|
+
*
|
|
72
|
+
* @note Deprecated. Consider to use create_cvar for more options.
|
|
73
|
+
* @note For a list of possible cvar flags see FCVAR_* constants in cvars.inc
|
|
74
|
+
* @note If an already existing cvar is registered it will not be duplicated.
|
|
75
|
+
* The default value is only set when the cvar is registered for the very
|
|
76
|
+
* first time since the server was started.
|
|
77
|
+
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
|
78
|
+
* set_pcvar_* set of functions.
|
|
79
|
+
*
|
|
80
|
+
* @param name Cvar name
|
|
81
|
+
* @param string Default cvar value
|
|
82
|
+
* @param flags Optional bitsum of flags specifying cvar behavior
|
|
83
|
+
* @param fvalue Unused
|
|
84
|
+
*
|
|
85
|
+
* @return Unique cvar pointer
|
|
86
|
+
*/
|
|
87
|
+
native register_cvar(const name[], const string[], flags = FCVAR_NONE, Float:fvalue = 0.0);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns if a cvar is registered on the server.
|
|
91
|
+
*
|
|
92
|
+
* @param cvar Cvar name to check
|
|
93
|
+
*
|
|
94
|
+
* @return 1 if the cvar exists, 0 otherwise
|
|
95
|
+
*/
|
|
96
|
+
native cvar_exists(const cvar[]);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns the cvar pointer of the specified cvar.
|
|
100
|
+
*
|
|
101
|
+
* @note A pointer is also returned by register_cvar() and create_cvar().
|
|
102
|
+
* Plugins can (and should) retrieve and use pointers for already existing
|
|
103
|
+
* mod cvars.
|
|
104
|
+
*
|
|
105
|
+
* @param cvar Cvar name to find
|
|
106
|
+
*
|
|
107
|
+
* @return Cvar pointer on success, 0 if cvar was not found
|
|
108
|
+
*/
|
|
109
|
+
native get_cvar_pointer(const cvar[]);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creates a hook for when a cvar's value is changed.
|
|
113
|
+
*
|
|
114
|
+
* @note Changing the cvar value from within this forward can lead to infinite
|
|
115
|
+
* recursion and should be avoided.
|
|
116
|
+
* @note The callback will be called in the following manner:
|
|
117
|
+
*
|
|
118
|
+
* public cvar_change_callback(pcvar, const old_value[], const new_value[])
|
|
119
|
+
*
|
|
120
|
+
* pcvar - Pointer to cvar that was changed
|
|
121
|
+
* old_value - Buffer containing the previous value of the cvar
|
|
122
|
+
* new_value - Buffer containing the new value of the cvar
|
|
123
|
+
*
|
|
124
|
+
* The return value is ignored
|
|
125
|
+
*
|
|
126
|
+
* @param pcvar Pointer to cvar
|
|
127
|
+
* @param callback Name of callback function
|
|
128
|
+
*
|
|
129
|
+
* @return Callback handle that can be used with
|
|
130
|
+
* [disable|enable]_cvar_hook
|
|
131
|
+
* @error If an invalid cvar pointer or callback function is provided,
|
|
132
|
+
* an error will be thrown.
|
|
133
|
+
*/
|
|
134
|
+
native cvarhook:hook_cvar_change(pcvar, const callback[]);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Disables a cvar hook, stopping it from being called.
|
|
138
|
+
*
|
|
139
|
+
* @note Use the handle returned by hook_cvar_change as the parameter here.
|
|
140
|
+
*
|
|
141
|
+
* @param handle Forward to disable
|
|
142
|
+
* @error If an invalid hook handle is provided, an error will be
|
|
143
|
+
* thrown.
|
|
144
|
+
*/
|
|
145
|
+
native disable_cvar_hook(cvarhook:handle);
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Enables a cvar hook, restoring it to being called.
|
|
149
|
+
*
|
|
150
|
+
* @note Use the handle returned by hook_cvar_change as the parameter here.
|
|
151
|
+
*
|
|
152
|
+
* @param handle Forward to enable
|
|
153
|
+
* @error If an invalid hook handle is provided, an error will be
|
|
154
|
+
* thrown.
|
|
155
|
+
*/
|
|
156
|
+
native enable_cvar_hook(cvarhook:handle);
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Returns flags of a cvar. The cvar is accessed by name.
|
|
160
|
+
*
|
|
161
|
+
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
162
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
163
|
+
* why the otherwise equivalent get_pcvar_flags() function should be used
|
|
164
|
+
* instead.
|
|
165
|
+
*
|
|
166
|
+
* @param cvar Cvar name to retrieve flags from
|
|
167
|
+
*
|
|
168
|
+
* @return Flag value
|
|
169
|
+
*/
|
|
170
|
+
native get_cvar_flags(const cvar[]);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Sets specified flags to a cvar. The cvar is accessed by name.
|
|
174
|
+
*
|
|
175
|
+
* @note Not permitted for the "amx_version", "amxmodx_version", "fun_version"
|
|
176
|
+
* and "sv_cheats" cvars.
|
|
177
|
+
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
178
|
+
* @note This function just adds the flags using a bitwise-or operation. After
|
|
179
|
+
* it has run the flags may not exactly equal the specified bitflag sum.
|
|
180
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
181
|
+
* why the otherwise equivalent set_pcvar_flags() function should be used
|
|
182
|
+
* instead.
|
|
183
|
+
*
|
|
184
|
+
* @param cvar Cvar name to remove flags from
|
|
185
|
+
* @param flags Bitflag sum of flags to set
|
|
186
|
+
*
|
|
187
|
+
* @return 1 on success, 0 if cvar does not exist or is not permitted
|
|
188
|
+
*/
|
|
189
|
+
native set_cvar_flags(const cvar[], flags);
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Removes specified flags from a cvar. The cvar is accessed by name.
|
|
193
|
+
*
|
|
194
|
+
* @note Not permitted for the "amx_version", "amxmodx_version", "fun_version"
|
|
195
|
+
* and "sv_cheats" cvars.
|
|
196
|
+
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
197
|
+
* @note This function removes the flags using a bitwise-and operation.
|
|
198
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
199
|
+
* why the set_pcvar_flags() function should be used instead.
|
|
200
|
+
*
|
|
201
|
+
* @param cvar Cvar name to remove flags from
|
|
202
|
+
* @param flags Bitflag sum of flags to remove
|
|
203
|
+
*
|
|
204
|
+
* @return 1 on success, 0 if cvar does not exist or is not permitted
|
|
205
|
+
*/
|
|
206
|
+
native remove_cvar_flags(const cvar[], flags=-1);
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Gets a string value from a cvar. The cvar is accessed by name.
|
|
210
|
+
*
|
|
211
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
212
|
+
* why the otherwise equivalent get_pcvar_string() function should be used
|
|
213
|
+
* instead.
|
|
214
|
+
*
|
|
215
|
+
* @param cvar Cvar name to retrieve value from
|
|
216
|
+
* @param output Buffer to copy cvar value to
|
|
217
|
+
* @param iLen Maximum size of the buffer
|
|
218
|
+
*
|
|
219
|
+
* @return Number of cells written to buffer.
|
|
220
|
+
*/
|
|
221
|
+
native get_cvar_string(const cvarname[], output[], iLen);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Sets a cvar to a given string value. The cvar is accessed by name.
|
|
225
|
+
*
|
|
226
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
227
|
+
* why the otherwise equivalent set_pcvar_string() function should be used
|
|
228
|
+
* instead.
|
|
229
|
+
*
|
|
230
|
+
* @param cvar Cvar name to set value of
|
|
231
|
+
* @param value Value to set cvar to
|
|
232
|
+
*
|
|
233
|
+
* @noreturn
|
|
234
|
+
*/
|
|
235
|
+
native set_cvar_string(const cvar[], const value[]);
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Returns a floating value from a cvar. The cvar is accessed by name.
|
|
239
|
+
*
|
|
240
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
241
|
+
* why the otherwise equivalent get_pcvar_float() function should be used
|
|
242
|
+
* instead.
|
|
243
|
+
*
|
|
244
|
+
* @param cvarname Cvar name to retrieve value from
|
|
245
|
+
*
|
|
246
|
+
* @return Cvar value, converted to float
|
|
247
|
+
*/
|
|
248
|
+
native Float:get_cvar_float(const cvarname[]);
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Sets a cvar to a given float value. The cvar is accessed by name.
|
|
252
|
+
*
|
|
253
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
254
|
+
* why the otherwise equivalent set_pcvar_float() function should be used
|
|
255
|
+
* instead.
|
|
256
|
+
*
|
|
257
|
+
* @param cvar Cvar name to set value of
|
|
258
|
+
* @param value Value to set cvar to
|
|
259
|
+
*
|
|
260
|
+
* @noreturn
|
|
261
|
+
*/
|
|
262
|
+
native set_cvar_float(const cvar[], Float:value);
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Returns an integer value from a cvar. The cvar is accessed by name.
|
|
266
|
+
*
|
|
267
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
268
|
+
* why the otherwise equivalent get_pcvar_num() function should be used
|
|
269
|
+
* instead.
|
|
270
|
+
*
|
|
271
|
+
* @param cvarname Cvar name to retrieve value from
|
|
272
|
+
*
|
|
273
|
+
* @return Cvar value, converted to int
|
|
274
|
+
*/
|
|
275
|
+
native get_cvar_num(const cvarname[]);
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Sets a cvar to a given integer value. The cvar is accessed by name.
|
|
279
|
+
*
|
|
280
|
+
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
281
|
+
* why the otherwise equivalent set_pcvar_num() function should be used
|
|
282
|
+
* instead.
|
|
283
|
+
*
|
|
284
|
+
* @param cvar Cvar name to set value of
|
|
285
|
+
* @param value Value to set cvar to
|
|
286
|
+
*
|
|
287
|
+
* @noreturn
|
|
288
|
+
*/
|
|
289
|
+
native set_cvar_num(const cvarname[], value);
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Returns flags of a cvar via direct pointer access.
|
|
293
|
+
*
|
|
294
|
+
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
295
|
+
*
|
|
296
|
+
* @param pcvar Pointer to cvar to retrieve flags from
|
|
297
|
+
*
|
|
298
|
+
* @return 1 on success, 0 if cvar pointer is invalid
|
|
299
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
300
|
+
* thrown.
|
|
301
|
+
*/
|
|
302
|
+
native get_pcvar_flags(pcvar);
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Sets specified flags to a cvar via direct pointer access.
|
|
306
|
+
*
|
|
307
|
+
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
308
|
+
* @note This function directly sets the provided bitflag, unlike set_cvar_flags
|
|
309
|
+
* which adds them using a bitwise OR.
|
|
310
|
+
*
|
|
311
|
+
* @param pcvar Pointer to cvar to set flags of
|
|
312
|
+
* @param flags Bitflag sum of flags to set
|
|
313
|
+
*
|
|
314
|
+
* @return 1 on success, 0 if cvar does not exist or is not permitted
|
|
315
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
316
|
+
* thrown.
|
|
317
|
+
*/
|
|
318
|
+
native set_pcvar_flags(pcvar, flags);
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Returns an integer value from a cvar via direct pointer access.
|
|
322
|
+
*
|
|
323
|
+
* @param pcvar Pointer to cvar to retrieve value from
|
|
324
|
+
*
|
|
325
|
+
* @return Cvar value, converted to int
|
|
326
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
327
|
+
* thrown.
|
|
328
|
+
*/
|
|
329
|
+
native get_pcvar_num(pcvar);
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Returns an boolean value from a cvar via direct pointer access.
|
|
333
|
+
*
|
|
334
|
+
* @param pcvar Pointer to cvar to retrieve value from
|
|
335
|
+
*
|
|
336
|
+
* @return Cvar value, converted to bool
|
|
337
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
338
|
+
* thrown.
|
|
339
|
+
*/
|
|
340
|
+
native bool:get_pcvar_bool(pcvar);
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Sets an integer value to a cvar via direct pointer access.
|
|
344
|
+
*
|
|
345
|
+
* @param pcvar Pointer to cvar to set value of
|
|
346
|
+
* @param num Value to set cvar to
|
|
347
|
+
*
|
|
348
|
+
* @noreturn
|
|
349
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
350
|
+
* thrown.
|
|
351
|
+
*/
|
|
352
|
+
native set_pcvar_num(pcvar, num);
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Sets a boolean value to a cvar via direct pointer access.
|
|
356
|
+
*
|
|
357
|
+
* @param pcvar Pointer to cvar to set value of
|
|
358
|
+
* @param num Value to set cvar to
|
|
359
|
+
*
|
|
360
|
+
* @noreturn
|
|
361
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
362
|
+
* thrown.
|
|
363
|
+
*/
|
|
364
|
+
native set_pcvar_bool(pcvar, bool:num);
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Returns a float value from a cvar via direct pointer access.
|
|
368
|
+
*
|
|
369
|
+
* @param pcvar Pointer to cvar to retrieve value from
|
|
370
|
+
*
|
|
371
|
+
* @return Cvar value, converted to float
|
|
372
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
373
|
+
* thrown.
|
|
374
|
+
*/
|
|
375
|
+
native Float:get_pcvar_float(pcvar);
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Sets a float value to a cvar via direct pointer access.
|
|
379
|
+
*
|
|
380
|
+
* @param pcvar Pointer to cvar to set value of
|
|
381
|
+
* @param num Value to set cvar to
|
|
382
|
+
*
|
|
383
|
+
* @noreturn
|
|
384
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
385
|
+
* thrown.
|
|
386
|
+
*/
|
|
387
|
+
native set_pcvar_float(pcvar, Float:num);
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Returns a string value from a cvar via direct pointer access.
|
|
391
|
+
*
|
|
392
|
+
* @param pcvar Pointer to cvar to retrieve value from
|
|
393
|
+
* @param string Buffer to copy cvar value to
|
|
394
|
+
* @param maxlen Maximum size of the buffer
|
|
395
|
+
*
|
|
396
|
+
* @return Number of cells written to buffer.
|
|
397
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
398
|
+
* thrown.
|
|
399
|
+
*/
|
|
400
|
+
native get_pcvar_string(pcvar, string[], maxlen);
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Sets a string value to a cvar via direct pointer access.
|
|
404
|
+
*
|
|
405
|
+
* @param pcvar Pointer to cvar to retrieve value from
|
|
406
|
+
* @param string Value to set cvar to
|
|
407
|
+
*
|
|
408
|
+
* @noreturn
|
|
409
|
+
* @error If an invalid cvar pointer is provided, an error will be
|
|
410
|
+
* thrown.
|
|
411
|
+
*/
|
|
412
|
+
native set_pcvar_string(pcvar, const string[]);
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Retrieves the specified value boundary of a cvar.
|
|
416
|
+
*
|
|
417
|
+
* @param pcvar Pointer to cvar
|
|
418
|
+
* @param type Type of boundary to retrieve
|
|
419
|
+
* @param value Variable to store the specified boundary to
|
|
420
|
+
*
|
|
421
|
+
* @return True if the cvar has a boundary set, false otherwise
|
|
422
|
+
* @error If an invalid cvar pointer or boundary type is provided,
|
|
423
|
+
* an error will be thrown.
|
|
424
|
+
*/
|
|
425
|
+
native bool:get_pcvar_bounds(pcvar, CvarBounds:type, &Float:value);
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Sets the specified boundary of a cvar.
|
|
429
|
+
*
|
|
430
|
+
* @param pcvar Pointer to cvar
|
|
431
|
+
* @param type Type of boundary to set
|
|
432
|
+
* @param set If true the cvar boundary will be set, otherwise it will be
|
|
433
|
+
* removed (value is ignored)
|
|
434
|
+
* @param value Floating point value to use as the boundary
|
|
435
|
+
*
|
|
436
|
+
* @noreturn
|
|
437
|
+
* @error If an invalid cvar pointer or boundary type is provided, an
|
|
438
|
+
* error will be thrown.
|
|
439
|
+
*/
|
|
440
|
+
native set_pcvar_bounds(pcvar, CvarBounds:type, bool:set, Float:value = 0.0);
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Binds a cvar's integer value to a global variable. The variable will then
|
|
444
|
+
* always contain the current cvar value as it is automatically kept up to date.
|
|
445
|
+
*
|
|
446
|
+
* @note The variable *has* to be a global or a static variable. Local variables
|
|
447
|
+
* created within functions can not be used for technical reasons.
|
|
448
|
+
* @note Variables can not be bound to multiple cvars.
|
|
449
|
+
*
|
|
450
|
+
* @param pcvar Pointer to cvar
|
|
451
|
+
* @param var Global variable to keep updated
|
|
452
|
+
*
|
|
453
|
+
* @noreturn
|
|
454
|
+
* @error If an invalid cvar pointer or variable is provided, an error
|
|
455
|
+
* will be thrown.
|
|
456
|
+
*/
|
|
457
|
+
native bind_pcvar_num(pcvar, &any:var);
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Binds a cvar's float value to a global variable. The variable will then
|
|
461
|
+
* always contain the current cvar value as it is automatically kept up to date.
|
|
462
|
+
*
|
|
463
|
+
* @note The variable *has* to be a global or a static variable. Local variables
|
|
464
|
+
* created within functions can not be used for technical reasons.
|
|
465
|
+
* @note Variables can not be bound to multiple cvars.
|
|
466
|
+
*
|
|
467
|
+
* @param pcvar Pointer to cvar
|
|
468
|
+
* @param var Global variable to keep updated
|
|
469
|
+
*
|
|
470
|
+
* @noreturn
|
|
471
|
+
* @error If an invalid cvar pointer or variable is provided, an error
|
|
472
|
+
* will be thrown.
|
|
473
|
+
*/
|
|
474
|
+
native bind_pcvar_float(pcvar, &Float:var);
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Binds a cvar's string value to a global array. The array will then
|
|
478
|
+
* always contain the current cvar value as it is automatically kept up to date.
|
|
479
|
+
*
|
|
480
|
+
* @note The array *has* to be a global or a static array. Local arrays
|
|
481
|
+
* created within functions can not be used for technical reasons.
|
|
482
|
+
* @note Arrays can not be bound to multiple cvars.
|
|
483
|
+
*
|
|
484
|
+
* @param pcvar Pointer to cvar
|
|
485
|
+
* @param var Global array to keep updated
|
|
486
|
+
* @param varlen Maximum length of string array
|
|
487
|
+
*
|
|
488
|
+
* @noreturn
|
|
489
|
+
* @error If an invalid cvar pointer or variable is provided, an error
|
|
490
|
+
* will be thrown.
|
|
491
|
+
*/
|
|
492
|
+
native bind_pcvar_string(pcvar, any:var[], varlen);
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Returns the number of plugin-registered cvars.
|
|
496
|
+
*
|
|
497
|
+
* @return Number of registered cvars
|
|
498
|
+
*/
|
|
499
|
+
native get_plugins_cvarsnum();
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Retrieves information about a plugin-registered cvar via iterative access.
|
|
503
|
+
*
|
|
504
|
+
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
|
505
|
+
* set_pcvar_* set of functions.
|
|
506
|
+
* @note The cvar index does not equal the cvar pointer. It is the internal
|
|
507
|
+
* AMXX id of a cvar, incremented for each registered cvar.
|
|
508
|
+
*
|
|
509
|
+
* @param num Index to retrieve
|
|
510
|
+
* @param name Buffer to copy cvar name to
|
|
511
|
+
* @param namelen Maximum buffer size
|
|
512
|
+
* @param flags Variable to store cvar flags to
|
|
513
|
+
* @param plugin_id Variable to store id of the registering plugin to
|
|
514
|
+
* @param pcvar_handle Variable to store cvar pointer to
|
|
515
|
+
* @param description Variable to store cvar description to
|
|
516
|
+
* @param desc_len Maximum length of string buffer
|
|
517
|
+
*
|
|
518
|
+
* @return 1 on success, 0 if index is invalid
|
|
519
|
+
*/
|
|
520
|
+
native get_plugins_cvar(num, name[], namelen, &flags = 0, &plugin_id = 0, &pcvar_handle = 0, description[] = "", desc_len = 0);
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Dispatches a client cvar query, allowing the plugin to query for its value on
|
|
524
|
+
* the client.
|
|
525
|
+
*
|
|
526
|
+
* @note The callback will be called in the following manner:
|
|
527
|
+
*
|
|
528
|
+
* public cvar_query_callback(id, const cvar[], const value[], const param[])
|
|
529
|
+
*
|
|
530
|
+
* id - Client index
|
|
531
|
+
* cvar - Cvar queried
|
|
532
|
+
* value - Cvar value on the client
|
|
533
|
+
* param - Optional extra data
|
|
534
|
+
*
|
|
535
|
+
* @param id Client index
|
|
536
|
+
* @param cvar Cvar to query
|
|
537
|
+
* @param resultFunc Callback function
|
|
538
|
+
* @param paramlen Size of extra data
|
|
539
|
+
* @param params Extra data to pass through to callback
|
|
540
|
+
*
|
|
541
|
+
* @noreturn
|
|
542
|
+
* @error If the client index is not within the range of 1 to
|
|
543
|
+
* MaxClients, the client is not connected, the callback
|
|
544
|
+
* function is invalid or the querying process encounters
|
|
545
|
+
* a problem, an error will be thrown.
|
|
546
|
+
*/
|
|
547
|
+
native query_client_cvar(id, const cvar[], const resultFunc[], paramlen = 0, const params[] = "");
|
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
#if defined _datapack_included
|
|
11
|
+
#endinput
|
|
12
|
+
#endif
|
|
13
|
+
#define _datapack_included
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Datapack tag declaration
|
|
17
|
+
*
|
|
18
|
+
* @note Datapacks provide a way to store and move around arbitrary amounts (and
|
|
19
|
+
* types) of data in AMX Mox X. Data is packed into a single cell value -
|
|
20
|
+
* the DataPack handle. This handle can be passed around more easily, can
|
|
21
|
+
* be returned by functions and can simulate advanced concepts like string
|
|
22
|
+
* consummation.
|
|
23
|
+
* @note Plugins are responsible for freeing all datapack handles they acquire.
|
|
24
|
+
* Failing to free handles will result in the plugin and AMXX leaking
|
|
25
|
+
* memory.
|
|
26
|
+
*/
|
|
27
|
+
enum DataPack
|
|
28
|
+
{
|
|
29
|
+
Invalid_DataPack = 0
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new datapack.
|
|
34
|
+
*
|
|
35
|
+
* @return New datapack handle, which must be freed via DestroyDataPack().
|
|
36
|
+
*/
|
|
37
|
+
native DataPack:CreateDataPack();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Packs a cell value into a datapack.
|
|
41
|
+
*
|
|
42
|
+
* @param pack Datapack handle
|
|
43
|
+
* @param cell Cell value to pack
|
|
44
|
+
*
|
|
45
|
+
* @noreturn
|
|
46
|
+
* @error If an invalid handle is provided, an error will be thrown.
|
|
47
|
+
*/
|
|
48
|
+
native WritePackCell(DataPack:pack, any:cell);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Packs a float value into a datapack.
|
|
52
|
+
*
|
|
53
|
+
* @param pack Datapack handle
|
|
54
|
+
* @param val Float value to pack
|
|
55
|
+
*
|
|
56
|
+
* @noreturn
|
|
57
|
+
* @error If an invalid handle is provided, an error will be thrown.
|
|
58
|
+
*/
|
|
59
|
+
native WritePackFloat(DataPack:pack, Float:val);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Packs a string into a datapack.
|
|
63
|
+
*
|
|
64
|
+
* @param pack Datapack handle
|
|
65
|
+
* @param str String to pack
|
|
66
|
+
*
|
|
67
|
+
* @return Length of copied string
|
|
68
|
+
* @error If an invalid handle is provided, an error will be thrown.
|
|
69
|
+
*/
|
|
70
|
+
native WritePackString(DataPack:pack, const str[]);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Reads a cell from a Datapack.
|
|
74
|
+
*
|
|
75
|
+
* @param pack Datapack handle
|
|
76
|
+
*
|
|
77
|
+
* @return Cell value
|
|
78
|
+
* @error If an invalid handle is provided, or not enough data is left
|
|
79
|
+
* in the datapack, an error will be thrown.
|
|
80
|
+
*/
|
|
81
|
+
native any:ReadPackCell(DataPack:pack);
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Reads a float from a datapack.
|
|
85
|
+
*
|
|
86
|
+
* @param pack Datapack handle
|
|
87
|
+
*
|
|
88
|
+
* @return Float value
|
|
89
|
+
* @error If an invalid handle is provided, or not enough data is left
|
|
90
|
+
* in the datapack, an error will be thrown.
|
|
91
|
+
*/
|
|
92
|
+
native Float:ReadPackFloat(DataPack:pack);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Reads a string from a Datapack.
|
|
96
|
+
*
|
|
97
|
+
* @param pack Datapack handle
|
|
98
|
+
* @param buffer Buffer to copy string to
|
|
99
|
+
* @param maxlen Maximum size of buffer
|
|
100
|
+
*
|
|
101
|
+
* @return Number of cells written to buffer
|
|
102
|
+
* @error If an invalid handle is provided, or not enough data is left
|
|
103
|
+
* in the datapack, an error will be thrown.
|
|
104
|
+
*/
|
|
105
|
+
native ReadPackString(DataPack:pack, buffer[], maxlen);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Resets the datapack read/write position to the start.
|
|
109
|
+
*
|
|
110
|
+
* @param pack Datapack handle
|
|
111
|
+
* @param clear If true, clears the contained data
|
|
112
|
+
*
|
|
113
|
+
* @noreturn
|
|
114
|
+
* @error If an invalid handle is provided, an error will be thrown.
|
|
115
|
+
*/
|
|
116
|
+
native ResetPack(DataPack:pack, bool:clear = false);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns the datapack read/write position.
|
|
120
|
+
*
|
|
121
|
+
* @param pack Datapack handle
|
|
122
|
+
*
|
|
123
|
+
* @return Position in the datapack, only usable with calls to SetPackPosition
|
|
124
|
+
* @error If an invalid handle is provided, an error will be thrown.
|
|
125
|
+
*/
|
|
126
|
+
native DataPackPos:GetPackPosition(DataPack:pack);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Sets the datapack read/write position.
|
|
130
|
+
*
|
|
131
|
+
* @note This should only ever be used with (known to be valid) positions
|
|
132
|
+
* returned by GetPackPosition(). It is not possible for plugins to safely
|
|
133
|
+
* compute datapack positions.
|
|
134
|
+
*
|
|
135
|
+
* @param pack Datapack handle
|
|
136
|
+
* @param position New position to set
|
|
137
|
+
*
|
|
138
|
+
* @noreturn
|
|
139
|
+
* @error If an invalid handle is provided, or the new position is
|
|
140
|
+
* out of datapack bounds, an error will be thrown.
|
|
141
|
+
*/
|
|
142
|
+
native SetPackPosition(DataPack:pack, DataPackPos:position);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Returns if the datapack has reached its end and no more data can be read.
|
|
146
|
+
*
|
|
147
|
+
* @param pack Datapack handle
|
|
148
|
+
*
|
|
149
|
+
* @return True if datapack has reached the end, false otherwise
|
|
150
|
+
* @error If an invalid handle is provided, an error will be thrown.
|
|
151
|
+
*/
|
|
152
|
+
native bool:IsPackEnded(DataPack:pack);
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Destroys the datapack and frees its memory.
|
|
156
|
+
*
|
|
157
|
+
* @param pack Datapack handle
|
|
158
|
+
*
|
|
159
|
+
* @return True if disposed, false otherwise
|
|
160
|
+
*/
|
|
161
|
+
native DestroyDataPack(&DataPack:pack);
|