Advertisement
garfield

[PHP]: Engine para Ranking SA-MP Ver.0.5

Oct 21st, 2012
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.06 KB | None | 0 0
  1.  
  2. <?php  
  3.  
  4.     //===========[  CONFIGURAÇÕES ]
  5.  
  6.     // Coloque aqui aonde fica a pasta com as contas:
  7.     $PlayerDir   =  "./scriptfiles/";
  8.  
  9.    
  10.     // Aqui definas quantos players será exibido (TOP)
  11.     // Por default é 15 (top 15 players).
  12.     $MaxPlayers  = 15;
  13.    
  14.    
  15.    
  16.     // Classificação, coloque oque servirá para classificar.
  17.     $Ordenacao  = "Level"; // Exibe os players mais ricos do servidor.
  18.    
  19.    
  20.     // As linhas são oque vai ler e exibir, no momento suportando 2 linhas,
  21.     $Linhas     = Array("Level", "Money");
  22.    
  23.    
  24.    
  25.  
  26.    
  27.    
  28.     //=========[ MAIN ]
  29.     $Diretorio   =  opendir($PlayerDir);
  30.     $Player      = Array();
  31.    
  32.  
  33.     while(false != ($Arquivo = readdir($Diretorio))){
  34.         if(strstr($Arquivo, ".ini")){
  35.             $getLinha = parse_ini_file($PlayerDir.$Arquivo);
  36.             $Player[substr($Arquivo, 0, -4)] = $getLinha[$Ordenacao];
  37.         }
  38.     }
  39.    
  40.     arsort($Player);
  41.    
  42.  
  43.     $Players    = count($Player);
  44.     $Interador  = 0;
  45.  
  46.    
  47.     $Exibir    .= "<center><img src='Ranking.png' /> <br /><hr width='800'>";
  48.     $Exibir     .= "<head><title>Ranking</title></head>";
  49.     $Exibir    .= "<table style='font-size : 20px;width:64%;'>";
  50.     $Exibir    .= "<tr><td></td><td><b>Nome</b></td><td><b>Nível</b></td><td><b>Dinheiro</b></td></tr>";
  51.    
  52.    
  53.     while($Players != $Interador){
  54.         $Saida = ($Interador + 1);
  55.         $getLine = parse_ini_file($PlayerDir.Key($Player).".ini");
  56.         if($Interador % 2){
  57.             $Exibir .= "<tr bgcolor='#CFCFCF'><td>#".$Saida."</td><td>".Key($Player)."</td><td>".$getLine[$Linhas[0]]."</td><td>".$getLine[$Linhas[1]]."</td></tr>";
  58.         }
  59.         else{
  60.             $Exibir .= "<tr><td>#".$Saida."</td><td>".Key($Player)."</td><td>". $getLine[$Linhas[0]]."</td><td>".$getLine[$Linhas[1]]."</td></tr>";
  61.         }
  62.         next($Player);
  63.         $Interador ++;
  64.     }
  65.    
  66.    
  67.     while($MaxPlayers != $Interador){
  68.         $Saida = ($Interador + 1);
  69.         if($Interador % 2){
  70.             $Exibir .= "<tr  bgcolor='#CFCFCF'><td>#".$Saida."</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>";
  71.         }
  72.         else{
  73.             $Exibir .= "<tr><td>#".$Saida."</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>";
  74.         }      
  75.         $Interador++;
  76.     }
  77.    
  78.     $Exibir .= "</table><hr width='800'>";
  79.     echo $Exibir;
  80. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement