Username:    Password:        Click Here To Signup     Forgotten Password
Main Menu
Online
Members: 0

Guests: 11

178.37.x.x news
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
54.198.x.x forum
66.249.x.x forum
93.158.x.x lgsl

Last Seen

Dodgeitorelse Wed 21:08
Wussie Wed 15:58
iiiamirrr Mon 05:48
beshureinme Fri 14:51
goldfishes Fri 23:52

Newest Members

Forums
Gamserver name in color
Melroy
Sun Aug 01 2010, 05:49PM
Posts: 3
Joined: Sun Aug 01 2010, 05:44PM
Registered Member #6194
Dear Richard,

I got multiple CoD4 servers running with a server name uses colors.

For example:
^2Public ^3HC TDM

I made a own php to convert that to HTML:
Public HC TDM (this ia BCC example of the HTML)

However LGSL remove the color recognition, so I have always the server names in black.
How can I undo this?

Thank you very much!

Kind regards,
Melroy van den Berg
Server admin
Website
bartez
Mon Aug 02 2010, 06:34AM
Posts: 3
Joined: Thu Apr 29 2010, 10:22AM
Registered Member #6000
Nie da rady, żaden monitoring serwerów nie wykrywa kolorów w nazwie serwera.
Website
Melroy
Mon Aug 02 2010, 11:16AM
Posts: 3
Joined: Sun Aug 01 2010, 05:44PM
Registered Member #6194
bartez wrote ...

Nie da rady, żaden monitoring serwerów nie wykrywa kolorów w nazwie serwera.


Litość
Website
jebajseti
Mon Sep 05 2011, 06:50AM
Posts: 4
Joined: Tue Oct 12 2010, 02:52PM
Registered Member #6338
yes i would also like that lgsl wouldnt remove that from hostname and players name. In Qgame i did it like that for wolfet:
i made file and add inside that code http://www.text-upload.com/read.php?id=133613&c=5012204(color.php)

then i went for example in example.php
added infront
include 'color.php';

and changed default hostname to echo parse_et($data['sv_hostname']); which used function parse_et from color.php and colored name of server.
and changed default players name to echo parse_et($players['gq_name']); which used function...

how to use color.php now in lgsl? To color hostname and players?
Its all done just need a clue where to include parse_et function to make it work here
Genert
Thu Sep 15 2011, 11:08AM
Posts: 6
Joined: Fri Apr 08 2011, 05:29AM
Registered Member #6691
My code what is used.
This is for Wolfenstein:Enemy Territory.
But since IW is based on Q3,so =)

<?
//-------------------------------------------------------
    
function Q3Colors($str$std "white") {
        
$str ereg_replace("(\^)?$"""$str);
        
$str ereg_replace("\^\^""^"$str);
        
$str "<font color=\"" $std "\">" $str "</font>";
        
        
$color = array (
            
0  => "black",        1  => "red",        2  => "lime",        3  => "yellow",        4  => "blue",        
            
5  => "cyan",        6  => "magenta",    7  => "white",        8  => "orange",        9  => "gray",     
            
            
10 => "#CC9966",    11 => "teal",         12 => "purple",        13 => "#0066CC",    14 => "#6600CC",     
            
15 => "#3399CC",     16 => "#CCFFCC",     17 => "#006633",    18 => "#990033",     19 => "#993333",     
            
20 => "#993300",     21 => "#CC9966",    22 => "#999966",     23 => "#CCCC99",     24 => "#CCCC66",
            
            
"black"        => array (=> "0"=> "p"=> "P"                                            ),
            
"red"        => array (=> "1"=> "q"=> "Q"                                            ),
            
"lime"        => array (=> "2"=> "r"=> "R"                                            ),
            
"yellow"    => array (=> "3"=> "s"=> "S"                                            ),
            
"blue"        => array (=> "4"=> "t"=> "T"=> ">"                                ),
            
"cyan"        => array (=> "5"=> "u"=> "U"                                            ),
            
"magenta"    => array (=> "6"=> "v"=> "V"                                            ),
            
"white"        => array (=> "7"=> "w"=> "W"=> "z"=> "Z"=> "{"=> "["    ),
            
"orange"    => array (=> "8"=> "x"=> "X"                                            ),
            
"gray"        => array (=> "9"=> "y"=> "Y"=> ":"                                ),
            
            
"#CC9966"    => array (=> "a"=> "A"=> "!"=> ","                        ),
            
"teal"        => array (=> "b"=> "B"                                            ),
            
"purple"    => array (=> "c"=> "C"=> "#"                                    ),
            
"#0066CC"    => array (=> "d"=> "D"=> "&"=> "$"                        ),
            
"#6600CC"    => array (=> "e"=> "E"                                            ),
            
"#3399CC"    => array (=> "f"=> "F"                                            ),
            
"#CCFFCC"    => array (=> "g"=> "G"=> "'"                                    ),
            
//Genert - Yes,"<" must be here,kbrblol
            
"#006633"    => array (=> "h"=> "H"=> "("=> "\\"=> "|"=> "<",    ),
            
"#990033"    => array (=> "i"=> "I"=> ")"                                    ),
            
"#993333"    => array (=> "j"=> "J"=> "?"=> "*"=> "_"                ),
            
"#993300"    => array (=> "k"=> "K"=> '"'=> "@"                        ),
            
"#CC9966"    => array (=> "l"=> "L"=> "-"                                    ),
            
"#999966"    => array (=> "m"=> "M"=> "="=> "]"=> "}"                ),
            
"#CCCC99"    => array (=> "n"=> "N"=> "¤"=> "%"=> "."                 ),
            
"#CCCC66"    => array (=> "o"=> "O"=> "/",                                 ),
        );

        
//Genert - Could just be <font>
        
for ($i 0$i count($color) / 2$i++) {
            for (
$j 0$j count($color[$color[$i]]); $j++) {
                
$str str_replace("^"$color[$color[$i]][$j], "</FONT><FONT COLOR=\"" $color[$i] . "\">"$str);
            }
        }
        return 
$str;
    }
