Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: [php] Parse error
Forum PHP.pl > Forum > Przedszkole
Lethys
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 tongue.gif
    $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 :

  1. <?php
  2.  
  3. // Current town name.
  4. if ($userrow["currentaction"] == "In Town") {
  5. $townquery = doquery("SELECT * FROM {{table}} WHERE latitude='".$userrow["latitude"]."' AND longitude='".$userrow["longitude"]."' LIMIT 1", "towns");
  6. $townrow = mysql_fetch_array($townquery);
  7. $userrow["currenttown"] = "Welcome to <b>".$townrow["name"]."</b>.<br /><br />";
  8. } else {
  9. $userrow["currenttown"] = "";
  10. }
  11.  
  12. if ($controlrow["forumtype"] == 0) { $userrow["forumslink"] = ""; }
  13. elseif ($controlrow["forumtype"] == 1) { $userrow["forumslink"] = "<a href=%22forum.php/%22>Forum</a><br />"; }
  14. elseif ($controlrow["forumtype"] == 2) { $userrow["forumslink"] = "<a href=%22%22.$controlrow[%22forumaddress%22].%22/%22>Forum</a><br />"; }
  15.  
  16. // Format various userrow stuffs...
  17. if ($userrow["latitude"] < 0) { $userrow["latitude"] = $userrow["latitude"] * -1 . "S"; } else { $userrow["latitude"] .= "N"; }
  18. if ($userrow["longitude"] < 0) { $userrow["longitude"] = $userrow["longitude"] * -1 . "W"; } else { $userrow["longitude"] .= "E"; }
  19. $userrow["experience"] = number_format($userrow["experience"]);
  20. $userrow["gold"] = number_format($userrow["gold"]);
  21. if ($userrow["authlevel"] == 1) { $userrow["adminlink"] = "<a href=%22admin.php/%22>Admin</a><br />"; } else { $userrow["adminlink"] = ""; }
  22.  
  23. // HP/MP/TP bars.
  24. $levelquery = doquery("SELECT ". $userrow["charclass"]."_exp FROM {{table}} WHERE id='".($userrow["level"]+1)."' LIMIT 1", "levels");
  25. $levelrow = mysql_fetch_array($levelquery);
  26. $userrow["nextlevel"] = $levelrow[$userrow["charclass"]."_exp"];
  27. $need = ($userrow["nextlevel"] - $userrow["experience"]);
  28. $userrow["expneed"] = $need;
  29. $stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
  30. if ($userrow["maxmp"] != 0) { $statmp = ceil($userrow["currentmp"] / $userrow["maxmp"] * 100); } else { $statmp = 0; }
  31. $stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100);
  32. $stattable = "<table width=\"100\"><tr><td width=\"33%\">\n";
  33. $stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
  34. if ($stathp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\">
  35. <img src=%22images/bars_green.gif/%22 alt=\"\" /></div>"; }
  36. 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);\">
  37. <img src=%22images/bars_yellow.gif/%22 alt=\"\" /></div>"; }
  38. if ($stathp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\">
  39. <img src=%22images/bars_red.gif/%22 alt=\"\" /></div>"; }
  40. $stattable .= "</td></tr></table></td><td width=\"33%\">\n";
  41. $stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
  42. if ($statmp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\">
  43. <img src=%22images/bars_green.gif/%22 alt=\"\" /></div>"; }
  44. 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);\">
  45. <img src=%22images/bars_yellow.gif/%22 alt=\"\" /></div>"; }
  46. if ($statmp < 33) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\">
  47. <img src=%22images/bars_red.gif/%22 alt=\"\" /></div>"; }
  48. $stattable .= "</td></tr></table></td><td width=\"33%\">\n";
  49. $stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
  50. if ($stattp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\">
  51. <img src=%22images/bars_green.gif/%22 alt=\"\" /></div>"; }
  52. 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);\">
  53. <img src=%22images/bars_yellow.gif/%22 alt=\"\" /></div>"; }
  54. if ($stattp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\">
  55. <img src=%22images/bars_red.gif/%22 alt=\"\" /></div>"; }
  56. $stattable .= "</td></tr></table></td>\n";
  57. $stattable .= "</tr><tr><td>HP</td><td>MP</td><td>TP</td></tr></table>\n";
  58. $userrow["statbars"] = $stattable;
  59.  
  60. ?>
mdco
A mog³by¶ zaznaczyæ linijke z b³êdem (line 192) ? Wtedy bylo by ³atwiej.
Lethys
W instrukcji instalacji modernizacji pisze zeby dodac po linijce

Cytat
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);


Robie tak ale wciaz jest ten blad a pisze ze 192 linijka blink.gif
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.