Kommunauty
Connexion
Inscription

probleme records


stryker Messages : 367

bon ba avoir un jeu c'est bien avoir des reccords qui marche encore mieux

un petit aperçu du reccord

le php :


<?php
/*
 _  \_/ |\ | /¯¯\ \  / /\    |¯¯) |_¯ \  / /¯¯\ |  |   |´¯|¯` | /¯¯\ |\ |
 ¯  /¯\ | \| \__/  \/ /--\   |¯¯\ |__  \/  \__/ |__ \_/   |   | \__/ | \|
 @copyright:
Copyright (C) 2010 por Brayan Narvaez (principe negro)
Copyright (C) 2010 por 5aMu
Copyright (C) 2008 - 2009 By lucky from Xtreme-gameZ.com.ar

@support:
Web http://www.xnovarevolution.com.ar/
Forum http://www.xnovarevolution.com.ar/foros/

Proyect based in xg proyect for xtreme gamez.
*/

function ShowRecordsPage($planetrow){

global $planetrow, $user, $lang, $reslist, $dpath, $res_id, $resource, $pricelist;

includeLang('INGAME');
$parse = $lang;

   $RecordTpl = gettemplate('records/record_body');
   $HeaderTpl = gettemplate('records/record_section_header');
   $TableRows = gettemplate('records/record_section_rows');

   $parse['rec_title'] = $lang['rec_title'];

   $bloc['section']    = $lang['rec_build'];
   $bloc['player']     = $lang['rec_playe'];
   $bloc['level']      = $lang['rec_level'];
   $parse['building']  = parsetemplate( $HeaderTpl, $bloc);

   $bloc['section']    = $lang['rec_specb'];
   $bloc['player']     = $lang['rec_playe'];
   $bloc['level']      = $lang['rec_level'];
   $parse['buildspe']  = parsetemplate( $HeaderTpl, $bloc);

   $bloc['section']    = $lang['rec_techn'];
   $bloc['player']     = $lang['rec_playe'];
   $bloc['level']      = $lang['rec_level'];
   $parse['research']  = parsetemplate( $HeaderTpl, $bloc);

   $bloc['section']    = $lang['rec_fleet'];
   $bloc['player']     = $lang['rec_playe'];
   $bloc['level']      = $lang['rec_nbre'];
   $parse['fleet']     = parsetemplate( $HeaderTpl, $bloc);

   $bloc['section']    = $lang['rec_defes'];
   $bloc['player']     = $lang['rec_playe'];
   $bloc['level']      = $lang['rec_nbre'];
   $parse['defenses']  = parsetemplate( $HeaderTpl, $bloc);
//Opciones de mostrarme en los records
   //para la tabla planetas
   //$RecConditionP       = " WHERE {{table}}users.show_my_in_records = 0";
   //$RecConditionP2       = " AND {{table}}users.show_my_in_records = 0";
  
   // para la tabla usuarios
  // $RecConditionU       = " WHERE `show_my_in_records` = 0";
  // $RecConditionU2      = " AND `show_my_in_records` = 0";

//   if ( SHOW_ADMIN_IN_RECORDS == 0 ) {
//      $RecConditionP       .= " AND `id_level` = 0";
//      $RecConditionP2       .= " AND `id_level` = 0";
//      $RecConditionU       .= " AND `authlevel` = 0";
//     $RecConditionU2        .= " AND `authlevel` = 0";
//  }

  foreach($lang['tech'] as $Element => $ElementName) {
      if ($ElementName != "") {
         if ($resource[$Element] != "") {
            if ($Element >=   1 && $Element <=  39 || $Element == 44) {
               // Edificios
               $template = "building";
               $intable = "planets";
            } elseif ($Element >=  41 && $Element <=  99 && $Element != 44) {   
               // Edificios especiales
               $template = "buildspe";
               $intable = "planets";   
            } elseif ($Element >= 101 && $Element <= 199) {   
               // Tecnos         
               $template = "research";
               $intable = "users";                        
            } elseif ($Element >= 201 && $Element <= 399) {
               // Flota                        
               $template = "fleet";
               $intable = "planets";   
            } elseif ($Element >= 401 && $Element <= 545) {
               // Defensa
               $template = "defenses";
               $intable = "planets";
            } elseif ($Element >= 401 && $Element <= 545) {
            
            if    ($template != ""){
               if    ($intable=="planets"){
                //Datos del mejor
                  $QrySelect  = "SELECT {{table}}planets.".$resource[$Element]." AS `current` ,{{table}}users.username FROM {{table}}planets ";
                  $QrySelect .= "JOIN {{table}}users ON {{table}}planets.id_owner = {{table}}users.id ";
                  $QrySelect .= "WHERE ";
                  $QrySelect .= "`". $resource[$Element]. "` = (SELECT MAX(`". $resource[$Element] ."`) FROM {{table}}planets". $RecConditionP .") ";
                  $QrySelect .= $RecConditionP2." LIMIT 1;";
                  $PlanetRow = doquery( $QrySelect, '',true);
                //tus datos

                  $Row['element']     = $ElementName;
                  $Row['winner']      = ($PlanetRow['current'] != 0) ? $PlanetRow['username'] : $lang['rec_rien'];
                  $Row['count']       = ($PlanetRow['current'] != 0) ? pretty_number( $PlanetRow['current'] ) : $lang['rec_rien'];
                  if($Element >= 101 && $Element <= 199) {
                    $query  = doquery("SELECT ".$resource[$Element]." FROM {{table}} WHERE `id` = '". $user['id'] ."';", 'users',true);
                  } else {
                  $query  = doquery("SELECT ".$resource[$Element]." FROM {{table}} WHERE `id_owner` = '". $user['id'] ."';", 'planets',true);
                  }
                  
                if($Row['count'] != "-") {
                if($Row['count'] == $query[0]) {
                $Row['tucount'] = "[".$query[0]."]";
                } else {
                $tus = $Row['count']-$query[0];
                $Row['tucount'] = "<font color=\"green\">+".$tus."</font> [".$query[0]."]";
                }
                } else { $Row['tucount'] = "-";
                }                
                  $parse[$template]  .= parsetemplate( $TableRows, $Row);               
               }else{
                  $QrySelect  = "SELECT `username`, `". $resource[$Element] ."` AS `current` FROM {{table}} ";
                  $QrySelect .= "WHERE `". $resource[$Element] ."` = (SELECT MAX(`". $resource[$Element] ."`) FROM {{table}}". $RecConditionU .")";
                  $QrySelect .= $RecConditionU2." LIMIT 1;";
                  $UserRow = doquery( $QrySelect, 'users',true);
                  $Row['element']     = $ElementName;
                  $Row['winner']      = ($UserRow['current'] != 0) ? $UserRow['username'] : $lang['rec_rien'];
                  $Row['count']       = ($UserRow['current'] != 0) ? pretty_number( $UserRow['current'] ) : $lang['rec_rien'];
                  if($Element >= 101 && $Element <= 199) {
                    $query  = doquery("SELECT ".$resource[$Element]." FROM {{table}} WHERE `id` = '". $user['id'] ."';", 'users',true);
                  } else {
                  $query  = doquery("SELECT ".$resource[$Element]." FROM {{table}} WHERE `id_owner` = '". $user['id'] ."';", 'planets',true);
                  }
                if($Row['count'] != "-") {
                if($Row['count'] == $query[0]) {
                $Row['tucount'] = "[".$query[0]."]";
                } else {
                $tus = $Row['count']-$query[0];
                $Row['tucount'] = "<font color=\"green\">+".$tus."</font> [".$query[0]."]";
                }
                } else { $Row['tucount'] = "-";
                }
                  $parse[$template] .= parsetemplate( $TableRows, $Row);               
               
               }            
                        
            }
            
         }
      }
   }

   $page = parsetemplate( $RecordTpl, $parse );
   display($page, $lang['rec_title']);

}
}
?>

