Need advanced help. - 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: Need advanced help. (
/showthread.php?tid=482408)
Need advanced help. -
ikey07 - 20.12.2013
Could someone point me to the right direction about this.
How to arrange variables by their values.
Like
Stat[0] = 3;
Stat[1] = 5;
Stat[2] = 1;
Stat[3] = 6;
how to arrange them by max, so result is something like this:
Stat[3] = 6;
Stat[1] = 5;
Stat[0] = 3;
Stat[2] = 1;
Right now Im trying with two loops by getting max and comparing if others is bigger, but no success.. :S
Re: Need advanced help. -
xVIP3Rx - 20.12.2013
I think you're doing the right thing.. Make a loop and check the bigger value and so on..
Can you show what you've tried..
Re: Need advanced help. -
ikey07 - 20.12.2013
pawn Код:
new highest[8];
for(new d; d < sizeof(Karters); d++)
{
for(new s; s < sizeof(KartCPs); s++)
{
if(KartCollected[d][s] == 0) { highest[d] = s; continue; }//Getting most collected items at s
}
}
for(new m; m < sizeof(highest); m++)
{
for(new n; n < sizeof(highest); n++)
{
if(highest[m] >= highest[n]) { pos[m] = n; }//Comparing
}
}