-
Notifications
You must be signed in to change notification settings - Fork 18
Configuration natives
native pp_version();
Returns a non-decreasing integer that represents the current version of the plugin.
native pp_version_string(version[], size=sizeof(version));
native String:pp_version_string_s();
Returns a string representation of the current version of the plugin.
native pp_hook_strlen(bool:hook);
Dynamic strings can hold the null character, but AMX API function amx_StrLen
ignores the characters that come after it. It is hooked by default to take null characters into account for dynamic strings, but it can be toggled.
native pp_hook_check_ref_args(bool:hook);
Variadic functions (with ...
) pass all arguments by reference, meaning amx_GetAddr
will be used on the actual variable and not on the string address. It is possible to look into the variable if it contains a string address, but this decreases performance of every call and may misinterpret normal values. This function enables this behaviour.
native pp_max_recursion(level);
Changes the maximum allowed number of nested calls to amx_Exec
, i.e. the maximum size of recursion of entering the script. By default, it is unlimited. Setting this to a sufficient number can prevent crashes caused by unrestricted recursion. This limit is global. The function returns the old value.
native bool:pp_toggle_exec_hook(bool:toggle);
Disables the hook of amx_Exec
and thus also any corresponding features that involve manipulating the execution of the AMX machine. The function returns the old value.
native pp_public_min_index(index);
One of the ways of dealing with the SAMPGDK incompatibility. When amx_FindPublic
returns a negative index, it is compared to index
and if it is less, a failure is reported. Thus calling the function with index
being 0 makes PawnPlus ignore all public functions defined by SAMPGDK. Value of -1 resets the behaviour. The function returns the original value.
native bool:pp_use_funcidx(bool:use);
The other (and more compatible, albeit a bit slower) way of dealing with the SAMPGDK incompatibility. Internal calls to amx_FindPublic
are instead handled as calls to funcidx
and use whatever index it reports. Even with SAMPGDK, funcidx
correctly returns -1 for undefined callbacks and therefore can be safely used.
native pp_tick();
Simulates a server tick. Tasks that wait a specific number of server ticks will get advanced, and running threads will be synchronized.
native pp_num_tasks();
native pp_num_local_strings();
native pp_num_global_strings();
native pp_num_local_variants();
native pp_num_global_variants();
native pp_num_lists();
native pp_num_linked_lists();
native pp_num_maps();
native pp_num_pools();
native pp_num_guards();
native pp_num_amx_guards();
native pp_num_amx_vars();
native pp_num_local_iters();
native pp_num_global_iters();
native pp_num_local_handles();
native pp_num_global_handles();
native pp_num_local_expressions();
native pp_num_global_expressions();
native pp_num_hooked_natives();
Obtains the sizes of various pools. These functions can be used for testing memory leaks, but not for iterating the elements, since they are not accessed using an index.
native pp_max_hooked_natives();
Returns the maximum number of natives that can be hooked at once. It is 1024 by default, and can be changed only by recompilation.
native pp_entry(name[], size=sizeof(name));
native String:pp_entry_s();
Returns the name of the current entry point, as a dynamic string. An entry point is the public function that was used to enter the code that called this native function. Special values are "#main" if the entry point is the main function of the script, or "#cont" if the script was resumed from a paused state but the context was lost. If the context is not present (e.g. in a threaded block), an empty string is returned.
native pp_collect();
Clears all strings, variants, iterators, expressions, and handles in the local/temporary pools. It is not advised to call this function, since it may delete objects which are still in use, and the pools are cleared automatically anyway.
native pp_module_name(const function[], name[], size=sizeof(name));
native String:pp_module_name_s(const function[]);
Returns the name of a module where a specific native function is defined.
native pp_raise_error(const message[], error_level:level=error_logic);
Raises a PawnPlus error with the specified message and level.
native error_level:pp_error_level(error_level:level);
Sets the minimum error level that causes abortion of the script when an error occurs. This level is script-local.
native pp_locale(const locale[], locale_category:category=locale_all);
Changes the current process-wide C++ locale, importing a specific category from a locale defined by locale
, which contains a valid locale or encoding name.
The global locale affects functions like str_to_upper
(category locale_ctype
), str_replace
(locale_collate
for character ranges), or str_format
(locale_numeric
for number formatting).
native pp_locale_name(locale[], size=sizeof(locale), const encoding[]="", locale_category:category=locale_all);
native String:pp_locale_name_s(const encoding[]="", locale_category:category=locale_all);
Returns the name of a locale from its identifier, or the name of the current global locale if unspecified. category
may be specified to narrow down the locale to a particular category (on Linux systems, the system default locale may be combined from different locales).
native pp_format_env_push(Map:env);
Pushes a new environment map to be used by the expression parser in str_format
. The environment replaces the original one until pp_format_env_pop
is called. The lifetime of env
is not prolonged in any way.
native pp_format_env_pop();
Pops the environment map pushed by pp_format_env_push
.
native pp_stackspace();
Returns the estimated size of the native stack (not of AMX).
native pp_daytime(bool:utc=false);
Returns the number of milliseconds since the last midnight, in the local time (or UTC if utc
is true
). The returned value ranges from 0 to 86400999 (including a possible leap second).