News:
Plr <- { };function GetTop3( player ){ local t, ta,i,j,k=0; for(i=0;i<GetMaxPlayers();i++) { if( FindPlayer( i ) ) { Plr[ i ] <- { }; Plr[ i ].Nick <- player.Name.tostring(); Plr[ i ].Money <- FindPlayer( i ).Cash; k++; } } //Player1: 2 p2: 3 p3: 4 for(j=0;j<GetMaxPlayers();j++) { for(i=0;i<GetMaxPlayers()-1-j;i++) { if( Plr.rawin( i ) && Plr.rawin( i + 1 ) && Plr[ i ].Money < Plr[ i + 1 ].Money ) { t = Plr[ i + 1 ].Nick; ta = Plr[ i + 1 ].Money; Plr[ i + 1 ].Nick <- Plr[ i ].Nick; Plr[ i + 1 ].Money <- Plr[ i ].Money; Plr[ i ].Nick <- t; Plr[ i ].Money <- ta; } } } PrivMessage("Richest Players Online:",player ); for(i=0,j=1;i<k;i++,j++) PrivMessage( j + ". " + Plr[ i ].Nick + " - " + Plr[ i ].Money,player );}
from where do you learn all these stuff.btw nice work....
Give me Pelikan theme i beg your leg pls i will do whatever you will say my boss - Klitz
There's a better way to do so, but it's fine though.
Yea there's alot of sorting algorithms you can use. Bubble sort works fine if the amount of data to organize isn't as big. Quicksorting will be alot faster though, if the amount of data to organize is bigger.
so wheres the cookie?
Quote from: NewK on December 12, 2013, 06:09:26 pmYea there's alot of sorting algorithms you can use. Bubble sort works fine if the amount of data to organize isn't as big. Quicksorting will be alot faster though, if the amount of data to organize is bigger.Sorting players of maximum 50 isn't that big, is it? I'll Google Quicksort.