[DUV] GetPlayerScore [RESOLVIDO] por DraKoN
#5

Buenas Vizinhosinho de Rua, Faz Assim Burro

Final do GM


pawn Код:
stock fill ( array[][] )
{
  new x_count;
  for ( new g = 0; g < MAX_PLAYERS; g++ )
    if ( IsPlayerConnected ( g ) )
    {
      x_count++;
      array[g][1] = g;
      array[g][0] = GetPlayerScore ( g );
    }
  return x_count;
}
Depois
pawn Код:
stock process ( array[][] , size = sizeof ( array ) )
{
  if ( size > 1 )
  {
    new
      bool:flag,
      tmpx;
    do
    {
      flag = true;
      for ( new i = size - 1; i > 0; i-- )
        if ( array[i][0] < array[i - 1][0] )
        {
          tmpx = array[i][0];
          array[i][0] = array[i - 1][0];
          array[i - 1][0] = tmpx;
          tmpx = array[i][1];
          array[i][1] = array[i - 1][1];
          array[i - 1][1] = tmpx;
          flag = false;
        }
    }
    while flag == false;
  }
}
logo Abaixo

pawn Код:
stock TopRankDraKoN ( array[][] , max , count = 10 )
{
new
str[64],
pln[24];
for ( new i = 0; i < ( ( max < count) ? max : count ); i++ )
{
  GetPlayerName ( array[i][1] , pln , sizeof ( pln ) );
  format( str , sizeof ( str ) , "%d.%s: %d" , i + 1 , pln , array[i][0] );
  SendClientMessageToAll ( 0x33FF33AA , str );
}
return true;
}
isso acima й tudo um embaixo do outro xD

Agora em OnPlayerCommandText
pawn Код:
if(strcmp(cmd, "/rank", true) == 0)
{
new
ar[MAX_PLAYERS][2],
tmpsize;
tmpsize = fill ( ar );
process( ar , tmpsize );
RankDraKoN ( ar , tmpsize );
return 1;
}
[b]Espero Ter Ajudado Bjuuss

Nгo Testei
[FS]Rank System DKN
http://forum.sa-mp.com/index.php?topic=170001.0
Reply


Messages In This Thread
[DUV] GetPlayerScore [RESOLVIDO] por DraKoN - by BurrodaZero - 28.04.2010, 02:40
Re: [DUV] GetPlayerScore - by Guilherme_Canani - 28.04.2010, 02:44
Re: [DUV] GetPlayerScore - by BurrodaZero - 28.04.2010, 03:56
Re: [DUV] GetPlayerScore - by russo666 - 28.04.2010, 05:03
Re: [DUV] GetPlayerScore - by ipsBruno - 28.04.2010, 05:49
Re: [DUV] GetPlayerScore - by russo666 - 28.04.2010, 14:21
Re: [DUV] GetPlayerScore [RESOLVIDO] por DraKoN - by BurrodaZero - 29.04.2010, 03:15
Re: [DUV] GetPlayerScore - by BurrodaZero - 29.04.2010, 03:17
Re: [DUV] GetPlayerScore - by russo666 - 29.04.2010, 03:22

Forum Jump:


Users browsing this thread: 1 Guest(s)