tarta wrote:
Большое спасибо, но применяйте его к языку, если знаю.Но что делать на SQL? Не могли бы вы привести мне пример?Yaro2709 wrote:
Вывести столбец race из SQL. И привязать к $LNG.tarta wrote:
How can I add in the statistics and overview the race of the player? to give more functions to this mod.
an example of the code to add it?
[MOD] Race/Class mod
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
-
-
Yaro2709 wrote:
tarta wrote:
Yaro2709 wrote:
tarta wrote:
How can I add in the statistics and overview the race of the player? to give more functions to this mod.
an example of the code to add it?
Я ясно понимаю, разница здесь в том, что вы используете xterium, а я - 2 ммона 1.7. -
Я бы советовал перейти на 1.8. Всё мои моды на 1.8 есть и на 1.7. Только я их не публиковал)
Я привык к xterium дизайну. Я в нем хорошо разбираюсь, даже лучше чем с бустрапом. Поэтому не хочу его менять. И да, я не делаю копию xterium-a. -
tarta wrote:
How can I add in the statistics and overview the race of the player? to give more functions to this mod.
an example of the code to add it?
Tu buscas algo así,
PHP Source Code: ShowStaticsPage.class.php
- if ($config->stat == 2) {
- $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race , a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
- INNER JOIN %%USERS%% as u ON u.id = s.id_owner
- LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
- WHERE s.universe = :universe AND s.stat_type = 1 AND u.authlevel < :authLevel
- ORDER BY ".$Order." ASC LIMIT :offset, :limit;";
- $query = $db->select($sql, array(
- ':universe' => Universe::current(),
- ':authLevel'=> $config->stat_level,
- ':offset' => $start,
- ':limit' => 100,
- ));
- } else {
- $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race, a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
- INNER JOIN %%USERS%% as u ON u.id = s.id_owner
- LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
- WHERE s.universe = :universe AND s.stat_type = 1
- ORDER BY " . $Order . " ASC LIMIT :offset, :limit;";
- $query = $db->select($sql, array(
- ':universe' => Universe::current(),
- ':offset' => $start,
- ':limit' => 100,
- ));
- }
Agregas en el $sql ambas lineas u.race
Mas abajo
Agregas
Entonces en el common.php o AbstractGamePage.class.php o GeneralFunctions.php
agregas
PHP Source Code
- function imageRace($razas)
- {
- if($razas==1)
- return '<img src="./styles/theme/gow/img/race1.jpg" class="tooltip" data-tooltip-content="Investigador">';
- if($razas==2)
- return '<img src="./styles/theme/gow/img/race2.jpg" class="tooltip" data-tooltip-content="Minero">';
- if($razas==3)
- return '<img src="./styles/theme/gow/img/race3.jpg" class="tooltip" data-tooltip-content="Guerrero">';
- if($razas==4)
- return '<img src="./styles/theme/gow/img/race4.jpg" class="tooltip" data-tooltip-content="Comerciante">';
- }
width: 35px !important;
height: 35px !important;
}
y listo tienes un resultado como el de la foto
Espero que sea esto lo que busques. saludos
FUNCIONA EN VERSION 2.0 en adelanteVERY SAD -
goto language/xx/TECH.php
add to $LNG['tech']
do that for every language
now you can use
$LNG["TECH"]["80" . $USER["race"]] in php
and
{$LNG["TECH"][$race]} in smarty, if you assinged it like that in the php class of the page you want to use it in
for a picture you can now use following code in the *.tpl files, if you assinged "race" and "raceimg" before
-
yamilrh wrote:
tarta wrote:
How can I add in the statistics and overview the race of the player? to give more functions to this mod.
an example of the code to add it?
Tu buscas algo así,
PHP Source Code: ShowStaticsPage.class.php
- if ($config->stat == 2) {
- $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race , a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
- INNER JOIN %%USERS%% as u ON u.id = s.id_owner
- LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
- WHERE s.universe = :universe AND s.stat_type = 1 AND u.authlevel < :authLevel
- ORDER BY ".$Order." ASC LIMIT :offset, :limit;";
- $query = $db->select($sql, array(
- ':universe' => Universe::current(),
- ':authLevel'=> $config->stat_level,
- ':offset' => $start,
- ':limit' => 100,
- ));
- } else {
- $sql = "SELECT DISTINCT s.*, u.id, u.username, u.authlevel, u.ally_id, u.banaday, u.urlaubs_modus, u.onlinetime, u.race, a.ally_name, a.ally_members, (a.ally_owner=u.id) as is_leader, a.ally_owner_range FROM %%STATPOINTS%% as s
- INNER JOIN %%USERS%% as u ON u.id = s.id_owner
- LEFT JOIN %%ALLIANCE%% as a ON a.id = s.id_ally
- WHERE s.universe = :universe AND s.stat_type = 1
- ORDER BY " . $Order . " ASC LIMIT :offset, :limit;";
- $query = $db->select($sql, array(
- ':universe' => Universe::current(),
- ':offset' => $start,
- ':limit' => 100,
- ));
- }
Agregas en el $sql ambas lineas u.race
Mas abajo
Agregas
Entonces en el common.php o AbstractGamePage.class.php o GeneralFunctions.php
agregas
PHP Source Code
- function imageRace($razas)
- {
- if($razas==1)
- return '<img src="./styles/theme/gow/img/race1.jpg" class="tooltip" data-tooltip-content="Investigador">';
- if($razas==2)
- return '<img src="./styles/theme/gow/img/race2.jpg" class="tooltip" data-tooltip-content="Minero">';
- if($razas==3)
- return '<img src="./styles/theme/gow/img/race3.jpg" class="tooltip" data-tooltip-content="Guerrero">';
- if($razas==4)
- return '<img src="./styles/theme/gow/img/race4.jpg" class="tooltip" data-tooltip-content="Comerciante">';
- }
width: 35px !important;
height: 35px !important;
}
y listo tienes un resultado como el de la foto
Espero que sea esto lo que busques. saludos
FUNCIONA EN VERSION 2.0 en adelante
El error lo tenia principalmente en el llamado de la imagen y el aplicarlo al stat... Te agradezco por tu ayuda.
El unico problema que persiste es que al agregar el u.race al Sql en la linea:
$stats_sql = 'SELECT DISTINCT s.*, u.race, u.id, u.username, u.lang, u.ally_id, a.ally_name FROM '.STATPOINTS.' as s
INNER JOIN '.USERS.' as u ON u.id = s.id_owner
LEFT JOIN '.ALLIANCE.' as a ON a.id = s.id_ally
WHERE s.`universe` = '.$UNI.' AND s.`stat_type` = 1 '.((Config::get('stat') == 2)?'AND u.`authlevel` < '.Config::get('stat_level').' ':'').'
ORDER BY `'. $Order .'` ASC LIMIT '. $start .',100;';
Me da un error al consultar las estadisticas por contrucciones o flotas o investigaciones y me dice:
SQL Error: Unknown column 'u.race' in 'field list'
Query Code: SELECT DISTINCT s.*, u.race, a.id, a.ally_members, a.ally_name FROM uni1_statpoints as s INNER JOIN uni1_alliance as a ON a.id = s.id_owner WHERE `universe` = 1 AND `stat_type` = 2 ORDER BY `total_rank` ASC LIMIT 0,100;
Por todo lo demas si funciona.. solo tengo ese error. que de seguro es porque no esta en la DB -
Revisa que en la tabla uni1_user tengas el campo race.VERY SAD
-
Disculpen, estuve algo ocupado y no pude responder.
Race esta en la DB uni_user pero lo raro es que me salte ese erro al añadir en la lista Query Code.
Aun no lo soluciono. -
tarta wrote:
Disculpen, estuve algo ocupado y no pude responder.
Race esta en la DB uni_user pero lo raro es que me salte ese erro al añadir en la lista Query Code.
Aun no lo soluciono.
VERY SAD
-
Share
- Facebook 0
- Twitter 0
- Google Plus 0
- Reddit 0
-
Users Online 2
2 Guests