Korzystam z gotowego silnika gry w php i postanowilem dodac kilka modyfikacji ze strony glownej gry wiec na 100% one dzialaja ale nie koniecznie u mnie ;/
To jest Modyfikacja :
Cytat
To add an experience needed count down, to the right nav.
-- Open TEMPLATE/RIGHTNAV.php
-- Search for the line containing:
{{nextlevel}}
-- copy and paste
Exp needed: {{expneed}}<br />
-- after it.
-- Open LIB.php
-- Search for:
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
-- copy and paste
//simple exp needed mod.. poorly coded by Anman

$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
$levelrow = mysql_fetch_array($levelquery);
$userrow["nextlevel"] = $levelrow[$userrow["charclass"]."_exp"];
$need = ($userrow["nextlevel"] - $userrow["experience"]);
$userrow["expneed"] = $need;
-- Before it.
-- Peace out - Anman.
Z dodaniem w rightnav nie ma zadnych problemow ale w lib juz niestety sa ;/
Dodaje tak jak pisze przed $stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100); ale mam blad :
Cytat
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/sites/yoyo.pl/m/u/munforum/gra/lib.php on line 192
A oto moje lib.php ( wycinek z niego ) wklejony kod jest po // HP/MP/TP bars. tak jak pisalo w tutku :
<?php
// Current town name.
if ($userrow["currentaction"] == "In Town") {
$townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
$userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
} else {
$userrow["currenttown"] = "";
}
if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; }
elseif ($controlrow["forumtype"] == 1) { $userrow["forumslink"] = "<a href=%22forum.php/%22>Forum</a><br />"; }
elseif ($controlrow["forumtype"] == 2) { $userrow["forumslink"] = "<a href=%22%22.$controlrow[%22forumaddress%22].%22/%22>Forum</a><br />"; }
// Format various userrow stuffs...
if ($userrow["latitude"] < 0) { $userrow["latitude"] = $userrow["latitude"] * -1 . "S"; } else { $userrow["latitude"] .= "N"; }
if ($userrow["longitude"] < 0) { $userrow["longitude"] = $userrow["longitude"] * -1 . "W"; } else { $userrow["longitude"] .= "E"; }
if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=%22admin.php/%22>Admin</a><br />"; } else { $userrow["adminlink"] = ""; }
// HP/MP/TP bars.
$levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
$userrow["nextlevel"] = $levelrow[$userrow["charclass"]."_exp"];
$need = ($userrow["nextlevel"] - $userrow["experience"]);
$userrow["expneed"] = $need;
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100
); if ($userrow["maxmp"] != 0
) { $statmp = ceil($userrow["currentmp"] / $userrow["maxmp"] * 100
); } else { $statmp = 0; } $stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100
); $stattable = "<table width=\"100\"><tr><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($stathp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\">
<img src=%22images/bars_green.gif/%22 alt=\"\" /></div>"; }
if ($stathp < 66 && $stathp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\">
<img src=%22images/bars_yellow.gif/%22 alt=\"\" /></div>"; }
if ($stathp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\">
<img src=%22images/bars_red.gif/%22 alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($statmp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\">
<img src=%22images/bars_green.gif/%22 alt=\"\" /></div>"; }
if ($statmp < 66 && $statmp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\">
<img src=%22images/bars_yellow.gif/%22 alt=\"\" /></div>"; }
if ($statmp < 33) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\">
<img src=%22images/bars_red.gif/%22 alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($stattp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\">
<img src=%22images/bars_green.gif/%22 alt=\"\" /></div>"; }
if ($stattp < 66 && $stattp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\">
<img src=%22images/bars_yellow.gif/%22 alt=\"\" /></div>"; }
if ($stattp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\">
<img src=%22images/bars_red.gif/%22 alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td>\n";
$stattable .= "</tr><tr><td>HP</td><td>MP</td><td>TP</td></tr></table>\n";
$userrow["statbars"] = $stattable;
?>
Ten post edytował [Lethys] 10.03.2006, 14:35:32