• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

8.50- skrypt

PATrar

New Member
Joined
Jun 11, 2009
Messages
88
Reaction score
0
Czy byłby ktoś tak miły i powiedział co dodać do tego skryptu żeby pokazywany exp dzielił się na 1000
Code:
<?PHP
$limit = 300;
$type = $_REQUEST['type'];


function coloured_value($valuein)
{
	$value2 = $valuein;
	while(strlen($value2) > 3)
	{
		$value .= '.'.substr($value2, -3, 3);
		$value2 = substr($value2, 0, strlen($value2)-3);
	}
	$value = $value2.$value;
	if($valuein > 0)
		return '<font color="green">+'.$value.'</font>';
	elseif($valuein < 0)
		return '<font color="red">'.$value.'</font>';
	else
		return '<font color="black">'.$value.'</font>';

}
if(empty($type))
	$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();
elseif($type == "sum")
	$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`exphist1`+`players`.`exphist2`+`players`.`exphist3`+`players`.`exphist4`+`players`.`exphist5`+`players`.`exphist6`+`players`.`exphist7`+`players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();
elseif($type >= 1 && $type <= 7)
	$players = $SQL->query(' SELECT * FROM players ORDER BY exphist'.(int) $type.' DESC LIMIT '.$limit)->fetchAll();
$main_content .= '<CENTER><H2>Ranking of powergamers</H2></CENTER><BR><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=10% CLASS=whites><B>Pozycja</B></TD><TD WIDTH=75% CLASS=whites><B>Nazwa</B></TD>';
if($type == "sum")
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type=sum">Suma 7 dni</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type=sum">Suma 7 dni</a></center></B></TD>';
for($i = 7; $i >= 2; $i--)
	if($type == $i)
		$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type='.$i.'">'.$i.' Dni Temu</a></center></B></TD>';
	else
		$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type='.$i.'">'.$i.' Dni Temu</a></center></B></TD>';
if($type == 1)
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type=1">Wczoraj</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type=1">Wczoraj</a></center></B></TD>';
if(empty($type))
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist">Dzisiaj</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist">Dzisiaj</a></center></B></TD>';
$main_content .= '</TR>';
foreach($players as $player)
{
	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 align="center">'.$number_of_rows.'. </td>';
	if($player['online'] == 1)
		$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="green">'.$player['name'].'</font></b></a>';
	else
		$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="red">'.$player['name'].'</font></b></a>';
	$main_content .= '<br />'.$player['level'].' '.$config_vocations[$player['vocation']].'</td><td align="right">'.coloured_value($player['exphist1'] + $player['exphist2'] + $player['exphist3'] + $player['exphist4'] + $player['exphist5'] + $player['exphist6'] + $player['exphist7'] + $player['experience'] - $player['exphist_lastexp']).'</td>';
	$main_content .= '<td align="right">'.coloured_value($player['exphist7']).'</td><td align="right">'.coloured_value($player['exphist6']).'</td><td align="right">'.coloured_value($player['exphist5']).'</td><td align="right">'.coloured_value($player['exphist4']).'</td><td align="right">'.coloured_value($player['exphist3']).'</td><td align="right">'.coloured_value($player['exphist2']).'</td><td align="right">'.coloured_value($player['exphist1']).'</td><td align="right">'.coloured_value($player['experience']-$player['exphist_lastexp']).'</td></tr>';
}
$main_content .= '</TABLE>';
?>
 
Last edited:
Jeśli mam np. coś takiego
PHP:
'.coloured_value($player['exphist7']).'
i zmienie na
PHP:
'.coloured_value($player['exphist7']/1000).'
to jest dobrze lecz jak wezmę to w expie dzisiejszym lub ogółem już tak nie działa

Wiec może jakaś poprawka? wiem że każdy by chciał coś więcej za to niż repa leczu mnie narazie z kasą krucho ;p
 
Od dzisiaj do każdego TFSa będa dodawane dodatki do skryptów xD :D
 
w każdym pliku musisz dawać takie /1000 =P, albo zrobic if'a na query w klasie SQL

Jest jeszcze jedna opcja, ale to już bardziej skomplikowane i nie będe ci tym dupy truł :).
 
Wiem że w każdym tylko wtedy jak jest np. 232000 i dzieli na 1000
wychodzi jakieś 2.3.2 a powinno być 23.2 a ta druga opcja z sql to dokładniej jak ;p
 
Skrypt przed edycją:

PHP:
<?PHP
$limit = 300;
$type = $_REQUEST['type'];


function coloured_value($valuein)
{
	$value2 = $valuein;
	while(strlen($value2) > 3)
	{
		$value .= '.'.substr($value2, -3, 3);
		$value2 = substr($value2, 0, strlen($value2)-3);
	}
	$value = $value2.$value;
	if($valuein > 0)
		return '<font color="green">+'.$value.'</font>';
	elseif($valuein < 0)
		return '<font color="red">'.$value.'</font>';
	else
		return '<font color="black">'.$value.'</font>';

}
if(empty($type))
	$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();
elseif($type == "sum")
	$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`exphist1`+`players`.`exphist2`+`players`.`exphist3`+`players`.`exphist4`+`players`.`exphist5`+`players`.`exphist6`+`players`.`exphist7`+`players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();
elseif($type >= 1 && $type <= 7)
	$players = $SQL->query(' SELECT * FROM players ORDER BY exphist'.(int) $type.' DESC LIMIT '.$limit)->fetchAll();
