GDK 4.6.3
Write SA-MP gamemodes in C/C++
|
Functions | |
cell | sampgdk::CallNative (AMX_NATIVE native, cell *params) |
C++ wrapper around sampgdk_CallNative() | |
AMX_NATIVE | sampgdk::FindNative (const char *name) |
C++ wrapper around sampgdk_FindNative() | |
const AMX_NATIVE_INFO * | sampgdk::GetNatives () |
C++ wrapper around sampgdk_GetNatives() | |
const AMX_NATIVE_INFO * | sampgdk::GetNatives (int &number) |
C++ wrapper around sampgdk_GetNatives() | |
cell | sampgdk::InvokeNative (AMX_NATIVE native, const char *format,...) |
C++ wrapper around sampgdk_InvokeNative() | |
cell | sampgdk::InvokeNativeArray (AMX_NATIVE native, const char *format, void **args) |
C++ wrapper around sampgdk_InvokeNativeArray() | |
cell | sampgdk::InvokeNativeV (AMX_NATIVE native, const char *format, va_list args) |
C++ wrapper around sampgdk_InvokeNativeV() | |
bool | OnPublicCall (AMX *amx, const char *name, cell *params, cell *retval) |
A generic catch-all callback that gets called whenever some AMX public function is executed. More... | |
bool | OnPublicCall2 (AMX *amx, const char *name, cell *params, cell *retval, bool *stop) |
A generic catch-all callback that gets called whenever some AMX public function is executed. More... | |
cell | sampgdk_CallNative (AMX_NATIVE native, cell *params) |
Calls a native function. More... | |
AMX_NATIVE | sampgdk_FindNative (const char *name) |
Finds a native function by name. More... | |
const AMX_NATIVE_INFO * | sampgdk_GetNatives (int *number) |
Returns all currently registered native functions. More... | |
cell | sampgdk_InvokeNative (AMX_NATIVE native, const char *format,...) |
Calls a native function with arguments. More... | |
cell | sampgdk_InvokeNativeArray (AMX_NATIVE native, const char *format, void **args) |
Calls a native function with an array of arguments. More... | |
cell | sampgdk_InvokeNativeV (AMX_NATIVE native, const char *format, va_list args) |
Calls a native function with arguments. More... | |
bool OnPublicCall | ( | AMX * | amx, |
const char * | name, | ||
cell * | params, | ||
cell * | retval | ||
) |
A generic catch-all callback that gets called whenever some AMX public function is executed.
This is the publics "filter" callback. It is called whenever the server calls amx_Exec()
, which practically means that you can use it to hook any callback, even those that are called by other plugins.
amx | AMX on which the function is called |
name | function name |
params | function arguments as stored on the AMX stack, with params [0] being set to the number of arguments multiplied by sizeof(cell) |
retval | where to store the return value (can be NULL ) |
true
if the public is allowed to execute bool OnPublicCall2 | ( | AMX * | amx, |
const char * | name, | ||
cell * | params, | ||
cell * | retval, | ||
bool * | stop | ||
) |
A generic catch-all callback that gets called whenever some AMX public function is executed.
This callback is similar to OnPublicCall
but also allows you to stop the call from being propagated to other plugins or the gamemode by setting the stop
parameter to true
.
amx | AMX on which the function is called |
name | function name |
params | function arguments as stored on the AMX stack, with params [0] being set to the number of arguments multiplied by sizeof(cell) |
retval | where to store the return value (can be NULL ) |
stop | whether to stop public call propagation (false by default) |
true
if the public is allowed to execute cell sampgdk_CallNative | ( | AMX_NATIVE | native, |
cell * | params | ||
) |
Calls a native function.
This function is suitable for calling simple natives that either have only value parameters or don't have any parameters at all. If you have to pass a reference or a string use sampgdk_InvokeNative() instead.
params
must contain the number of arguments multiplied by sizeof(cell)
.native | pointer to the native function |
params | parameters to be passed to the function as its second argument |
AMX_NATIVE sampgdk_FindNative | ( | const char * | name | ) |
Finds a native function by name.
Searches for a native function with the specified name and returns its address. In order to be found the function must be registered with amx_Register() prior to the call.
name | name of the native function |
NULL
if not foundconst AMX_NATIVE_INFO * sampgdk_GetNatives | ( | int * | number | ) |
Returns all currently registered native functions.
This function can be used to get the names and addresses of all native functions that have been registered with amx_Register(), by both the server and plugins.
number | where to store the number of natives (optional). |
cell sampgdk_InvokeNative | ( | AMX_NATIVE | native, |
const char * | format, | ||
... | |||
) |
Calls a native function with arguments.
Argument types are specified via format
where each character, or specifier, corresponds to a single argument. The following format specifiers are supported:
Specifier | C/C++ type | Description |
---|---|---|
i | int | integer value |
d | int | integer value (same as 'i') |
b | bool | boolean value |
f | double | floating-point value |
r | const cell * | const reference (input only) |
R | cell * | non-const reference (both input and output) |
s | const char * | const string (input only) |
S | char * | non-const string (both input and output) |
a | const cell * | const array (input only) |
A | cell * | non-const array (both input and output) |
native | pointer to the native function. |
format | argument types |
... | arguments themselves |
cell sampgdk_InvokeNativeArray | ( | AMX_NATIVE | native, |
const char * | format, | ||
void ** | args | ||
) |
Calls a native function with an array of arguments.
This function is similar to sampgdk_InvokeNative() but the arguments are passed as an array where each element is a pointer pointing to the actual value.
Argument types are specified via format
where each character, or specifier, corresponds to a single argument. See sampgdk_InvokeNative() for the list of supported format specifiers.
native | pointer to the native function. |
format | argument types |
args | arguments themselves |
cell sampgdk_InvokeNativeV | ( | AMX_NATIVE | native, |
const char * | format, | ||
va_list | args | ||
) |
Calls a native function with arguments.
This function is identical to sampgdk_InvokeNative() except it takes va_list
instead of variable arguments.