//-------------------------------------------------------
?>
roman
Tue Nov 06 2012, 01:27PM
Posts: 10
Joined: Wed Oct 31 2012, 01:52PM
Registered Member #7439
i try make colours for lgsl but it have one problem
replasing work but it dont show colors it show code
JleHuH213
Sun Nov 11 2012, 01:01PM
Posts: 8
Joined: Wed Nov 23 2011, 07:29AM
Registered Member #7010
drawing a conclusion ^ 2Public ^ 3HC TDM servers cod4 ?
roman
Sat Dec 29 2012, 11:42AM
Posts: 10
Joined: Wed Oct 31 2012, 01:52PM
Registered Member #7439
Where php masters?

function check_color($text, $switch)
{
$clr = array ( // colors
"\"#000000\"", "\"#DA0120\"", "\"#00B906\"", "\"#E8FF19\"", // 1
"\"#170BDB\"", "\"#23C2C6\"", "\"#E201DB\"", "\"#FFFFFF\"", // 2
"\"#CA7C27\"", "\"#757575\"", "\"#EB9F53\"", "\"#106F59\"", // 3
"\"#5A134F\"", "\"#035AFF\"", "\"#681EA7\"", "\"#5097C1\"", // 4
"\"#BEDAC4\"", "\"#024D2C\"", "\"#7D081B\"", "\"#90243E\"", // 5
"\"#743313\"", "\"#A7905E\"", "\"#555C26\"", "\"#AEAC97\"", // 6
"\"#C0BF7F\"", "\"#000000\"", "\"#DA0120\"", "\"#00B906\"", // 7
"\"#E8FF19\"", "\"#170BDB\"", "\"#23C2C6\"", "\"#E201DB\"", // 8
"\"#FFFFFF\"", "\"#CA7C27\"", "\"#757575\"", "\"#CC8034\"", // 9
"\"#DBDF70\"", "\"#BBBBBB\"", "\"#747228\"", "\"#993400\"", // 10
"\"#670504\"", "\"#623307\"" // 11
);

if ($switch == 1)
{ // colored string
$search = array (
"/\^0/", "/\^1/", "/\^2/", "/\^3/", // 1
"/\^4/", "/\^5/", "/\^6/", "/\^7/", // 2
"/\^8/", "/\^9/", "/\^a/", "/\^b/", // 3
"/\^c/", "/\^d/", "/\^e/", "/\^f/", // 4
"/\^g/", "/\^h/", "/\^i/", "/\^j/", // 5
"/\^k/", "/\^l/", "/\^m/", "/\^n/", // 6
"/\^o/", "/\^p/", "/\^q/", "/\^r/", // 7
"/\^s/", "/\^t/", "/\^u/", "/\^v/", // 8
"/\^w/", "/\^x/", "/\^y/", "/\^z/", // 9
"/\^\//", "/\^\*/", "/\^\-/", "/\^\+/", // 10
"/\^\?/", "/\^\@/", "/\^</", "/\^>/", // 11
"/\^\&/", "/\^\)/", "/\^\(/", "/\^[A-Z]/", // 12
"/\^\_/", // 14
"/&</", "/^(.*?)<\/font>/" // 15
);

$replace = array (
"&<font color=$clr[0]>", "&<font color=$clr[1]>", // 1
"&<font color=$clr[2]>", "&<font color=$clr[3]>", // 2
"&<font color=$clr[4]>", "&<font color=$clr[5]>", // 3
"&<font color=$clr[6]>", "&<font color=$clr[7]>", // 4
"&<font color=$clr[8]>", "&<font color=$clr[9]>", // 5
"&<font color=$clr[10]>", "&<font color=$clr[11]>", // 6
"&<font color=$clr[12]>", "&<font color=$clr[13]>", // 7
"&<font color=$clr[14]>", "&<font color=$clr[15]>", // 8
"&<font color=$clr[16]>", "&<font color=$clr[17]>", // 9
"&<font color=$clr[18]>", "&<font color=$clr[19]>", // 10
"&<font color=$clr[20]>", "&<font color=$clr[21]>", // 11
"&<font color=$clr[22]>", "&<font color=$clr[23]>", // 12
"&<font color=$clr[24]>", "&<font color=$clr[25]>", // 13
"&<font color=$clr[26]>", "&<font color=$clr[27]>", // 14
"&<font color=$clr[28]>", "&<font color=$clr[29]>", // 15
"&<font color=$clr[30]>", "&<font color=$clr[31]>", // 16
"&<font color=$clr[32]>", "&<font color=$clr[33]>", // 17
"&<font color=$clr[34]>", "&<font color=$clr[35]>", // 18
"&<font color=$clr[36]>", "&<font color=$clr[37]>", // 19
"&<font color=$clr[38]>", "&<font color=$clr[39]>", // 20
"&<font color=$clr[40]>", "&<font color=$clr[41]>", // 21
"", "", "", "", "", "", // 22
"", "</font><", "\$1" // 23
);

$ctext = preg_replace($search, $replace, $text);

if ($ctext != $text)
{
$ctext = preg_replace("/$/", "</font>", $ctext);
}

return $ctext;
}
elseif ($switch == 2)
{ // colored numbers
if ($text <= 39)
{
$ctext = "<font color=$clr[7]>$text</font>";
}
elseif ($text <= 69)
{
$ctext = "<font color=$clr[5]>$text</font>";
}
elseif ($text <= 129)
{
$ctext = "<font color=$clr[8]>$text</font>";
}
elseif ($text <= 399)
{
$ctext = "<font color=$clr[9]>$text</font>";
}
else
{
$ctext = "<font color=$clr[1]>$text</font>";
}

return $ctext;
}
}

