Ir para conteúdo
Entre para seguir isso  
god_dreamer

Top 25 Fraggers

Recommended Posts

god_dreamer    1
god_dreamer

Seguinte pessoal, uma coisa bem interessante, é um script que conta qtos players voce matou. e o rank aparece no site.

 

e tipo, eu tenhu a parte em PHP, e a tabela que inseri no banco de dados Mysql, so ta faltando o script que conta e executa isso no banco.

 

Creio que seria um Creaturescript que faz +/- isso que vou postar aqui, claro que ta tudo errado é só pra terem uma noção sei la OAskoaskkao:

 

Script meia boca :

 

function onKill(cid, target, lasthit)
   if(isPlayer(target) == TRUE) then
       local lashit = getCreatureName(cid)
           local killedPlayers = getPlayerStorageValue(cid, 23112)
           if(killedPlayers == -1) then
               killedPlayers = 1
           end
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você matou " .. killedPlayers .."Players.")
           setPlayerStorageValue(cid, lashit, killedPlayers + 1)
db.executeQuery("INSERT INTO players (`frags_all`) VALUES\n('".. killedPlayers.."');")

       end
   end
   return TRUE
end

OBS: Nao faço a menor ideia se este script funciona, Por favor HELP!!

 

Ta ai a Screen Shot:

 

frags.jpg

 

conforme vai matando mto player as cavera red skull vai aumentando...

 

quero ajudar nao só a mim, mas creio que este sistema seja UTIL para muita gente que sempre quis algo assim, vou disponibilizar abaixo o MYSQL e o PHP...

 

MYSQL:

ALTER TABLE `players` ADD `frags_all` INT( 11 ) NOT NULL;                      

frags.php

 

   <?php 
function coloured_value($valuein) 
{ 
   $value2 = $valuein; 
   while(strlen($value2) > 3) 
   { 
       $value .= ' '.substr($value2, -3, 3); 
       $value2 = substr($value2, 0, strlen($value2)-3); 
   } 
   $value = $value2.$value; 
   if($valuein > 0) 
       return ''.$value.''; 
   elseif($valuein < 0) 
       return '<font color="red">-'.$value.'</font>'; 
   else 
       return ''.$value.''; 
} 

function placeImages($count){ 
   if($count > 300) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/blackskull.gif'><img src='images/blackskull.gif'><img src='images/blackskull.gif'>"; 
   if($count > 260) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/blackskull.gif'><img src='images/blackskull.gif'>"; 
   if($count > 230) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskullhalf.gif'>"; 
   if($count > 190) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'>"; 
   if($count > 150) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskullhalf.gif'>"; 
   if($count > 120) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskull.gif'>"; 
   if($count > 90) return "<img src='images/redskull.gif'><img src='images/redskull.gif'><img src='images/redskullhalf.gif'>"; 
   if($count > 70) return "<img src='images/redskull.gif'><img src='images/redskull.gif'>"; 
   if($count > 50) return "<img src='images/redskull.gif'><img src='images/redskullhalf.gif'>"; 
   if($count > 30) return "<img src='images/redskull.gif'>"; 
   if($count > 10) return "<img src='images/redskullhalf.gif'>"; 
} 

function showTopExp() 
{ 
   global $SQL; 
   global $config,$connect; 
   $world = $_GET['world']; 
   if ($world > 0 && is_numeric($world)){ 
       $world = " WHERE `world_id` = ".(int)($world-1).""; 
   } 
   $return .= "<br><h2><center><font color='red'>Top 25 Fragers on ".$config['server']['serverName']."</font></center></h2><br> 
       <table border=0 cellspacing=1 cellpadding=4 width=100%> 
   <tr bgcolor=\"".$config['site']['vdarkborder']."\"> 
   <td class=white><font><b>Lp.</b></font></td> 
   <td class=white width=\"40%\"><font><b>Name</b></font></td> 
   <td class=white><font><b>Online</b></font></td> 
   <td class=white width=\"20%\"><font><b>World</b></font></td> 
   <td class=white width=\"40%\"><font><b>Count</b></font></td></tr>"; 
   $groupMembers = $SQL->query('SELECT `name`,`frags_all`,`level`,`world_id`,`online`,`account_id` FROM `players`'.$world.' ORDER BY `frags_all` DESC LIMIT 25'); 

   $membersCount = 0; 
   $memberss = 0; 

   foreach($groupMembers as $member) 
   { 
       $membersCount++; 
       if(is_int($membersCount / 2)) 
           $bgcolor = $config['site']['darkborder']; 
       else 
           $bgcolor = $config['site']['lightborder']; 

       $count = $member['experience']-$member['exphist_lastexp']; 



       $return .= "<tr bgcolor=\"".$bgcolor."\"><td>".$membersCount.".</td> 
       <td><a href=\"index.php?subtopic=characters&name=".$member['name']."\">".$member['name']." [".$member['level']."]</a></td> 
       <td><center>".$on."</center></td> 
               <td>".$config['server']['serverName']."</td> 
       <td>".$member['frags_all']." different people<br/>".placeImages($member['frags_all'])."</td> 
       </tr>"; 
       $memberss++; 
   } 
   if ($membersCount = 0) $return .= "<tr bgcolor=\"".$config['site']['darkborder']."\"> 
   <td colspan=\"2\">No statistics available.</td> 
   </tr>"; 
   $return .= "</table>"; 
    if($memberss > 0){ 
    $memberss = 0; 
   return $return; 
   }else 
   { 
       return false; 
       } 
} 

$main_content .= showTopExp(); 
?>    

Preciso com Urgencia...

Editado por god_dreamer

Compartilhar este post


Link para o post
Compartilhar em outros sites
Tozim    0
Tozim

Seção errada.

Aqui é seção de ideias, não de ajuda.

Compartilhar este post


Link para o post
Compartilhar em outros sites
Mock    32
Mock

Seção erradassa amigo.

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×