rofl90 Posted March 7, 2007 Share Posted March 7, 2007 Domain will be bought tonight if finished, right now htt://www.habbouncovered.co.uk/mmorpg/ I need a coder to help with: Help line people will click a big '? image' in the footer (which is usually visible) footer is called through an easy to edit variable they will click that and fill in a form which will arive in all administrators & moderators where they can: Upgrade (admin answers) Downgrade (helper aswers) Pick up and reply (help with a reply) or pick up (help). I will also need some errors to be patched as I have really screwed up in the MySQL world.. I keep getting MySQL Error() Division of zero. As a result of your help in the menu there is a Team Portfolio in which you will have your own Sub-Portfolio. Your name will also be in the Global Footer as all the teams will also be. There will be around 3 Programmers which I would really like for you to help out you must have goo knowledge in PHP. It's nothing big just a bit of help needed Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/ Share on other sites More sharing options...
Ninjakreborn Posted March 7, 2007 Share Posted March 7, 2007 Try the freelancing forum. There is a board, if you go back to the main board index, and scroll down you will see "Freelance Forum" post that there. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201933 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 I need hel im 13 not a fully grown hiring staff sorta thing.. i just need a lil help cuz sometimes i can' understand all the functions etc Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201935 Share on other sites More sharing options...
Ninjakreborn Posted March 7, 2007 Share Posted March 7, 2007 If you want "specific help" then find out the section of code you are having problems with, and show it here, tell exactly what you are wanting. Above you have asked for in-depth help finishing a system. if you want that go to the freelance forum and put "Need MMORPG (UNPAID) help". You should get responses either way, the way you are asking seems like you are just simply asking for all out help. Division by 0 is a problem that can sometimes be hard to spot, it has something to do with your math calculations. Somewhere your system is trying to divide something by zero, and depending on how much code there is it could take awhile to debug. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201938 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 the file it is erroring is index.php with 148 lines ill show here <?php //index include 'connect.php'; session_start(); ?> <link rel="stylesheet" href="style.css" type="text/css"> <?php if (isset($_SESSION['player'])) { $player=$_SESSION['player']; $userstats="SELECT * from km_users where playername='$player'"; $userstats2=mysql_query($userstats) or die("Could not get user stats"); $userstats3=mysql_fetch_array($userstats2); if($userstats3[dead]=='Yes') { print "You have been slain by $userstats3[killer]<br>"; print "<form action='revive.php' method='post'>"; print "<input type='hidden' name='ID' value='$userstats3[iD]'>"; print "<input type='submit' name='revives' value='revive'></form>"; } else { $updaterefresh="update km_users set justattacked=0 where ID='$userstats3[iD]'"; mysql_query($updaterefresh) or die("Died"); print "<center><table class='maintable'>"; print "<tr class='headline'><td>"; print "<center><b>Welcome warrior, $player. So you have come to rid the world of evil monsters, do not take on more than you can handle! Monsters are listed in order of increasing difficulty.</b></center>"; print "</td></tr></table></center><br><br>"; print "<center><table class='maintable'>"; print "<tr><td valign='top'>"; print "<table class='maintable'><tr class='headline'><td>Change Password</td></tr>"; print "<tr class='mainrow'><td><b>Password change:</b><A href='setpass.php'>Change password</a></td></tr></table><br><br>"; print "<table class='maintable'><tr class='headline'><td><center>Ranks and Rules</center></td></tr>"; print "<tr class='mainrow'><td><A href='top.php'>Players by rank</a></td></tr>"; print "<tr class='mainrow'><td><A href='playerclose.php'>Players close to you</a></td></tr>"; print "<tr class='mainrow'><td><A href='tophonor.php'>Players by Honor</a></td></tr>"; print "<tr class='mainrow'><td><A href='topland.php'>Largest Fiefdoms(land)</a></td></tr>"; print "<tr class='mainrow'><td><A href='forums/index.php'>Player Forums</a></td></tr>"; print "<tr class='mainrow'><td><A href='challengeinfo.php'>Rules for Challenging Other players</a></td></tr>"; print "</table><br><br>"; print "<table class='maintable'><tr class='headline'><td><center>Buy Land</center></td></tr>"; print "<tr class='mainrow'><td>Land Costs $500 per acre(very expensive).<br>"; print "<form action='buyland.php?ID=$userstats3[iD]' method='post'>"; print "Acres to buy: <input type='text' name='landacres' size='6'> "; print "<input type='submit' name='submit' value='buy'></form></td></tr></table><br><br>"; print "<table class='maintable'><tr class='headline'><td><center>Buy Army</center></td></tr>"; print "<tr class='mainrow'><td>"; print "Each troop Cost 75 gold and each acres can support a max of ten troops:<br>"; print "<form action='buyarmy.php?ID=$userstats3[iD]' method='post'>"; print "Offensive Units: <input type='text' name='off' size='6'><br>"; print "Defensive Units: <input type='text' name='dff' size='6'><br>"; print "<input type='submit' name='submit' value='Buy Army'></form>"; print "</td></tr></table><br><br>"; print "<table class='maintable'><tr class='headline'><td><center>Buy army Training Pts</center></td></tr>"; print "<tr class='mainrow'><td>"; print "Each science point Cost 35 gold.<br>"; $max=$userstats3[land]*10; if($userstats3[land]<=0) { print "Science not applicable due to lack of land."; } else { $percent=$userstats3[science]/$max*100; print "You have: $userstats3[science] pts($percent %)"; } print "<form action='buyscience.php?ID=$user3stats[iD]' method='post'>"; print "<input type='text' name='scipts' size='6'><br>"; print "<input type='submit' name='submit' value='submit'></form>"; print "</td></tr></table>"; print "</td>"; print "<td valign='top'>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Stats</center></td></tr>"; print "<tr class='mainrow'><td><b>You have $userstats3[numturns] Turns</b></td></tr>"; print "<tr class='mainrow'><td><b>Your skill pts: $userstats3[skillpts]</b></td></tr>"; print "<tr class='mainrow'><td><b>Your Honor: $userstats3[honor]</b></td></tr>"; print "<tr class='mainrow'><td><b>Your Gold: $userstats3[gold]</b></td></tr>"; print "<tr class='mainrow'><td><b>Your Land: $userstats3[land]</b></td></tr>"; print "<tr class='mainrow'><td><b>Your offensive army: $userstats3[offarmy]</b></td></tr>"; print "<tr class='mainrow'><td><b>Your Defensive army: $userstats3[dffarmy]</b></td></tr>"; print "<tr class='mainrow'><td><b>Army training pts: $userstats3[science]</b></td></tr>"; print "</table><br>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Select Monster to Slay</center></td></tr>"; print "<tr class='mainrow'><td>"; print "<form action='slaymonster.php' method='post'>"; print "<select name='monstername' length='20'>"; $monster1="SELECT * from km_monsters order by skill asc"; $monster2=mysql_query($monster1) or die("Could not select Monster"); while ($monster3=mysql_fetch_array($monster2)) { print "<option>$monster3[name]</option>"; } print "</select><br>"; print "<input type='submit' name='submit' value='Kill Monster'></form>"; print "</td></tr></table><br>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Select Player to challenge</center></td></tr>"; print "<tr class='mainrow'><td>"; print "Type the ID# of the player you wish to challenge:<br>"; print "<form action='challengeplayer.php' method='post'>"; print "<input type='text' name='playerID' size='20'><br>"; print "<input type='submit' name='submit2' value='challenge'></form>"; print "</td></tr></table><br><br>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Select player's land to attack</center></td></tr>"; print "<tr class='mainrow'><td>"; print "Type the ID# of the player whose land you wish to attack:<br>"; print "<form action='attack.php' method='post'>"; print "<input type='text' name='victimid' size='20'><br>"; print "<input type='submit' name='submit' value='Attack'></form>"; print "</td></tr></table><br><br>"; print "</td></tr></table><br><br>"; print "<table class='maintable'>"; print "<tr class='headline'><td><center>Attacked!!</center></td></tr>"; print "<tr class='mainrow'><td>"; if($userstats3[numberattck]>0) { print "<font color='red'>You have survived $userstats3[numberattck] attacks since your last login.</font><br><br>"; $resets="update km_users set numberattck='0' where playername='$player'"; mysql_query($resets) or die("could not query"); } print "</td></tr></table><br><br>"; $getbattlerecords="SELECT * from km_battlerecords where victimid='$userstats3[iD]'"; $getbattlerecords2=mysql_query($getbattlerecords) or die("Could not get battlerecords"); print "<table class='maintable'>"; print "<tr class='headline'><td colspan='4'><center>Battle records since last login</center></td></tr>"; print "<tr class='mainrow'><td>Attacker ID</td><td>Attacker name</td><td>Result</td><td>Land lost</td></tr>"; while($getbattlerecords3=mysql_fetch_array($getbattlerecords2)) { print "<tr class='mainrow'><td>$getbattlerecords3[attid]</td><td>$getbattlerecords3[attname]</td><td>$getbattlerecords3[result]</td><td>$getbattlerecords3[landlost]</td></tr>"; } print "</table><br><br>"; $delrecords="Delete from km_battlerecords where victimid='$userstats3[iD]'"; mysql_query($delrecords) or die("Could not delete battle records"); } } else { print "Sorry, not logged in please <A href='login.php'>Login</a><br>"; } ?> Sorry i'm new to PHP so this is mybs attempt i'm pretty happy that i've only had 1 error evey now and again =] Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201940 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 Bumped thread this forum is EXTREMELY active.. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201955 Share on other sites More sharing options...
trq Posted March 7, 2007 Share Posted March 7, 2007 What exactly is the error you are getting? Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201965 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 Division by 0 Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201968 Share on other sites More sharing options...
trq Posted March 7, 2007 Share Posted March 7, 2007 Please read the link in my signiture and rethink your question. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201970 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 Could someone look at the code i posted above and tell me the where and how to solve the error of 'Division by 0' Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201972 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 Also whats the php code / function for get the year in '2007' also if i create a variable in globals.php of $sitename then have it included in all pages and call it in the footer and header? so if i have a form that'll write it to globals then itll automatically change? Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201977 Share on other sites More sharing options...
trq Posted March 7, 2007 Share Posted March 7, 2007 The issue could be anywhere, what is the value of $userstats3[land] and $userstats3[science] Also note they ought to be $userstats3['land'] and $userstats3['science'] respectfully. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201984 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 Yeh i think the value always depends because if you buy land science or watever the stat will increase for th record habbouncovered.co.uk/mmorpg is the url if u sign up justabove user stats it will display the error Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201988 Share on other sites More sharing options...
trq Posted March 7, 2007 Share Posted March 7, 2007 Well that is your problem then. $percent=$userstats3[science]/$max*100; If $userstats3['science'] equals 0, you'll get the devide by zero error. You'll need a conditional around it.... $percent = $userstats3['science'] > 0 ? $userstats3['science']/$max*100 : 0; Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-201993 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 I AM EXTREMELY SORRY REAL CODE IS <?php include ("includes/header.php"); session_start(); ?> <center> <table width="968" border="0" align="center" cellpadding="10"> <tr> <td width="150" valign="top"> <!-- Left Table (Navigation and Tagboard) --> <table width="152" border="1" cellpadding="3" style="border-style:inset;"> <tr> <td width="143" class="special"><div id="header"><? if (isset ($_SESSION['player'])) { ?>Navigation<? } else { ?>Login<? } ?></div></td> </tr> <tr> <td class="special"> <? if (isset ($_SESSION['player'])) { ?> <a href="index.php">Home</a><br /> <a href="changepass.php">Change Password</a><br /> <a href="profile.php">Edit Profile</a><br /> <a href="buyland.php">Buy Land</a><br /> <a href="army.php">Train Army</a><br /> <a href="science.php">Buy Science Points</a><br /> <a href="attack.php">Attack</a><br /> <a href="ranking.php">Rankings</a><br /> <a href="pm.php">Private Messages</a><br /> <a href="guild.php">Guild</a><br /> <a href="#">Past Logs</a><br /> <a href="#">Forums</a><br /> <a href="javascript:popUp('online.php')">Users Online</a><br /> <a href="login.php">Logout</a><br /> <? } else { ?> <form name="login" action="login.php" method="post"> User:<input type="text" name="username" value="<?php print $_GET['username']; ?>" /> Pass:<input type="password" name="password" /> <input type="submit" name="submit" value="Login" /> </form> <? } ?> </td> </tr> </table> <br /> <!-- TagBoard begins here --> <?php //TagBoard require ("tag/required.php"); if (isset ($_SESSION['player'])) { print " <FORM action=\"tag/post.php\" method=\"POST\" target=\"tagboard\" name=\"post\" id=\"post\">\n"; print " <TABLE cellpadding=\"0\" cellspacing=\"2\" width=\"1%\" border=\"1\">\n"; print " <TR>\n"; print " <TD>\n"; print " <div id=\"header\">TagBoard</div>\n"; print " </TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TD align=\"center\">\n"; print " <IFRAME src=\"tag/tagboard.php\" width=\"100%\" height=\"240\" frameborder=\"0\" scrolling=\"auto\" name=\"tagboard\"></IFRAME>\n"; print " </TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TD align=\"center\">\n"; print " <INPUT type=\"hidden\" name=\"nick\" size=25 value=\"".$_SESSION['player']."\" maxlength=\"$nicklength;\">\n"; print " </TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TD align=\"center\">\n"; print " <INPUT type=\"hidden\" name=\"url\" size=\"25\" value=\"../profile.php?name=".$_SESSION['player']."\" maxlength=\"$urllength\">\n"; print " </TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TD align=\"center\">\n"; print " <INPUT type=\"text\" name=\"message\" size=\"25\" value=\"message\" maxlength=\"$messagelength\">\n"; print " </TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TD align=\"center\">\n"; print " <INPUT type=\"submit\" value=\"Tag!\" name=\"submit\">\n"; if ($emoticon=="1") print " <BR>[ <a href=\"tag/emoticons.php\" target=\"_blank\">Emotion Help</A> ]\n"; print " </TD>\n"; print " </TR>\n"; print " </TABLE>\n"; print " </FORM>\n"; } //END Tag board powered by Tag it! else { ?> <table width="152" border="1" cellpadding="3"> <tr> <td width="143" class="special"><div id="header">Links</div></td> </tr> <tr> <td class="special"> <a href="register.php">Register</a><br /> <a href="reset.php">Reset Password</a><br /> <a href="javascript:popUp('online.php')">Users Online</a><br /> <a href="ranking.php">Rankings</a><br /> <a href="#">Game Policy</a><br /> </td> </tr> </table> <? } ?> <!-- END TagBoard --> </td> <!-- Content Table --> <td width="676" valign="top"> <br /><p align="right">Server Time: <?php print date ('g:i a l F j');?></p> <!-- Content Begins here --> <?php //Begin Content if (isset($_SESSION['player'])) { $query = "SELECT * from ext_users where playername='$player'"; $command = mysql_query ($query) or die($db_error); $playerinfo = mysql_fetch_array($command); if (!$playerinfo['dead'] && !$playerinfo['chardead']) { $ip = $_SERVER['REMOTE_ADDR']; print "<p>Welcome to Realms Of Chaos,<b>".$playerinfo['playername']."</b>. You are current logged in under the IP of ".$ip.". Your last login IP was ".$playerinfo['lastip']."</p>"; print "<p align=\"center\">~ News and Updates ~</p>"; print "<center>$news</center>"; print "<br /><br />"; print "<table width=\"512\" border=\"1\" cellpadding=\"3\" align=\"center\">"; //start PM block $query = "SELECT COUNT(*) from ext_pms where receiver='".$playerinfo[iD]."' and hasread='0'"; $command = mysql_query($query) or die($db_error); $result = mysql_result ($command , 0); print "<tr><td>You have <a href=\"pm.php\">$result unread PMs</a> in your inbox. <a href=\"composepm.php\">[Compose PM]</a></td></tr>"; print "</table>"; $query2 = "SELECT COUNT(*) from ext_ginvites where reciever='$playerinfo[playername]' AND used='0'"; $command2 = mysql_query($query2) or die(mysql_error()); $result2 = mysql_result ($command2 , 0); if ($result2 != 0) { print "<br /><br />"; print "<table width=\"512\" border=\"1\" cellpadding=\"3\" align=\"center\">"; print "<tr><td><center>You have <a href=\"guildinvites.php\">$result2 guild invites</a></center></td></tr>"; print "</table>"; } else{} if ($_GET['ap']) { print "<br />"; if ($_GET['ap'] == "ma") { if ($playerinfo['ap'] - 1 < 0) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no AP left!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } else { $command4 = "Update ext_users set ma=ma+'1', ap=ap-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 AP added to INT!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } } else if ($_GET['ap'] == "str") { if ($playerinfo['ap'] - 1 < 0) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no AP left!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } else { $command4 = "Update ext_users set str=str+'1', ap=ap-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 AP added to STR!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } } else if ($_GET['ap'] == "hp") { if ($playerinfo['ap'] - 1 < 0) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no AP left!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } else { $hp = $playerinfo['charmaxhp']/10; $command4 = "Update ext_users set charmaxhp=charmaxhp+'$hp', ap=ap-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 AP added to HP!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } } else if ($_GET['ap'] == "mp") { if ($playerinfo['ap'] - 1 < 0) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no AP left!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } else { $mp = $playerinfo['charmaxmp']/10; $command4 = "Update ext_users set charmaxmp=charmaxmp+'$mp', ap=ap-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 AP added to MP!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } } else { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>AP Data</b></font></center><p align=\"center\">You have <b>".$playerinfo['ap']." AP left</p>"; print "<p align=\"center\"><a href=\"index.php?stat=char\">Continue</a></p>"; } } else if ($_GET['sp']) { print "<br />"; //adding SP for fire bolt if ($_GET['sp'] == "fire") { if ($playerinfo['sp'] - 1 < 0 && $playerinfo['fire'] < 30) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no SP left or you have already maxed this skill!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } else { $command4 = "Update ext_users set fire=fire+'1', sp=sp-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 SP added to Fire Bolt!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } } //adding SP for Ice beam else if ($_GET['sp'] == "ice") { if ($playerinfo['sp'] - 1 < 0 && $playerinfo['ice'] < 30) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no SP left or you have already maxed this skill!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } else { $command4 = "Update ext_users set ice=ice+'1', sp=sp-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 SP added to Ice Beam!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } } //adding SP for Thunderspear else if ($_GET['sp'] == "lite") { if ($playerinfo['sp'] - 1 < 0 && $playerinfo['lite'] < 30) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no SP left or you have already maxed this skill!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } else { $command4 = "Update ext_users set lite=lite+'1', sp=sp-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 SP added to Thunderspear!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } } //adding SP for poison bolt else if ($_GET['sp'] == "poison") { if ($playerinfo['sp'] - 1 < 0 && $playerinfo['poison'] < 30) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no SP left or you have already maxed this skill!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } else { $command4 = "Update ext_users set poison=poison+'1', sp=sp-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 SP added to Poison Bolt!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } } //adding SP for heal else if ($_GET['sp'] == "heal") { if ($playerinfo['sp'] - 1 < 0 && $playerinfo['heal'] < 30) { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Error!</b></font></center><p align=\"center\">You have no SP left or you have already maxed this skill!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } else { $command4 = "Update ext_users set heal=heal+'1', sp=sp-'1' where playername='$player'"; mysql_query ($command4) or die ($db_error); print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>Success!</b></font></center><p align=\"center\">1 SP added to Heal!</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } } //display SP data else { print "<center><font face=\"verdana\" color=\"red\" size=\"2\"><b>SP Data</b></font></center><p align=\"center\">You have <b>".$playerinfo['sp']." SP left</p>"; print "<p align=\"center\"><a href=\"index.php?stat=skill\">Continue</a></p>"; } } print "<br /><br />"; print "<table width=\"512\" cellpadding=\"5px\" align=\"center\" border=\"1\" style=\"border-style:dashed; border-width:thin; border-collapse:collapse;\" cellspacing=\"0px\">"; if ($_GET['stat']=="char") { print "<caption style=\"font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px\">Character Stats <a href=\"index.php\">[battle Stats]</a> <a href=\"index.php?stat=skill\">[skills]</a></caption>"; $expper = round (($playerinfo['skillpts']/$playerinfo['expneed'])*100); print "<tr><td>Level</td><td>".$playerinfo['lvl']."</td>"; print "<tr><td>Skill Points</td><td>".$playerinfo['skillpts']."/".$playerinfo['expneed']."(".$expper."%)</td>"; print "<tr><td>Int(For spells)</td><td>".$playerinfo['ma']; if ($playerinfo['ap'] == TRUE) { print "<a href=\"index.php?ap=ma&stat=char\">[+]</a>/<a href=\"index.php?ap=blah&stat=char\">[view]</a>"; } print "</td>"; print "<tr><td>Str(For weapon attack)</td><td>".$playerinfo['str']; if ($playerinfo['ap'] == TRUE) { print "<a href=\"index.php?ap=str&stat=char\">[+]</a>/<a href=\"index.php?ap=blah&stat=char\">[view]</a>"; } print "</td>"; print "<tr><td>Gold</td><td>".$playerinfo['gold']."</td>"; $hp = round (($playerinfo['charhp']/$playerinfo['charmaxhp'])*100); print "<tr><td>HP Left</td><td>".$playerinfo['charhp']."/".$playerinfo['charmaxhp']."(".$hp."%)"; if ($playerinfo['heal'] && $playerinfo['charhp'] < $playerinfo['charmaxhp']) { print " <a href=\"heal.php\">[heal]</a>"; } if ($playerinfo['ap'] == TRUE) { print "<a href=\"index.php?ap=hp&stat=char\">[+]</a>/<a href=\"index.php?ap=blah&stat=char\">[view]</a>"; } $mp = round (($playerinfo['charmp']/$playerinfo['charmaxmp'])*100); print "<tr><td>MP Left</td><td>".$playerinfo['charmp']."/".$playerinfo['charmaxmp']."(".$mp."%)"; if ($playerinfo['ap'] == TRUE) { print "<a href=\"index.php?ap=mp&stat=char\">[+]</a>/<a href=\"index.php?ap=blah&stat=char\">[view]</a>"; } print "<tr><td>Equipment</td><td><a href=\"equip.php\">[view]</a></td></tr>"; } else if($_GET['stat']=="skill") { print "<caption style=\"font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px\">Skill Stats <a href=\"index.php\">[battle Stats]</a> <a href=\"index.php?stat=char\">[Char Stats]</a></caption>"; print "<tr><td>SP Left</td><td>".$playerinfo['sp']."</td>"; print "<tr><td><img src=\"fire.gif\" />Fire Ball</td><td>".$playerinfo['fire']."/30"; if ($playerinfo['sp'] == TRUE && $playerinfo['fire'] <= 30) { print "<a href=\"index.php?sp=fire&stat=skill\">[+]</a>/<a href=\"index.php?sp=blah&stat=skill\">[view]</a>"; } print "<tr><td><img src=\"ice.gif\" />Ice Beam</td><td>".$playerinfo['ice']."/30"; if ($playerinfo['sp'] == TRUE && $playerinfo['ice'] <= 30) { print "<a href=\"index.php?sp=ice&stat=skill\">[+]</a>/<a href=\"index.php?sp=blah&stat=skill\">[view]</a>"; } print "<tr><td><img src=\"lightning.gif\" />Thunder Spear</td><td>".$playerinfo['lite']."/30"; if ($playerinfo['sp'] == TRUE && $playerinfo['lite'] <= 30) { print "<a href=\"index.php?sp=lite&stat=skill\">[+]</a>/<a href=\"index.php?sp=blah&stat=skill\">[view]</a>"; } print "<tr><td><img src=\"poison.gif\" />Poison Bolt</td><td>".$playerinfo['poison']."/30"; if ($playerinfo['sp'] == TRUE && $playerinfo['poison'] <= 30) { print "<a href=\"index.php?sp=poison&stat=skill\">[+]</a>/<a href=\"index.php?sp=blah&stat=skill\">[view]</a>"; } print "<tr><td><img src=\"heal.gif\" />Heal</td><td>".$playerinfo['heal']."/30"; if ($playerinfo['sp'] == TRUE && $playerinfo['heal'] <= 30) { print "<a href=\"index.php?sp=heal&stat=skill\">[+]</a>/<a href=\"index.php?sp=blah&stat=skill\">[view]</a>"; } } else { print "<caption style=\"font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px\">Battle Stats <a href=\"index.php?stat=char\">[Char Stats]</a> <a href=\"index.php?stat=skill\">[skills]</a></caption>"; print "<tr><td>Gold</td><td>".$playerinfo['gold']."</td>"; print "<tr><td>Level</td><td>".$playerinfo['lvl']."</td>"; print "<tr><td>Honour</td><td>".$playerinfo['honor']."</td>"; print "<tr><td>Land</td><td>".$playerinfo['land']."</td>"; print "<tr><td>Offence Army Size</td><td>".$playerinfo['offarmy']."</td>"; print "<tr><td>Defence Army Size</td><td>".$playerinfo['dffarmy']."</td>"; print "<tr><td>Science</td><td>".$playerinfo['science']."</td>"; print "<tr><td>Fort</td><td>".$playerinfo['fort']."</td>"; $hp = round (($playerinfo['hp']/$playerinfo['maxhp'])*100); print "<tr><td>Fort HP Left</td><td>".$playerinfo['hp']."/".$playerinfo['maxhp']."(".$hp."%)</td>"; if ($playerinfo['guild']) { $guild = $playerinfo['guild']; } else { $guild = "None"; } print "<tr><td>Guild</td><td>".$guild."</td>"; } print "</tr></table>"; } else if ($playerinfo['chardead']) { print "<p align=\"center\"><font face=\"red\">You have been killed by the ".$playerinfo['killer']." while attempting to kill it. Click <a href=\"revive.php\">here</a> to revive.You will lose 5% of your skillpoints and regain 50% of your health</font></p>"; } else { print "<p align=\"center\"><font face=\"red\">You have been defeated in battle by <a href=\"profile.php?username=".$playerinfo['killer']."\">".$playerinfo['killer']."</a>. Click <a href=\"revive.php\">here</a> to revive.You will lose 10% of your gold and regain 50% of your fort health</font></p>"; } } else { print "<p>Welcome to Realms Of Chaos. This game is developed by Charlie Kirk <p>Realms Of Chaos is running v" . $version . " build " . $build ."</p>"; print "<p align=\"center\">~ News and Updates ~</p>"; print "<center>$news</center>"; } //end content ?> </table> </center> <?php print "<br />"; //include the footer file include ("includes/footer.php"); ?> Realy sorry Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202079 Share on other sites More sharing options...
Daniel0 Posted March 7, 2007 Share Posted March 7, 2007 Suggestion: Lookup "HEREDOC" Note: Does not resolve the problem, but improves code readability. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202087 Share on other sites More sharing options...
trq Posted March 7, 2007 Share Posted March 7, 2007 Once again I suggest you read the link in my signiture, narrow down your problem, and come back when you have more infomation and are able to form a decent question. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202089 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 I've already told you the error Division By 0 Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202092 Share on other sites More sharing options...
trq Posted March 7, 2007 Share Posted March 7, 2007 Help us help you. No one is going to sort through all that code. Narrow the problem down. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202095 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 I'm 13 I've read through it 11 times I can't see a thing i'll look through again though.. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202097 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 most dodgy thing i found $hp = round (($playerinfo['hp']/$playerinfo['maxhp'])*100); Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202099 Share on other sites More sharing options...
trq Posted March 7, 2007 Share Posted March 7, 2007 I didn't ask your age Im sorry, means nothing to me. You need to ensure that $playerinfo['hp'] is always > 0. Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202100 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 lol ok.. just telling why im not 'elite..' so the replacement code is? Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202102 Share on other sites More sharing options...
Daniel0 Posted March 7, 2007 Share Posted March 7, 2007 $hp = $playerinfo['hp']>0 ? round(($playerinfo['hp']/$playerinfo['maxhp'])*100) : intval(0); Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202103 Share on other sites More sharing options...
rofl90 Posted March 7, 2007 Author Share Posted March 7, 2007 Fixed oer broken lines: $expper = round (($playerinfo['skillpts']/$playerinfo['expneed'])*100); $hp = round (($playerinfo['charhp']/$playerinfo['charmaxhp'])*100); $mp = round (($playerinfo['charmp']/$playerinfo['charmaxmp'])*100); Link to comment https://forums.phpfreaks.com/topic/41672-need-help-with-a-text-mmorpg-nearly-done/#findComment-202105 Share on other sites More sharing options...
Recommended Posts