• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Html] Crear top frags gesior

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Html] Crear top frags gesior Empty [Html] Crear top frags gesior Miér Sep 29, 2021 5:43 pm

    Morfar

    Morfar
    Miembro
    Miembro
    Descripcion escribió:Amigos como estan buenas tardes, nuevamente molestando requeriendo de su apoyo para proporcionar algo en mi web, bueno lo que pasa que agregue una top fraggers box en mi web y logre colocarla y funciona, pero ese codigo de frags no es acumulativo ya que te los borra si pierdes tus frags en el juego, bueno el punto esque utilize este siguiente php
    Código:
    <?PHP
    $list = $_REQUEST['list'];
    $page = $_REQUEST['page'];
     
    switch($list)
    {
    case "fist":
    $id = 0;
    $list_name = 'Fist Fighting';
    break;
    case "club":
    $id = 1;
    $list_name = 'Club Fighting';
    break;
    case "sword":
    $id = 2;
    $list_name = 'Sword Fighting';
    break;
    case "axe":
    $id = 3;
    $list_name = 'Axe Fighting';
    break;
    case "distance":
    $id = 4;
    $list_name = 'Distance Fighting';
    break;
    case "shield":
    $id = 5;
    $list_name = 'Shielding';
    break;
    case "fishing":
    $id = 6;
    $list_name = 'Fishing';
    break;
    }
    if(count($config['site']['worlds']) > 1)
    {
    foreach($config['site']['worlds'] as $idd => $world_n)
    {
    if($idd == (int) $_GET['world'])
    {
    $world_id = $idd;
    $world_name = $world_n;
    }
    }
    }
    if(!isset($world_id))
    {
    $world_id = 0;
    $world_name = $config['server']['serverName'];
    }
    $offset = $page * 100;
    if(isset($id))
    $skills = $SQL->query('SELECT * FROM players, player_skills WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND players.id = player_skills.player_id AND player_skills.skillid = '.$id.' AND players.account_id != 1 ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset);
    else
    {
    if($list == "magic")
    {
    $list_name = 'Magic Level';
    $skills = $SQL->query('SELECT * FROM players WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND account_id != 1 ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset);
    }
    elseif($list == "frags")
    {
    $list_name = 'Fraggers';
    $skills = $SQL->query('SELECT * FROM players WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND account_id != 1 ORDER BY frags DESC LIMIT 10 OFFSET '.$offset);
    }
    else
    {
    $skills = $SQL->query('SELECT * FROM players WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND account_id != 1 ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset);
    $list_name = 'Experience';
    $list = 'experience';
    }
    }
    $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD><CENTER><H2>Top '.$list_name.' on '.$world_name.'</H2></CENTER><BR>';
    if(count($config['site']['worlds']) > 1)
    {
    $main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD>
    <FORM ACTION="index.php?subtopic=highscores&list='.$list.'" METHOD=get><INPUT TYPE=hidden NAME=subtopic VALUE=highscores><INPUT TYPE=hidden NAME=list VALUE=experience>
    <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>World Selection</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'">
    <TABLE BORDER=0 CELLPADDING=1><TR><TD>World: </TD><TD><SELECT SIZE="1" NAME="world"><OPTION VALUE="" SELECTED>(choose world)</OPTION>';
    foreach($config['site']['worlds'] as $id => $world_n)
    {
    $main_content .= '<OPTION VALUE="'.$id.'">'.$world_n.'</OPTION>';
    }
    $main_content .= '</SELECT> </TD><TD><INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
    </TD></TR></TABLE></TABLE></FORM></TABLE><br>';
    }
    $main_content .= '<TABLE class="caja" BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=10% CLASS=whites><B>Rank</B></TD><TD WIDTH=30% CLASS=whites><B>Name</B></TD><TD WIDTH=15% CLASS=whites><b><center>Outfit</center></B></TD><TD WIDTH=15% CLASS=whites><b><center>Country</center></B></TD><TD WIDTH=15% CLASS=whites><b><center>Frags</center></B></TD>';
    if($list == "experience")
    {
    $main_content .= '<TD CLASS=whites><b><center>Points</center></B></TD>';
    }
    $main_content .= '</TR><TR><center>';
    foreach($skills as $skill)
    {
    if($number_of_rows < 100)
    {
    if($list == "magic")
    $skill['value'] = $skill['maglevel'];
    if($list == "frags")
    $skill['value'] = $skill['frags'];
    if($list == "experience")
    $skill['value'] = $skill['level'];
    if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
    $main_content .= '<tr bgcolor="'.$bgcolor.'">
    <td>'.($offset + $number_of_rows).'.</td>
    <td>'.$flag.'<a href="index.php?subtopic=characters&name='.urlencode($skill['name']).'">'.$skill['name'].'</a><td style="text-align: center;"><center><div style="position: relative; width: 32px; height: 32px;"><div class="zoom" style="background-image: url(\'outfitter.php?id='.$skill['looktype'].'&addons='.$skill['lookaddons'].'&head='.$skill['lookhead'].'&body='.$skill['lookbody'].'&legs='.$skill['looklegs'].'&feet='.$skill['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"><TD WIDTH=5% align="middle"><image src="images/flags/'.$acc['flag'].'.png"/></TD></div>';
    #if(count($config['site']['worlds']) > 1)
    # $main_content .= ', '.$config['site']['worlds'][$skill['world_id']];
    $main_content .= '</small>';
    $main_content .= '</td><td><center>'.$skill['value'].'</center></td>';
    if($list == "experience")
    $main_content .= '<td>'.number_format($skill['experience'],0).'</td>';
    $main_content .= '</tr>';
    }
    else
    $show_link_to_next_page = TRUE;
    }
    if (!$skill){
    $main_content .='
    <tr bgcolor="'.$config['site']['darkborder'].'">
    <td colspan="4" align="center"><i>'.$config['server']['serverName'].' no have players created on database.</i></td>
    </tr>
    ';}
    $main_content .= '</TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>';
    if($page > 0)
    $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="index.php?subtopic=highscores&list='.$list.'&world='.$world_id.'&page='.($page - 1).'" CLASS="size_xxs">Previous Page</A></TD></TR>';
    if($show_link_to_next_page)
    $main_content .= '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="index.php?subtopic=highscores&list='.$list.'&world='.$world_id.'&page='.($page + 1).'" CLASS="size_xxs">Next Page</A></TD></TR>';
    $main_content .= '</TABLE></TD><TD WIDTH=5%><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=1 HEIGHT=1 BORDER=0></TD>
    </TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';
    ?>
    Y con este si me funciona perfectamente el acumulado lo que me gustaria es transformar este codigo a una top fraggers box, pero no se muy bien como realizar las consultas necesarias para aparecerla en mi layout... espero puedan apoyarme! es gesior viejo 0.3.8 no es la de 2012 ya que en esa si hay un php que hace eso pero no es compatible con la mia xD gracias!! pd tambien anexo el top fraggers box que si me funciono pero se borran
    Código:
    <div id="Topbar" class="Toplevelbox" style="background-image:url(/images/top_level.png);">
       <div class="top_level" style="background:url(/images/bg_top.png)" align="left">
          <?php
          $zap = $SQL->query('SELECT `name`,`level` FROM `players` WHERE `group_id` < '.$config['site']['players_group_id_block'].' AND `name` != "Account Manager" ORDER BY `level` DESC, `experience` DESC LIMIT 5;');
          $frags_database = $SQL->query('SELECT `p`.`name` AS `name`, COUNT(`p`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0,30;');
          $number_of_rows1 = 0;
          foreach($frags_database as $frag)
          {
             $number_of_rows1++;
             echo '<div align="left"> <a href="index.php?subtopic=characters&name='.urlencode($frag['name']).'" class="topfont"> <b>
             <font color="black">&nbsp;&nbsp;&nbsp;&nbsp; '.$number_of_rows1.' - </font></b>'.htmlspecialchars($frag['name']).' <br/><small><b>
             <font color="white">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frags: '.$frag['frags'].' </font></b></small><br/></a></div>';
          }
          ?>
       </div>
       <div class="Bottom" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/box-bottom.gif);"></div>
    </div>  
    Captura del Error escribió:Imagen del error: [Html] Crear top frags gesior Empty
    El error radica en: WEB

    2 participantes

    2[Html] Crear top frags gesior Empty Re: [Html] Crear top frags gesior Jue Sep 30, 2021 8:50 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    intenteesto

    Código:

    <div id="Topbar" class="Toplevelbox" style="background-image:url(/images/top_level.png);">
      <div class="top_level" style="background:url(/images/bg_top.png)" align="left">
          <?php
          $zap = $SQL->query('SELECT `name`,`level` FROM `players` WHERE `group_id` < '.$config['site']['players_group_id_block'].' AND `name` != "Account Manager" ORDER BY `level` DESC, `experience` DESC LIMIT 5;');
          $frags_database = $SQL->query('SELECT name, frags_all, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons FROM players WHERE group_id = 1 AND account_id != 1 ORDER BY frags_all DESC LIMIT 5');
          $number_of_rows1 = 0;
          foreach($frags_database as $frag)
          {
            $number_of_rows1++;
            echo '<div align="left"> <a href="index.php?subtopic=characters&name='.urlencode($frag['name']).'" class="topfont"> <b>
            <font color="black">&nbsp;&nbsp;&nbsp;&nbsp; '.$number_of_rows1.' - </font></b>'.htmlspecialchars($frag['name']).' <br/><small><b>
            <font color="white">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frags: '.$frag['frags_all'].' </font></b></small><br/></a></div>';
          }
          ?>
      </div>
      <div class="Bottom" style="background-image:url(<?PHP echo $layout_name; ?>/images/general/box-bottom.gif);"></div>
    </div> 

    ejecutar en el phpadmin en su base de datos:

    Código:
    ALTER TABLE players ADD frags_all smallint(5) unsigned default 0 ;

    ahora agregamos a creatuscripts/scripts y creamos topfrags.lua:

    Código:
    local skulls = {SKULL_WHITE, SKULL_YELLOW, SKULL_RED, SKULL_BLACK}

    function addPlayerFrag(cid, value)
     db.executeQuery("UPDATE `players` SET `frags_all` = `frags_all` + " .. value .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
     return true
    end

    function onKill(cid, target)
        if isPlayer(cid) and isPlayer(target) then
         for i= 1, #skulls do
         if getPlayerSkullType(target) == skulls[i]  then
         addPlayerFrag(cid, 1)
         break
         end
         end
        end
        return true
    end

    function onLogin(cid)
     registerCreatureEvent(cid, "TopFrags")
     return true
    end

    creatuscripts.XML adicione:

    Código:
    <event type="kill" name="TopFrags" event="script" value="topfrags.lua" />
    <event type="login" name="RTopFrags" event="script" value="topfrags.lua" />

    registrar en login.lua

    Código:

    registerCreatureEvent(cid, "TopFrags")
    registerCreatureEvent(cid, "RTopFrags")





    [Html] Crear top frags gesior YNU5B25
    2 participantes
    http://www.tibiaface.com

    3[Html] Crear top frags gesior Empty Re: [Html] Crear top frags gesior Jue Sep 30, 2021 3:53 pm

    Morfar

    Morfar
    Miembro
    Miembro
    Listo bro! solo cambie la consulta de frags_all al del php primero y ahora si ya estan cotejados como queria gracias!!!

    2 participantes

    4[Html] Crear top frags gesior Empty Re: [Html] Crear top frags gesior Vie Oct 01, 2021 7:36 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Tema Resuelto



    [Html] Crear top frags gesior YNU5B25
    2 participantes
    http://www.tibiaface.com

    Contenido patrocinado


    2 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).