diff options
| author | navewindre <nw@moneybot.cc> | 2023-12-04 18:06:10 +0100 |
|---|---|---|
| committer | navewindre <nw@moneybot.cc> | 2023-12-04 18:06:10 +0100 |
| commit | aef0d1c1268ab7d4bc18996c9c6b4da16a40aadc (patch) | |
| tree | 43e766b51704f4ab8b383583bdc1871eeeb9c698 /sourcemod/scripting/include/gamechaos/arrays.inc | |
| parent | 38f1140c11724da05a23a10385061200b907cf6e (diff) | |
bbbbbbbbwaaaaaaaaaaa
Diffstat (limited to 'sourcemod/scripting/include/gamechaos/arrays.inc')
| -rw-r--r-- | sourcemod/scripting/include/gamechaos/arrays.inc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sourcemod/scripting/include/gamechaos/arrays.inc b/sourcemod/scripting/include/gamechaos/arrays.inc new file mode 100644 index 0000000..eba62bb --- /dev/null +++ b/sourcemod/scripting/include/gamechaos/arrays.inc @@ -0,0 +1,52 @@ + +#if defined _gamechaos_stocks_arrays_included + #endinput +#endif +#define _gamechaos_stocks_arrays_included + +#define GC_ARRAYS_VERSION 0x01_00_00 +#define GC_ARRAYS_VERSION_STRING "1.0.0" + +/** + * Copies an array into an arraylist. + * + * @param array Arraylist Handle. + * @param index Index in the arraylist. + * @param values Array to copy. + * @param size Size of the array to copy. + * @param offset Arraylist offset to set. + * @return Number of cells copied. + * @error Invalid Handle or invalid index. + */ +stock int GCSetArrayArrayIndexOffset(ArrayList array, int index, const any[] values, int size, int offset) +{ + int cells; + for (int i; i < size; i++) + { + array.Set(index, values[i], offset + i); + cells++; + } + return cells; +} + +/** + * Copies an arraylist's specified cells to an array. + * + * @param array Arraylist Handle. + * @param index Index in the arraylist. + * @param result Array to copy to. + * @param size Size of the array to copy to. + * @param offset Arraylist offset. + * @return Number of cells copied. + * @error Invalid Handle or invalid index. + */ +stock int GCCopyArrayArrayIndex(const ArrayList array, int index, any[] result, int size, int offset) +{ + int cells; + for (int i = offset; i < (size + offset); i++) + { + result[i] = array.Get(index, i); + cells++; + } + return cells; +}
\ No newline at end of file |
