Maniak Posted February 28, 2010 Share Posted February 28, 2010 In my header.php how do I make the different User Levels have different colour names? I have tried a few things, but when I do, it either doesn't work; or it Errors coding somewhere else in my Script. Quote Link to comment Share on other sites More sharing options...
Nicholas Posted February 28, 2010 Share Posted February 28, 2010 not sure if this is correct, i dont use this but wouldnt it be something like this? (not sure where to add it tho sorry) but maybe pasting it over this line? $u=$ir['username']; if($ir['donatordays']) { $u = "<font color=red>{$ir['username']}</font>";$d=""; } if($r['user_level'] == 2) { $user="<font color=gold>{$r['username']}</font>"; } else if($r['user_level'] == 3) { $user="<font color=green>{$r['username']}</font>"; } else if($r['user_level'] == 4) { $user="<font color=blue>{$r['username']}</font>"; } else if($r['user_level'] == 5) { $user="<font color=yellow>{$r['username']}</font>"; } else if($r['user_level'] == 6) { $user="<font color=purple>{$r['username']}</font>"; } else if($r['donatordays'] > 0) { $user="<font color=red>{$r['username']}</font>"; } else { $user="{$r['username']}"; } then put this where you want the username to display? $user ($r, is for when other people see the username, if thats understandable lol) or $user ($ir, is for when the actual player see thats name, if thats understandable lol) REMEMBER, ITS NOT TESTED, SO BACK UP THE FILE FIRST! Quote Link to comment Share on other sites More sharing options...
Maniak Posted February 28, 2010 Author Share Posted February 28, 2010 I tried something a long the lines of that, and it messed up the coding when I attacked someone :S Quote Link to comment Share on other sites More sharing options...
Nicholas Posted February 28, 2010 Share Posted February 28, 2010 oh, ill try and do some research ok, incase some the good coders dont look at this page. Quote Link to comment Share on other sites More sharing options...
Maniak Posted February 28, 2010 Author Share Posted February 28, 2010 Thanks, i've tried this as well, but it doesn't work :S $mycolor=""; if($ir['user_level'] == 2) { $mycolor="blue"; } if($ir['user_level'] == 1 && $ir['donatordays'] == 0) { $mycolor="orange"; } if($ir['user_level'] == 1 && $ir['donatordays'] > 0) { $mycolor="yellow"; } if($ir['user_level'] == 4) { $mycolor="red"; } if($ir['user_level'] == 3) { $mycolor="green"; } if($ir['user_level'] == 5) { $mycolor="purple"; } And then put <font color=$mycolor>{$ir['username']}</font> where I want th username to be. (I can't remember if that is the exact coding..) Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted March 2, 2010 Share Posted March 2, 2010 Something like $colour = array ( 1 => 'orange', 2 => 'red', 3 => 'green', 5 => 'purple' ); foreach ( array_keys($colour) as $key) { if ( $ir['user_level'] == $key ) { $mycolor = $colour[$key]; } elseif ( !empty($ir['donatordays']) ) { $mycolor = 'blue'; } else { $mycolor = ''; } maybe? Quote Link to comment Share on other sites More sharing options...
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.