its my code i try make colors for players in wolfrtcw but see html code
i dont ideas why it work wrong
help me please
thank you
Wussie
Tue Jan 01 2013, 06:38AM

Posts: 419
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
Hi roman!
I am no php master, but you should know that all values in the $server array, including server and player names, are converted by LGSL with htmlentities() for security reasons. According to tizag.com:
The htmlentities function takes a string and returns the same string with HTML converted into HTML entities. For example, the string "<font>" would be converted to "&lt;font&gt;>".
By converting the < and > into entities, it prevents the browser from using it as an HTML element and it prevents the code from running if you were to display some user's input on your website.

So if you want your script to work, first of all you have to stop using lgsl_parse_color() in lgsl_protocol.php, which I imagine you already have.
Then you have to apply your custom function to server and player names directly, in your lgsl_details.php, just before they get printed on the webpage, something like this:
$output .= '<td> '.check_color($player[$field], 1).' </td>';

Good luck!

Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
roman
Wed Jan 02 2013, 10:58AM
Posts: 10
Joined: Wed Oct 31 2012, 01:52PM
Registered Member #7439
thank you Wussie but it doesnt result
but i confuse )) see screenshot

its make replasing only for server setting value doesnt replase
but code in details doesnt have differense
what you thing about it
Wussie
Wed Jan 02 2013, 06:22PM

Posts: 419
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
Well roman, it looks like you used check_color() in lgsl_protocol.php. DON'T!
Use it in lgsl_details.php instead. You'll have to make the same change for server settings, like this:

$output .= "
<tr>
<td style='{$color}'> {$field} </td>
<td style='{$color}'> ".check_color($value, 1)." </td>
</tr>";


Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
Dodgeitorelse
Wed Jan 02 2013, 06:29PM
Posts: 241
Joined: Sun Dec 12 2010, 09:16AM
Registered Member #6457
at bottom of lgsl_details.php

// SHOW THE SETTINGS

