Jump to content
MakeWebGames

Recommended Posts

Posted

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.

Posted

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="donator.gif"; }

 

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!

Posted

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..)

Posted

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...