Functions

cellarray.inc

amxmodx 1.8.2 hg65

Function Type Description
ArrayClear native Clears all entries from the array.
ArrayCreate native Creates a handle to a dynamically sized array.
It is very important that the cellsize you provide matches up with the buffer sizes
that you pass with subsequent Array{Get,Set,Push} calls.
ArrayDeleteItem native Deletes an item from the array. All items beyond it get shifted down 1 space.
ArrayDestroy native Destroys the array, and resets the handle to 0 to prevent accidental usage after it is destroyed.
ArrayGetArray native Returns data within an array.
Make sure the output buffer matches the size the array was created with!
ArrayGetCell native Returns a single cell of data from an array.
Use this only with arrays that were created with a cellsize of 1!
ArrayGetString native Returns a string value from an array.
ArrayGetStringHandle native Creates a handle that is passable to a format compliant routine for printing as a string (with the %a format option).
It is suggested to pass the function directly as a parameter to the format routine.
The array contents must be a null-terminated string!

An example usage: client_print(id, print_chat, "%a", ArrayGetStringHandle(MessageArray, i));
ArrayInsertArrayAfter native Inserts an item after the selected item. All items beyond it get shifted up 1 space.
The buffer size must match what the cellsize that the array was created with!
ArrayInsertArrayBefore native Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space.
The buffer size must match what the cellsize that the array was created with!
ArrayInsertCellAfter native Inserts an item after the selected item. All items beyond it get shifted up 1 space.
Use this only on an array that was created with a cellsize of 1!
ArrayInsertCellBefore native Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space.
Use this only on an array that was created with a cellsize of 1!
ArrayInsertStringAfter native Inserts an item after the selected item. All items beyond it get shifted up 1 space.
The stored string will be truncated if it is longer than the cellsize the array was created with!
ArrayInsertStringBefore native Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space.
The stored string will be truncated if it is longer than the cellsize the array was created with!
ArrayPushArray native Creates a new item at the end of the array and sets its data with that of a local buffer.
The buffer size must match what the cellsize that the array was created with!
ArrayPushCell native Creates a new item and sets the array's single cell value.
Use this only on array that were created with a cellsize of 1!
ArrayPushString native Creates a new element in the array and sets its value to the input buffer.
The stored string will be truncated if it is longer than the cellsize the array was created with!
ArraySetArray native Sets an item's data with that of a local buffer.
The buffer size must match what the cellsize that the array was created with!
The item must already exist, use ArrayPushArray to create a new item within the array.
ArraySetCell native Sets an array's single cell value. Use this only on array that were created with a cellsize of 1!
The item must already exist, use ArrayPushCell to create a new item within the array.
ArraySetString native Sets a string value from an array.
The stored string will be truncated if it is longer than the cellsize the array was created with!
The item must already exist, use ArrayPushString to create a new item within the array.
ArraySize native Returns the number of elements in the array.
ArraySort native Similar to sorting.inc's CustomSort.
The sorting algorithm then uses your comparison function to sort the data.
The function is called in the following manner:

public MySortFunc(Array:array, item1, item2, const data[], data_size)

array - Array handle in its current un-sorted state.
item1, item2 - Current item pair being compared
data[] - Extra data array you passed to the sort func.
data_size - Size of extra data you passed to the sort func.

Your function should return:
-1 if item1 should go before item2
0 if item1 and item2 are equal
1 if item1 should go after item2
Note that the parameters after item2 are all optional and you do not need to specify them.

Note that unlike the sorting.inc versions, the array passed to the callback is not in mid-sorted state.
ArraySwap native Swaps the position of two items.