if (empty($server['e']) || !is_array($server['e']))
{
$output .= "
<table cellpadding='4' cellspacing='8' style='margin:auto'>
<tr style='".lgsl_bg(FALSE)."'>
<td><font color='red'> {$lgsl_config['text']['nei']}</font> </td>
</tr>
</table>";
}
else
{
$output .= "
<table cellpadding='4' cellspacing='8' style='margin:auto' border='22' bordercolor='darkgrey'>
<tr style='".lgsl_bg(FALSE)."'>
<td> <b><font color='khaki'>{$lgsl_config['text']['ehs']}</font></b> </td>
<td> <b><font color='khaki'>{$lgsl_config['text']['ehv']}</font></b> </td>
</tr>";

foreach ($server['e'] as $field => $value)
{
$color = lgsl_bg();
if ($field == "hostname")
{
$output .= "
<tr>
<td style='{$color}'> {$field} </td>
<td style='{$color}' ><font color='blue'> {$value} </font></td>
</tr>";
}
else
{
$output .= "
<tr>
<td style='{$color}'> {$field} </td>
<td style='{$color}'> {$value} </td>
</tr>";
}
}

$output .= "
</table>";
}


this code is untested

this is without including or requiring any external files and results in all text for that value to be one color. Could possibly use what wussie said in his last post with an if statement to call out the fields you want the color added to.

Or


I could be totally of course here.


lack of effort on your part requires less effort on my part
Website
roman
Thu Jan 03 2013, 02:03PM
Posts: 10
Joined: Wed Oct 31 2012, 01:52PM
Registered Member #7439
Woohoo it work
Thanks
Jemstar
Mon Sep 08 2014, 05:00AM

Posts: 8
Joined: Sat Sep 06 2014, 07:46AM
Registered Member #8093
Hi I have just set LGSL for our Wolf:ET server.

The below code would be fantastic!!

Where do I place this in my LGSL files,

Thanks for any help,

Jem.


Genert wrote ...

My code what is used.
This is for Wolfenstein:Enemy Territory.
But since IW is based on Q3,so =)

<?
//-------------------------------------------------------
    
function Q3Colors($str$std "white") {
        
$str ereg_replace("(\^)?$"""$str);
        
$str ereg_replace("\^\^""^"$str);
        
$str "<font color=\"" $std "\">" $str "</font>";
        
        
$color = array (
            
0  => "black",        1  => "red",        2  => "lime",        3  => "yellow",        4  => "blue",        
            
5  => "cyan",        6  => "magenta",    7  => "white",        8  => "orange",        9  => "gray",     
            
            
10 => "#CC9966",    11 => "teal",         12 => "purple",        13 => "#0066CC",    14 => "#6600CC",     
            
15 => "#3399CC",     16 => "#CCFFCC",     17 => "#006633",    18 => "#990033",     19 => "#993333",     
            
20 => "#993300",     21 => "#CC9966",    22 => "#999966",     23 => "#CCCC99",     24 => "#CCCC66",
            
            
"black"        => array (=> "0"=> "p"=> "P"                                            ),
            
"red"        => array (=> "1"=> "q"=> "Q"                                            ),
            
"lime"        => array (=> "2"=> "r"=> "R"                                            ),
            
"yellow"    => array (=> "3"=> "s"=> "S"                                            ),
            
"blue"        => array (=> "4"=> "t"=> "T"=> ">"                                ),
            
"cyan"        => array (=> "5"=> "u"=> "U"                                            ),
            
"magenta"    => array (=> "6"=> "v"=> "V"                                            ),
            
"white"        => array (=> "7"=> "w"=> "W"=> "z"=> "Z"=> "{"=> "["    ),
            
"orange"    => array (=> "8"=> "x"=> "X"                                            ),
            
"gray"        => array (=> "9"=> "y"=> "Y"=> ":"                                ),
            
            
"#CC9966"    => array (=> "a"=> "A"=> "!"=> ","                        ),
            
"teal"        => array (=> "b"=> "B"                                            ),
            
"purple"    => array (=> "c"=> "C"=> "#"                                    ),
            
"#0066CC"    => array (=> "d"=> "D"=> "&"=> "$"                        ),
            
"#6600CC"    => array (=> "e"=> "E"                                            ),
            
"#3399CC"    => array (=> "f"=> "F"                                            ),
            
"#CCFFCC"    => array (=> "g"=> "G"=> "'"                                    ),
            
//Genert - Yes,"<" must be here,kbrblol
            
"#006633"    => array (=> "h"=> "H"=> "("=> "\\"=> "|"=> "<",    ),
            
"#990033"    => array (=> "i"=> "I"=> ")"                                    ),
            
"#993333"    => array (=> "j"=> "J"=> "?"=> "*"=> "_"                ),
            
"#993300"    => array (=> "k"=> "K"=> '"'=> "@"                        ),
            
"#CC9966"    => array (=> "l"=> "L"=> "-"                                    ),
            
"#999966"    => array (=> "m"=> "M"=> "="=> "]"=> "}"                ),
            
"#CCCC99"    => array (=> "n"=> "N"=> "¤"=> "%"=> "."                 ),
            
"#CCCC66"    => array (=> "o"=> "O"=> "/",                                 ),
        );

        
//Genert - Could just be <font>
        
for ($i 0$i count($color) / 2$i++) {
            for (
$j 0$j count($color[$color[$i]]); $j++) {
                
$str str_replace("^"$color[$color[$i]][$j], "</FONT><FONT COLOR=\"" $color[$i] . "\">"$str);
            }
        }
        return 
$str;
    }
