[Include] Sort multi-dimensional arrays (enums supported)
#61

I may have, i'll have a look, if not i'll have to wait for Slice.
Reply
#62

I noticed that if there's a folder called "md-sort" in the same place as "md-sort.inc" the compiler crashes. Could it be that?
Reply
#63

I have no folders called md-sort where the include is.
Reply
#64

What other includes do you have?

Come on, give me something more to go on here..
Reply
#65

How Can i use this for this:

Biggest gang
2nd biggest gang
3rd biggest gang


Based on Gang's turfs.
Reply
#66

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Depends how your "gangs" are stored in memory and how they are ranked. Typically, you can store them in a basic 2 dimensional array with the first cell being some reference to that gang (name, ID, etc) and the second cell being whatever you use to rank them (surface area of turf, points or whatever you use) then sort that array by the second column ascending or descending depending on your needs.
Southclaw, Thanks for the help. +1

I have 51 GangZones, and i want reward players each minute of thier gameplay of score.

3 scores for players in Biggest Gang.
2 scores for players in 2nd Biggest Gang.
1 score for players in 3rd biggest gang.
Reply
#67

What mean index?

And i get error when i use longer

new ASDASDASD[ MAX_PLAYERS ][ 10 ][ MAX_PLAYER_NAME ];
Reply
#68

@Banditukas: Index means position of an element in an array.

Example:

new array[10]={1,2,3,4,5,6,7,8,9,10}

where,

1's index is 0
2's index is 1
3's index is 2
4's index is 3
5's index is 4
6's index is 5
7's index is 6
8's index is 7
9's index is 8
10's index is 9
Reply
#69

And why i need to write a specif index?
Reply
#70

Код:
SortDeepArray(array, 0);
Why i need to write 0 if i just want to get from my array DESC ABC ?

And problem is if you use 3d dimmension array

[ ] [] [ ]
Reply
#71

Can you make for 3d, or is here for 3d?
Reply
#72

Quote:
Originally Posted by Luis-
Посмотреть сообщение
For some reason, this include crashes my compiler, any reason why?
Same here atm... I changed something and then suddenly boem, but the problem is, i don't know what i've actualy changed anymore...
Reply
#73

Hi,
can somebody explain how to sort enum's variables to hightest-lowtest ?
Reply
#74

I saw expalins but I still don't understand how sort 2d array...
I got

Код:
new Float:_HRP_spawnStats[24]										[MAX_PLAYERS];
so I need sort arrays by values in 1st dimension(24). MAX_PLAYERS doesn't metter for now.
And where will save my sorted arrays?
Reply
#75

Ok, then how I can sort it?

@EDIT:

Код:
SortDeepArray(array, 0);
?

And I have problem with crashing compiler too... I tried with Zeex's compiler and nothing
Reply
#76

I fixed it, thanks
Reply
#77

Hello, how to make a top 5 for races?
Reply
#78

Hey is there a way to sort from a range of values eg: an array with [55][3][2][5][4][2][1][7][8][9][23] i would like to sort from a value that is in range of 0 to 10 , it would become : [1][2][2][3][4][5][7][8][9][55][23].
Reply
#79

Yeah you just need a simple quicksort for that.

I made a pretty good implementation that doesn't use recursion, which makes it safe from stack overflows.

http://forum.sa-mp.com/showpost.php?...postcount=3437
Reply
#80

Quote:
Originally Posted by Slice
Посмотреть сообщение
Yeah you just need a simple quicksort for that.

I made a pretty good implementation that doesn't use recursion, which makes it safe from stack overflows.

http://forum.sa-mp.com/showpost.php?...postcount=3437
thanks for replying , is it possible to sort a two dimensional array, eg: for a top finish time array that has
[time][playerid] the time is in milliseconds so if someone (hacker) finishes with time 1 second (1000ms) it wont sort it but if someone finishes with 1001ms it will sort it.
Reply


Forum Jump:


Users browsing this thread: 11 Guest(s)