[Include] Sort multi-dimensional arrays (enums supported) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Sort multi-dimensional arrays (enums supported) (
/showthread.php?tid=343172)
Re: Sort multi-dimensional arrays (enums supported) -
Slice - 28.08.2015
What do you mean? Sounds like you want to filter data, not sort it.
Either way, 2d arrays with enums are sortable in any way you want. You can create custom logic for sorting. See the examples on the main post.
Re: Sort multi-dimensional arrays (enums supported) -
hab4ever - 28.08.2015
Quote:
Originally Posted by Slice
What do you mean? Sounds like you want to filter data, not sort it.
Either way, 2d arrays with enums are sortable in any way you want. You can create custom logic for sorting. See the examples on the main post.
|
I drew a quick diagram in paint to explain myself a bit better, diagram 2 is what my array looks like when i sort it now, and i want my array to look like diagram 1.
http://postimg.org/image/clnzj7rcf/
Re: Sort multi-dimensional arrays (enums supported) -
Slice - 28.08.2015
Yeah, just use the custom comparator function.
http://forum.sa-mp.com/showpost.php?...3&postcount=29
Re: Sort multi-dimensional arrays (enums supported) -
JR_Junior - 10.02.2016
How to sort a simple array... SCORE[MAX_PLAYERS]
Re: Sort multi-dimensional arrays (enums supported) -
JR_Junior - 10.02.2016
Quote:
Originally Posted by JR_Junior
How to sort a simple array... SCORE[MAX_PLAYERS] ![Huh?](images/smilies/confused.gif)
|
![Huh?](images/smilies/confused.gif)
?
Thanks!