Add native arraycompare.

This commit is contained in:
ArKaNeMaN 2021-07-27 16:54:26 +03:00
parent 6b9d82fa60
commit a0d6570d31
2 changed files with 26 additions and 0 deletions

View File

@ -4453,6 +4453,20 @@ static cell AMX_NATIVE_CALL arrayset(AMX *amx, cell *params)
return 1;
}
// native bool:arraycompare(const any:what[], const any:with[], const size);
static cell AMX_NATIVE_CALL arraycompare(AMX *amx, cell *params)
{
cell *what = get_amxaddr(amx, params[1]);
cell *with = get_amxaddr(amx, params[2]);
int size = params[3];
while (size--)
if (*with++ != *what++)
return 0;
return 1;
}
static cell AMX_NATIVE_CALL CreateLangKey(AMX *amx, cell *params)
{
int len;
@ -4682,6 +4696,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"admins_push", admins_push},
{"amxclient_cmd", amxclient_cmd},
{"arrayset", arrayset},
{"arraycompare", arraycompare},
{"get_addr_val", get_addr_val},
{"get_var_addr", get_var_addr},
{"set_addr_val", set_addr_val},

View File

@ -3309,6 +3309,17 @@ native DestroyForward(forward_handle);
*/
native arrayset(any:array[], any:value, size);
/**
* Compares two arrays.
*
* @param what First array
* @param with Second array
* @param size Size of array
*
* @return Returns true if arrays are equaly, false otherwise.
*/
native bool:arraycompare(const any:what[], const any:with[], const size);
/**
* Returns the weapon id associated with a weapon name.
*