Jump to content
  • 0

Question

Posted (edited)

Hello everyone, I'm seeking help regarding this pvp ranking script that I have..

I have searched google but still failed..

I'm using Gerome's free flux cp design which has this PvP Ranking script which uses AnnieRuru's pvp script..

Here is the sql part of annie's script:

create table pvpladder (

char_id int(11) not null default '0' primary key,

name varchar(30) not null default '',

streaks smallint(6) unsigned not null default '0',

kills smallint(6) unsigned not null default '0',

deaths smallint(6) unsigned not null default '0',

streaktime datetime

) engine = myisam;

create table ownladder (

guild_id int(11) not null default '0' primary key,

name varchar(24) not null default '',

currentown smallint(6) unsigned not null default '0',

highestown smallint(6) unsigned not null default '0',

owntime datetime

) engine = myisam;

The php script part where I fail is this:

<?php if (!defined('FLUX_ROOT')) exit; ?>
<?php
/**
* ======================================
*  TOP pvp Ranking Base on Kills
*  Ranks are base on Player Kills ratio
* --------------------------------------
*  Author: "Gerome" John Gerome Baldonado
*  Email: [email protected]
*  http://rathena.org/board/user/715-gerome/
*  Requirements: Pvpladder Script by Annie.. or any Pvpladder Script
*/

$pvpladder	= Flux::config('FluxTables.pvpladder');
$minimumkills = 10;	   // Minimum Kills..
$player = array();
$minimumRank = 3;		 // Minimim Player(s) that will Display. if the value is 3 it will display 1st - 3rd

$sql = "SELECT  `char`.`name` , `kills`, `deaths` FROM {$server->charMapDatabase}.`char` JOIN $pvpladder ON $pvpladder.char_id = `char`.char_id WHERE `kills` > $minimumkills  ORDER BY `kills` DESC LIMIT 5 ";
$sth = $server->connection->getStatement($sql);
$sth->execute();

$rankings= $sth->fetchAll();

$x = 0;
foreach($rankings as $rank):
$player['name'][$x] = $rank->name;
$player['kills'][$x] = $rank->kills;
$player['deaths'][$x] = $rank->deaths;
$x+=1;
endforeach;
?>

<div id="PvpRankTop">
Ranks are based on <br/>Player kill death ratio<br/> (minimum of <?php echo $minimumkills; ?> kills)
</div>
<table id="Rankings" class="cleanMP">
	<tr>
		<th> </th>
		<th> </th>
		<th id="Kills">Kills</th>
		<th id="Deaths">Deaths</th>
	</tr>
<?php for( $x=0; $x < $minimumRank ;$x++ ): ?>
<?php $y = $x+1; ?>
	<tr>
		<td id="pvprank" class="cleanMP"><?php if($x == 0) {echo $y.'st';}elseif($x == 1) {echo $y.'nd';}elseif($x == 2) {echo $y.'rd';}elseif($x == 3) {echo $y.'th';} else { echo $y.'th'; }  ?></td>
		<td id="pvpname" class="cleanMP"><?php echo $player['name'][$x]; ?></td>
		<td id="pvpkills" class="cleanMP"><?php echo $player['kills'][$x]; ?></td>
		<td id="pvpdeaths"><?php echo $player['deaths'][$x]; ?></td>
	</tr>
<?php endfor; ?>
</table>
<a href="<?php echo $this->url('ranking','pvpranking'); ?>" id="seemore">See More..</a>

I'm using ghost's PVP script which uses this table:

//SQL Table for Ghost's PvP System
CREATE TABLE IF NOT EXISTS `pvp_rank` (
 `char_id` int(11) NOT NULL,
 `account_id` int(11) NOT NULL,
 `char` varchar(30) NOT NULL,
 `kill` int(11) NOT NULL,
 `death` int(11) NOT NULL,
 `kdr` varchar(30) NOT NULL,
 `killingstreak` int(11) NOT NULL,
 `multikill` int(11) NOT NULL,
 `killingspree` int(11) NOT NULL,
 `dominating` int(11) NOT NULL,
 `megakill` int(11) NOT NULL,
 `unstoppable` int(11) NOT NULL,
 `wickedsick` int(11) NOT NULL,
 `monsterkill` int(11) NOT NULL,
 `godlike` int(11) NOT NULL,
 `beyondgodlike` int(11) NOT NULL,
 `doublekill` int(11) NOT NULL,
 `triplekill` int(11) NOT NULL,
 `ultrakill` int(11) NOT NULL,
 `rampage` int(11) NOT NULL,
 `ownage` int(11) NOT NULL,
 `nemesiskill` int(11) NOT NULL,
 `feedcount` int(11) NOT NULL,
 PRIMARY KEY (`char_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Addon's config:

'FluxTables' => array(

'pvpladder' => 'pvp_rank',

)

I have changed the column names in the query but still failed and I really can't understand how sql works in PHP unlike sql in scripts.. :)

If anyone knows what should I change, please tell me.. :)

Thanks.. :)

Edited by wakoko321

6 answers to this question

Recommended Posts

Posted

You can close this thread now, found it out already with playing around with codes.. xD

yeah I'm using ghost pvp too to match on PK Rankings with Gerome's design#3.. and I failed... would you mine share it? /no1

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...