//-------------------------------------------------------
?>


Website
Wussie
Sat Sep 13 2014, 09:55AM

Posts: 419
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
First thing you have to do if you want colors is to make sure you DON'T use the function lgsl_parse_color($data_key, "1"), which removes all colorcodes by default.
So you have to edit lgsl_protocol.php, find
$data_key = strtolower(lgsl_parse_color($data_key, "1"));
$server['e'][$data_key] = lgsl_parse_color($item[$item_key+1], "1");
and replace with
$data_key = strtolower($data_key);
$server['e'][$data_key] = $item[$item_key+1];

Then find
$server['p'][$player_key]['name'] = lgsl_parse_color($server['p'][$player_key]['name'], "1");
and replace with
// $server['p'][$player_key]['name'] = lgsl_parse_color($server['p'][$player_key]['name'], "1");


Then you insert Genert's code at the beginning of lgsl_details.php, then further down you look for $server['s']['name'] and replace it with Q3Colors($server['s']['name']).

If the function Q3Colors() is correctly implemented, server names should be printed in color for Wolf:ET, provided that they contain colorcodes. Test and see if it works.
I case of success, you could do the same with player names $player[$field].

Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
Jemstar
Sat Sep 13 2014, 11:01AM

Posts: 8
Joined: Sat Sep 06 2014, 07:46AM
Registered Member #8093
Hey thanks Wussie!

First attempt didn't work properly. Just showed server and player names in Wolf:ET color codes but still in white!!
i.e ^m|*^1BS^m*|^1BLOOD^mSQUAD^9CLAN

I hadn't edited the player names $player[$field] yet. It appears a lot (39 times) in lgsl_details.php, would they all need to be changed?

I will try again tomorrow, very late atm and i am tired lol but I thank you very much for your help.

Jem.
Website
Wussie
Sun Sep 14 2014, 11:59AM

Posts: 419
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
Hey, my bad! It should be Q3Colors($server['s']['name'], "") and Q3Colors($player[$field], "").

And there is only one $player[$field] in lgsl_details.php, not 39. Make sure you edit the php file on the server, don't view the page source in your browser!

You're welcome.

Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
Jemstar
Wed Sep 17 2014, 05:36AM

Posts: 8
Joined: Sat Sep 06 2014, 07:46AM
Registered Member #8093
Thanks again,

I put genert's code directly under:

require "lgsl_class.php";


Without the
<?php
!

Still not working..may be website's template interferring..all text on my website is white!!

It's no biggy just would have been good in color!

Thanks for ur help Wussie, I will keeep trying things,

Jem.
Website
Wussie
Wed Sep 17 2014, 10:05AM

Posts: 419
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
I can confirm that Genert's code is indeed working with LGSL 5.8 Standalone, haven't tried with other versions.
It will work for you if implemented correctly, including the Q3Colors($server['s']['name'], "") and Q3Colors($player[$field], "").

You say all text is white. Do server names still show colorcodes like ^6cool^3server or not?

Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
Jemstar
Thu Sep 18 2014, 03:41AM

Posts: 8
Joined: Sat Sep 06 2014, 07:46AM
Registered Member #8093
It did the have the server name in color codes the first time I tried but since it's only player names in color code. But both are in white.

I also tried genert's code in it's own .php file and added
require "color.php"; under require "lgsl_class.php";

But no joy either.

I have tried replacing details.php and protocol.php from my dl folder incase I had accidently corrupted the files but always player names in code and server name no change. Also messes up the template on the extedned details page ie if you click on map to show server details.
Website
Go to page       >>   

Jump:     Back to top


You are not logged in - Click Here To Signup

Username:    Password:   

Mini Buttons

.... © GreyCube.com - Richard Perry - Powered by e107.org