Saberman Posted August 21, 2009 Posted August 21, 2009 does anyone know how this would be modified so the user_level 2 have red name and user_level 3 has purple and user_level 4 has orange and user_level 5 has pink Quote
Dave Posted August 21, 2009 Posted August 21, 2009 Re: user_level colours does anyone know how this would be modified so the user_level 2 have red name and user_level 3 has purple and user_level 4 has orange and user_level 5 has pink If you user a function to print out your usernames (Such as using Username($userid) instead of just using $ir['username']) this is very easy and just involves modifying the function, But if your not there are other ways you could attempt to do it globally on your game such as in the globals checking like this.... if($r['user_level'] == 2) { $r['username'] = "<span style="color:red">".$r['username']."</span>"; } else { $r['username'] = $r['username']; } No idea if this will work but i suppose its worth a try... I use $r because i beleive Mccode uses that on most pages (Viewuser and so on). Report back if it works :) Quote
POG1 Posted August 21, 2009 Posted August 21, 2009 Re: user_level colours i once create a function and posted it here. try and use the search ;) Quote
Saberman Posted August 21, 2009 Author Posted August 21, 2009 Re: user_level colours does anyone know how this would be modified so the user_level 2 have red name and user_level 3 has purple and user_level 4 has orange and user_level 5 has pink If you user a function to print out your usernames (Such as using Username($userid) instead of just using $ir['username']) this is very easy and just involves modifying the function, But if your not there are other ways you could attempt to do it globally on your game such as in the globals checking like this.... if($r['user_level'] == 2) { $r['username'] = "<span style="color:red">".$r['username']."</span>"; } else { $r['username'] = $r['username']; } No idea if this will work but i suppose its worth a try... I use $r because i beleive Mccode uses that on most pages (Viewuser and so on). Report back if it works :) that didnt work this is how my current one looks like echo sprintf("Name: %s [%s] %s ", ($r['donatordays']) ? '<span style="color: blue;">'.stripslashes($r['username']).'</span>' : stripslashes($r['username']), number_format($r['userid']), ($r['donatordays']) ? '[img=donator.gif]' : ''); Quote
POG1 Posted August 21, 2009 Posted August 21, 2009 Re: user_level colours function formattedName($userid) { $result = mysql_query(sprintf("SELECT `username`,`userid`,`user_level`,`donatordays` FROM `users` WHERE `userid` = %u;",$userid)); if(mysql_num_rows($result)) { $player = mysql_fetch_array($result,MYSQL_ASSOC); $type = 'player'; if($player['donatordays'] > 0) { $type = 'donator'; } if($player['user_level'] == 2) { $type = 'admin'; } elseif($player['user_level'] == 5) { $type = 'assistant'; } return '[url="viewuser?u='.$player['userid'].'"]'.$player['username'].'[/url]'; } else { return false; } } You just need to add the CSS classes :) Quote
Danny696 Posted August 21, 2009 Posted August 21, 2009 Re: user_level colours lol what happened to the secs? 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.