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[] = { -541, 54, 689, 12, 3, 0, 3, 55, 66, -541, 5468484, -564, 1554, 1656 }
;
quickSort(array, 0, sizeof(array) - 1);//Fuction code in above link
for(new i = (sizeof(array)-1); i >= 0; i--)//loop backwards
{
printf("%d", array[i]);
}
Output:
Quote:
5468484
1656
1554
689
...and so on
|