31.05.2011, 23:40
Embaixo das cores (#defines)
Comando:
Crйditos:
[iPs]Garfield
[iPs]DraKiNs
pawn Code:
#define b_swap(%0,%1) if(%0 > %1) (%0 ^= %1, %1 ^= %0, %0 ^= %1) //swap xor in bubblesort (by drakins)
BubbleSort( Array[], iSize) // bubblesort (by drakins)
{
new
iLoop = 0x00000000,
iCircuito = 0x00000000;
while(++iLoop < iSize)
{
iCircuito = 0xFFFFFFFF;
while(++iCircuito != iLoop) b_swap(Array[iLoop],Array[iCircuito]);
}
return Array;
}
Comando:
pawn Code:
if(!strcmp(cmdtext,"/ranking", true))
{
static string[60];
for(new i; i < MAX_PLAYERS; ++i)
{
BubbleSort(matou, sizeof(matou));
}
new b = -1;
for(new a; a < MAX_PLAYERS; ++a)
{
for(new o; o < MAX_PLAYERS; ++o)
{
if(matou[a] == matou[o]) ++b;
if(b == 10) break;
format(string, sizeof(string),"[INFO]: Ranking: %s - %d",matou,b);
SendClientMessage(playerid, -1, string);
}
}
return 1;
}
Crйditos:
[iPs]Garfield
[iPs]DraKiNs