\addons\sourcemod\scripting\testsuite\sorttest.sp
Код
public OnPluginStart()
{
new Handle:array = CreateArray();
PushArrayCell(array, 6);
PushArrayCell(array, 7);
PushArrayCell(array, 3);
PushArrayCell(array, 2);
PushArrayCell(array, 8);
PushArrayCell(array, 5);
PushArrayCell(array, 0);
PushArrayCell(array, 1);
PushArrayCell(array, 4);
PushArrayCell(array, 9);
PrintToServer("Testing ascending sort:")
SortADTArray(array, Sort_Ascending, Sort_Integer)
PrintADTArrayIntegers(array)
PrintToServer("Testing descending sort:")
SortADTArray(array, Sort_Descending, Sort_Integer)
PrintADTArrayIntegers(array)
PrintToServer("Testing random sort:")
SortADTArray(array, Sort_Random, Sort_Integer)
PrintADTArrayIntegers(array)
}
stock PrintADTArrayIntegers(Handle:array)
{
new size = GetArraySize(array);
for (new i=0; i<size;i++)
{
PrintToServer("array[%d] = %d", i, GetArrayCell(array, i));
}
}