[Tool/Web/Other] (PHP) Simple ranking INI [engine] - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Tools and Files (
https://sampforum.blast.hk/forumdisplay.php?fid=82)
+---- Thread: [Tool/Web/Other] (PHP) Simple ranking INI [engine] (
/showthread.php?tid=359100)
(PHP) Simple ranking INI [engine] -
ipsBruno - 12.07.2012
I did a year ago. And I dont post in area
What this:
This is a PHP code, used to make ranking via INI files
(
useful for those who do not have mysql server)
Code:
PHP код:
/*
* Copyright © 2012 [iPs]TeaM
* Bruno da Silva (brunoemail@r7.com)
* Get INI Files and make ranking by tag. (KILLS)
*/
<?php
// ====== [ change here ] ======================================
$pasta = "C:/Arquivos de Programas/Pawn/scriptfiles/Contas Jogadores";
$classificar = "Kills"; // key to ranking "Kills=VALUE" file
$jogadores= -1;
$dadosjogador = array();
$handlepasta = opendir($pasta);
// list file
while(($nickname = readdir($handlepasta)) !== false) {
if(($nickname !=".") && ($nickname !="..") && ($nickname != "index.htm") && ($nickname !="info")) { // filter files.
$jogadores++;
$contaaberta = parse_ini_file($pasta ."/". $nickname);
$nickname = substr($nickname, 0,strlen($nickname)-4);
$dadosjogador[$jogadores] = array($contaaberta[$classificar] ,$nickname );
}
}
// ranking
array_multisort ($dadosjogador, $dadosjogador);
// print data
foreach ($dadosjogador as $jogador_atual) {
echo "<b>Player</b>: ".$jogador_atual[1]." | <b>Kills</b>: ".$jogador_atual[0]." <br>";
}
?>
Example:
Player: Bruno1 | Kills: 4
Player: Player | Kills: 2
Player: SAMP | Kills: 1
Pastebin (PT):
http://pastebin.com/3rak6b2Y
You can improve the code .. This is only a sketch - proof conception (?)
Original Post:
https://sampforum.blast.hk/showthread.php?tid=352910