dauninge Posted January 10, 2011 Posted January 10, 2011 Regarding this mod from Beton: [mccode v2] Advanced(isher) Level Upgrade Mod. I followed the instructions for this Level Upgrade Mod, and it works, but I have a small problem that I can't figure out. When I put this in the header file (I put it above the Name field) : if($upgrade == "Y") { print"<a href=upgrade.php>[upgrade]</a>"; } On my home page it prints above my name: if( == "Y") { print"[upgrade]"; } The upgrade link works, but I only want it to print [upgrade] and not the code part. I'm trying to learn PHP, but just starting, so any help is appreciated. Maybe I have it in the wrong place? Thanks! Quote
Paul Evans Posted January 10, 2011 Posted January 10, 2011 Paste 10 lines below and above from your header. Quote
Uridium Posted January 10, 2011 Posted January 10, 2011 dauninge I've spoken to my fat tall friend and we both think your echoing the entire section... Quote
dauninge Posted January 10, 2011 Author Posted January 10, 2011 OK, Here is a bit more than 10 lines above and below, but just in case. I changed the location of the code to under the health status bar. I am not sure how to not echo the section. I am pretty sure I need it in a different place, or another command? Sorry, I am a noob, but trying to learn. I do appreciate the responses and any help. print <<<OUT <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" bgcolor="#$bgcolor" valign="top"> Name: $gn{$u} [{$ir['userid']}] $d Money: {$fm} Level: {$ir['level']} Crystals: {$ir['crystals']} [Emergency Logout] <hr /> Energy: {$enperc}% <img src=greenbar.png width=$enperc height=10><img src=redbar.png width=$enopp height=10> Will: {$wiperc}% <img src=bluebar.png width=$wiperc height=10><img src=redbar.png width=$wiopp height=10> Brave: {$ir['brave']}/{$ir['maxbrave']} <img src=yellowbar.png width=$brperc height=10><img src=redbar.png width=$bropp height=10> EXP: {$experc}% <img src=navybar.png width=$experc height=10><img src=redbar.png width=$exopp height=10> Health: {$hpperc}% <img src=greenbar.png width=$hpperc height=10><img src=redbar.png width=$hpopp height=10> <hr /> if($upgrade == "Y") { print"<a href=upgrade.php>[upgrade]</a>"; } OUT; if($ir['fedjail']) { $q=$db->query("SELECT * FROM fedjail WHERE fed_userid=$userid"); $r=$db->fetch_row($q); die("<font color=red size=+1>You have been put in the {$set['game_name']} Federal Jail for {$r['fed_days']} day(s). Reason: {$r['fed_reason']}</font></body></html>"); } if(file_exists('ipbans/'.$IP)) { die("<font color=red size=+1>Your IP has been banned from {$set['game_name']}, there is no way around this.</font></body></html>"); } } function menuarea() { include "mainmenu.php"; global $ir,$c; $bgcolor = 'FFFFFF'; print '</td><td width="2" class="linegrad" bgcolor="#'.$bgcolor.'"></td><td width="80%" bgcolor="#'.$bgcolor.'" valign="top"> <center>'; if($ir['hospital']) { print "NB: You are currently in hospital for {$ir['hospital']} minutes. "; } if($ir['jail']) Quote
Paul Evans Posted January 10, 2011 Posted January 10, 2011 print <<<OUT [img=title.jpg] <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" bgcolor="#$bgcolor" valign="top"> [b]Name:[/b] $gn{$u} [{$ir['userid']}] $d [b]Money:[/b] {$fm} [b]Level:[/b] {$ir['level']} [b]Crystals:[/b] {$ir['crystals']} [[url='logout.php']Emergency Logout[/url]] <hr /> [b]Energy:[/b] {$enperc}% <img src=greenbar.png width=$enperc height=10><img src=redbar.png width=$enopp height=10> [b]Will:[/b] {$wiperc}% <img src=bluebar.png width=$wiperc height=10><img src=redbar.png width=$wiopp height=10> [b]Brave:[/b] {$ir['brave']}/{$ir['maxbrave']} <img src=yellowbar.png width=$brperc height=10><img src=redbar.png width=$bropp height=10> [b]EXP:[/b] {$experc}% <img src=navybar.png width=$experc height=10><img src=redbar.png width=$exopp height=10> [b]Health:[/b] {$hpperc}% <img src=greenbar.png width=$hpperc height=10><img src=redbar.png width=$hpopp height=10> <hr /> OUT; if($upgrade == "Y") { print"<a href=upgrade.php>[upgrade]</a>"; } if($ir['fedjail']) { $q=$db->query("SELECT * FROM fedjail WHERE fed_userid=$userid"); $r=$db->fetch_row($q); die("[b]<font color=red size=+1>You have been put in the {$set['game_name']} Federal Jail for {$r['fed_days']} day(s). Reason: {$r['fed_reason']}</font>[/b]</body></html>"); } if(file_exists('ipbans/'.$IP)) { die("[b]<font color=red size=+1>Your IP has been banned from {$set['game_name']}, there is no way around this.</font>[/b]</body></html>"); } } function menuarea() { include "mainmenu.php"; global $ir,$c; $bgcolor = 'FFFFFF'; print '</td><td width="2" class="linegrad" bgcolor="#'.$bgcolor.'"></td><td width="80%" bgcolor="#'.$bgcolor.'" valign="top"> <center>'; if($ir['hospital']) { print "[b]NB:[/b] You are currently in hospital for {$ir['hospital']} minutes. "; } if($ir['jail']) try that Quote
dauninge Posted January 11, 2011 Author Posted January 11, 2011 I tried that before, moving it below the OUT;, but went ahead and did it again. The code still works, but does not print the [upgrade] option anywhere. I did make sure that my exp level is above 100%, so the option should appear, but it is not printing. Thanks! Quote
dauninge Posted January 11, 2011 Author Posted January 11, 2011 OK, I have it working. Sort of. I changed it to: OUT; if($upgrade == "Y") { return "upgrade"; } { print"<a href=upgrade.php>[upgrade]</a>"; } Now the code works and prints the [upgrade] button/option. BUT, it also works if I do this: <img src=greenbar.png width=$hpperc height=10><img src=redbar.png width=$hpopp height=10> <a href=upgrade.php>[upgrade]</a> <hr /> OUT; (totally removed the if($upgrade == "Y") { return "upgrade"; } So, it seems the problem is the if($upgrade == "Y") is not working the way it should, as the upgrade button is always there, and returns the statement "you don't have enough experience to upgrade" when you don't have enough exp. If you do have the required exp, it upgrades you, but I thought the idea of the statement was to only print the option IF there was enough experience to upgrade. Quote
lucky3809 Posted April 9, 2011 Posted April 9, 2011 (edited) Take out... <<<OUT OUT; and replace with print or echo statement... Edited April 9, 2011 by lucky3809 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.