$main_content .= '<CENTER><H2>Ranking of powergamers</H2></CENTER><BR><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=10% CLASS=whites><B>Pozycja</B></TD><TD WIDTH=75% CLASS=whites><B>Nazwa</B></TD>';
if($type == "sum")
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type=sum">Suma 7 dni</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type=sum">Suma 7 dni</a></center></B></TD>';
for($i = 7; $i >= 2; $i--)
	if($type == $i)
		$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type='.$i.'">'.$i.' Dni Temu</a></center></B></TD>';
	else
		$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type='.$i.'">'.$i.' Dni Temu</a></center></B></TD>';
if($type == 1)
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type=1">Wczoraj</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type=1">Wczoraj</a></center></B></TD>';
if(empty($type))
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist">Dzisiaj</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist">Dzisiaj</a></center></B></TD>';
$main_content .= '</TR>';
foreach($players as $player)
{
	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 align="center">'.$number_of_rows.'. </td>';
	if($player['online'] == 1)
		$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="green">'.$player['name'].'</font></b></a>';
	else
		$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="red">'.$player['name'].'</font></b></a>';
	$main_content .= '<br />'.$player['level'].' '.$config_vocations[$player['vocation']].'</td><td align="right">'.coloured_value($player['exphist1'] + $player['exphist2'] + $player['exphist3'] + $player['exphist4'] + $player['exphist5'] + $player['exphist6'] + $player['exphist7'] + $player['experience'] - $player['exphist_lastexp']).'</td>';
	$main_content .= '<td align="right">'.coloured_value($player['exphist7']).'</td><td align="right">'.coloured_value($player['exphist6']).'</td><td align="right">'.coloured_value($player['exphist5']).'</td><td align="right">'.coloured_value($player['exphist4']).'</td><td align="right">'.coloured_value($player['exphist3']).'</td><td align="right">'.coloured_value($player['exphist2']).'</td><td align="right">'.coloured_value($player['exphist1']).'</td><td align="right">'.coloured_value($player['experience']-$player['exphist_lastexp']).'</td></tr>';
}
$main_content .= '</TABLE>';
?>

Rezultat przed edycją:
24gvmex.jpg


Skrypt po edycji:
PHP:
<?PHP
$limit = 300;
$type = $_REQUEST['type'];


function coloured_value($valuein)
{
	$value2 = $valuein;
	while(strlen($value2) > 3)
	{
		$value .= '.'.substr($value2, -3, 3);
		$value2 = substr($value2, 0, strlen($value2)-3);
	}
	$value = $value2.$value;
	if($valuein > 0)
		return '<font color="green">+'.$value.'</font>';
	elseif($valuein < 0)
		return '<font color="red">'.$value.'</font>';
	else
		return '<font color="black">'.$value.'</font>';

}
if(empty($type))
	$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();
elseif($type == "sum")
	$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`exphist1`+`players`.`exphist2`+`players`.`exphist3`+`players`.`exphist4`+`players`.`exphist5`+`players`.`exphist6`+`players`.`exphist7`+`players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();
elseif($type >= 1 && $type <= 7)
	$players = $SQL->query(' SELECT * FROM players ORDER BY exphist'.(int) $type.' DESC LIMIT '.$limit)->fetchAll();
$main_content .= '<CENTER><H2>Ranking of powergamers</H2></CENTER><BR><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=10% CLASS=whites><B>Pozycja</B></TD><TD WIDTH=75% CLASS=whites><B>Nazwa</B></TD>';
if($type == "sum")
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type=sum">Suma 7 dni</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type=sum">Suma 7 dni</a></center></B></TD>';
for($i = 7; $i >= 2; $i--)
	if($type == $i)
		$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type='.$i.'">'.$i.' Dni Temu</a></center></B></TD>';
	else
		$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type='.$i.'">'.$i.' Dni Temu</a></center></B></TD>';
if($type == 1)
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist&type=1">Wczoraj</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist&type=1">Wczoraj</a></center></B></TD>';
if(empty($type))
	$main_content .= '<TD WIDTH=15% bgcolor="red" CLASS=whites><b><center><a href="?subtopic=exphist">Dzisiaj</a></center></B></TD>';
else
	$main_content .= '<TD WIDTH=15% bgcolor="yellow" CLASS=whites><b><center><a href="?subtopic=exphist">Dzisiaj</a></center></B></TD>';
$main_content .= '</TR>';
foreach($players as $player)
{
	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 align="center">'.$number_of_rows.'. </td>';
	if($player['online'] == 1)
		$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="green">'.$player['name'].'</font></b></a>';
	else
		$main_content .= '<td><a href="?subtopic=characters&name='.urlencode($player['name']).'"><b><font color="red">'.$player['name'].'</font></b></a>';
	$main_content .= '<br />'.$player['level'].' '.$config_vocations[$player['vocation']].'</td><td align="right">'.coloured_value($player['exphist1'] + $player['exphist2'] + $player['exphist3'] + $player['exphist4'] + $player['exphist5'] + $player['exphist6'] + $player['exphist7'] + $player['experience'] - $player['exphist_lastexp']/1000).'</td>';
	$main_content .= '<td align="right">'.coloured_value($player['exphist7']/1000).'</td><td align="right">'.coloured_value($player['exphist6']/1000).'</td><td align="right">'.coloured_value($player['exphist5']/1000).'</td><td align="right">'.coloured_value($player['exphist4']/1000).'</td><td align="right">'.coloured_value($player['exphist3']/1000).'</td><td align="right">'.coloured_value($player['exphist2']/1000).'</td><td align="right">'.coloured_value($player['exphist1']/1000).'</td><td align="right">'.coloured_value($player['experience']-$player['exphist_lastexp']/1000).'</td></tr>';
}
$main_content .= '</TABLE>';
?>

Rezultat po edycji
5yw8ar.jpg
 
Back
Top