SA-MP Forums Archive
5 numbers in a row - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 5 numbers in a row (/showthread.php?tid=572336)



5 numbers in a row - Banditukas - 27.04.2015

Hi,


How to find and check if there is highest 5 numbers in row if i have that:

Код:
60
100
5
19
50
66
52
58
42
30
69
40
36
49
48
13
47
46
45
And how you see there is 45 46 47 48 49 50 in row and highest. But how to script that, because numbers will be random.


Re: 5 numbers in a row - Konstantinos - 27.04.2015

http://forum.sa-mp.com/showpost.php?...postcount=1737


Re: 5 numbers in a row - Banditukas - 27.04.2015

But i need from highest to lowest.


Re: 5 numbers in a row - BroZeus - 27.04.2015

Quote:
Originally Posted by Banditukas
Посмотреть сообщение
But i need from highest to lowest.
Use the sort function given in the link above and loop backwards to achieve that.
like this :
PHP код:
new
    array[] = { -
54154689123035566, -5415468484, -56415541656 }
;
quickSort(array, 0sizeof(array) - 1);//Fuction code in above link
    
for(new = (sizeof(array)-1); >= 0i--)//loop backwards
{
    
printf("%d", array[i]);

Output:
Quote:
5468484
1656
1554
689

...and so on