et le templates

record_section-header

<tr>
   <td width="199" class="c"><font color="orange">{section}</font></td>
   <td width="203" class="c"><font color="orange">{player}</font></td>
   <td width="172" class="c"><font color="orange">{level}</font></td>
</tr>

record_section_rows

 <tr>
   <th width="199" class="c">{element}</th>
   <th width="203" class="c">{winner}</th>
   <th width="172" class="c">{count}</th>
</tr>

et record_section_body

 <div id="content">
<br />
<table width="590">
<tbody>
{building}
{buildspe}
{research}
{fleet}
{defenses}
</tbody>
</table>
</center>

j'arrive pas a trouver d'ou ça vient....

mardi 27 aout 2013

Greenz Messages : 163

Coucou ce n'est pas pour répondre à la question mais Imperium Galactica c'était pas un super jeu de type X3 ? ;p

mardi 27 aout 2013

stryker Messages : 367

c'est pas la même orthographe....

mardi 27 aout 2013

Greenz Messages : 163

Ah dommage ca m'aurait bien intéressé un xnova sur le même univers que ce jeu fantastique. Bonne continuation

mardi 27 aout 2013

stryker Messages : 367

désolé

merci

mardi 27 aout 2013

Répondre Pour répondre, tu dois d'abord t'inscrire rapidement sur Kommunauty. Rejoins-nous vite !