Skip to content

Configuration natives

IS4 edited this page Dec 9, 2025 · 14 revisions

pp_version

native pp_version();

Returns a non-decreasing integer that represents the current version of the plugin.

pp_version_string

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.

pp_hook_strlen

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.

pp_hook_check_ref_args

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.

pp_max_recursion

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.

pp_toggle_exec_hook

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.

pp_public_min_index

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.

pp_use_funcidx

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.

pp_native_hook_recursive

native bool:pp_native_hook_recursive(bool:recursive);

Toggles between two possible ways of calling hooked (via pawn_add_hook or pawn_add_filter) functions:

  • The default (or when called with true) implementation uses a special stub code (called a trampoline) to execute the original function. This means the function will remain hooked, and if it so happens that the function calls itself, it will once again invoke the hook.
  • The non-recursive implementation (when called with false) does not use a trampoline; instead it temporarily uninstalls the hook for the duration of the function. This means that when the function calls itself, it will not invoke the hook.

This function affects all subsequent calls to pawn_add_hook/pawn_add_filter, but it will take effect only for newly hooked natives. Adding a new hook to an already hooked native function will not reflect any new calls pp_native_hook_recursive.

The function returns the previously set value (true initially).

pp_tick

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.

pp_num_*

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.

pp_max_hooked_natives

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.

pp_entry

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.

pp_collect

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.

pp_module_name

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.

pp_raise_error

native pp_raise_error(const message[], error_level:level=error_logic);

Raises a PawnPlus error with the specified message and level.

pp_error_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.

pp_locale

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).

pp_locale_name

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).

pp_format_env_push

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.

pp_format_env_pop

native pp_format_env_pop();

Pops the environment map pushed by pp_format_env_push.

pp_stackspace

native pp_stackspace();

Returns the estimated size of the native stack (not of AMX).

pp_daytime

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).

Clone this wiki locally