Dankoo
Active Member
- Joined
- Sep 4, 2010
- Messages
- 1,007
- Reaction score
- 27
I have the follow php script:
I've translated it to PT-BR, it's a injection for modern, here's the topic
So, anyway, the points is... The script has a rank, wich get's the player's highest level, etc... I would like it to show the best reputed and worst reputed player in the guild
Like, for experience, it selects "experience" from database
For reputation, it should select by "rep", the highest and lowest number
Can anyone send me a light in this matter? :thumbup:
Thanks a lot.
eace:
PHP:
<?php
#################################################################################
## CONFIGURATION PAGE ##
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- #
## ---------------------------------------------------------------------------- #
## Script created by Kavvson (http://otland.net/members/kavvson/) #
## Author & developer: Kavvson #
## #
## Helpers: Stian <http://www.otland.net> #
## MiPo91 <http://www.otland.net> #
#################################################################################
## +--------------------------Guild_View Injection------------------------------+
## | DONE: v.1 & v.2
## | - Fade
## | - Jquery Tabs
## | - Show online members in the guild
## | - Show the total level of members in guild
## | - Show the average level of members in guild
## | - Show the highest level in guild
## | - Show the lowest level in guild
## |
## | DONE: v.3
## | - @DEFINE INJECTION_PATH - path to the folder
## | - Skill ranking (all skills,mlvl experience) credits : http://otland.net/members/mipo91/
## | - Alert Box
## | - Average level script fix .round(value)
## | - Typo fixes
## | - New Functions:
## | - $get=member($guildMembers);
## | - $get=invite($invite);
## | - $get=online($allM);
## | - $get=level($allM1 ,$allM2);
## | - $get=rank($allM3 ,$allM4);
## | - $get=points($sum);
## +----------------------------------------------------------------------------+
#################################################################################
#################################################################################
## +---------------------------------------------------------------------------
## | Database connection + Specific variables + Importing
## +---------------------------------------------------------------------------
#################################################################################
##########################################
## Define ##
##########################################
## Please write the path to this folder ##
## Else leave it ##
##########################################
@DEFINE ('INJECTION_PATH', 'injections/guild_view/Advanced Table');
################################
## Style part ##
################################
## You might change this part ##
################################
$image_i = '<img style="border: medium none;" src="'.WEBSITE.'/'.INJECTION_PATH.'/images/Golden_Goblet.gif">';
ECHO '<link rel="stylesheet" href="'.WEBSITE.'/'.INJECTION_PATH.'/jquery.alerts.css" /><script src="'.WEBSITE.'/'.INJECTION_PATH.'/jquery.alerts.js" type="text/javascript"></script>';
########################
## Connection ##
########################
## Leave these values ##
########################
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$connection = POT::getInstance()->getDBHandle();
$CI =& get_instance();
$CI->load->helper("url");
$guild_id = $CI->uri->segment(3);
###############
## Variables ##
###############
$skills = array(
0 => "Fist Fighting",
1 => "Club Fighting",
2 => "Sword Fighting",
3 => "Axe Fighting",
4 => "Distance Fighting",
5 => "Shielding",
6 => "Fishing"
);
#################################################################################
## +---------------------------------------------------------------------------
## | Database queries
## +---------------------------------------------------------------------------
#################################################################################
$guildMembers = $connection->query ( 'SELECT COUNT(`gr`.`id`) AS `total` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` = '.$guild_id )->fetch( );
$invite = $connection->query( 'SELECT COUNT(*) FROM `guild_invites` WHERE `guild_id` = '.$guild_id)->fetch( );
$allM = $connection->query ('SELECT COUNT(1) as `people` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') AND online = 1')->fetch();
$allM1 = $connection->query ('SELECT SUM(`level`) as `level` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ')->fetch();
$allM2 = $connection->query ('SELECT AVG(`level`) as `level` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ')->fetch();
$allM3 = $connection->query ('SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ORDER BY `level` ASC LIMIT 1')->fetch();
$allM4 = $connection->query ('SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = '.$guild_id.') ORDER BY `level` DESC LIMIT 1')->fetch();
$a=round($allM2[0]);
$b=$allM1[0];
$sum = $a+$b+$guildMembers[0]+$allM3[0];
#################################################################################
## +---------------------------------------------------------------------------
## | Functions
## +---------------------------------------------------------------------------
#################################################################################
Function member($guildMembers){
IF ( $guildMembers[0] == 1 ){
ECHO "A Guild tem <p style='color:green;display:inline;'><b>".$guildMembers[0]."</b></p> membro";
}ELSE{
ECHO "A Guild tem <p style='color:green;display:inline;'><b>".$guildMembers[0]."</b></p> membros";
}
}
Function invite($invite){
IF ( $invite[0] == 0 ){
ECHO "Nenhum jogador convidado";
}ELSEIF ( $invite[0] == 1 ){
ECHO "Um jogador está convidado";
}ELSE{
ECHO "<p style='color:green;display:inline;'><b>".$invite[0]."</b></p> Jogadores estão convidados";
}
}
Function online($allM){
IF ( $allM[0] == 0 ){
ECHO "Ninguém está online";
}ELSEIF ( $allM[0] == 1 ){
ECHO "Um membro está online";
}ELSE{
ECHO "<p style='color:green;display:inline;'><b>".$allM[0]."</b></p> Membros estão online";
}
}
Function level($allM1, $allM2){
ECHO "<p style='color:green;display:inline;'><b>".$allM1[0]."</b></p> Level somado de todos os membros<br>";
ECHO "<p style='color:green;display:inline;'><b>".round($allM2[0])."</b></p> Média de level de todos os membros da Guild";
}
Function rank($allM3, $allM4){
ECHO "<p style='color:green;display:inline;'><b>".$allM3[0]."</b></p> Tem o maior level da guild<br>";
ECHO "<p style='color:green;display:inline;'><b>".$allM4[0]."</b></p> Tem o menor level da guild";
}
Function points($sum){
echo "<br><p style='color:green;display:inline;'><b>".$sum."</b></p> guild points";
}
?>
<a id="alert_button" href="#"><b>Highscores</b></a>
<style type="text/css">
.ui-tabs {
height: !auto;
}
</style>
<script>
$(document).ready(function () {
$('#serverStats').fadeIn(2000)
});
$("a#alert_button").click(function () {
jAlert('<?PHP echo "<div class=i_head>Skills</div><hr><table align=center>"; foreach($skills as $key => $value) { $allM5 = $connection->query ('
SELECT`p`.`name`AS`Name`, `ps`.`value`AS`Sword`, `p`.`maglevel`, `p`.`experience`FROM`players`AS`p`JOIN`player_skills`AS`ps`WHERE`ps`.`player_id` = `p`.`id`AND`ps`.`skillid` = '.$key.'
AND`rank_id`IN(SELECT`id`FROM`guild_ranks`WHERE`guild_id` = '.$guild_id.') ORDER BY`Sword`DESC Limit 1 ')->fetch(); echo "<tr align=center><td><img style=\"border:medium none;\" src=\"".WEBSITE."/".INJECTION_PATH."/images/skills/".$key.".png\"></td><td><div class=i_name>".$allM5[0]."</div></td><td><div class=i_skill>".$allM5[1]." : ".$value."</div></td></tr>"; } echo "</table><div class=i_head>Experiência</div><hr><table align=center>"; echo "<tr align=center><td><img style=\"border:medium none;\" src=\"".WEBSITE."/".INJECTION_PATH."/images/skills/7.png\"></td><td><div class=i_name>".$allM5[0]."</div></td><td><div class=i_skill>".$allM5[3] . " : Experiência:</div></td></tr>"; echo "<tr align=center><td><img style=\"border:medium none;\" src=\"".WEBSITE."/".INJECTION_PATH."/images/skills/8.png\"></td><td><div class=i_name>".$allM5[0]."</div></td><td><div class=i_skill>".$allM5[2] . " : Magic Level</div></td></tr>"; ?></table>', '<?PHP echo $image_i;?> Ranking de Skills <?PHP echo $image_i;?>');
});
</script>
<script>
$(function () {
$("#tabs").tabs();
});
</script>
<div id="serverStats" style="display:none;">
<div id='tabs'>
<ul>
<li><a href="#general">Informações Gerais</a></li>
<li><a href="#statistics">Estatísticas</a></li>
<li><a href="#glory">Hall da Fama</a></li>
</ul>
<div id='general'>
<?PHP $get=member($guildMembers);?>
<br>
<?PHP $get=invite($invite);?>
<br>
<?PHP $get=online($allM);?>
</div>
<div id='statistics'>
<?PHP $get=level($allM1 ,$allM2);?>
</div>
<div id='glory'>
<?PHP $get=rank($allM3 ,$allM4); $get=points($sum);?>
</div>
</div>
</div>
<br>
<br>
<br>
I've translated it to PT-BR, it's a injection for modern, here's the topic
So, anyway, the points is... The script has a rank, wich get's the player's highest level, etc... I would like it to show the best reputed and worst reputed player in the guild
Like, for experience, it selects "experience" from database
For reputation, it should select by "rep", the highest and lowest number
Can anyone send me a light in this matter? :thumbup:
Thanks a lot.