Raised This Month: $32 Target: $400
 8% 

[Dyn Native] ColorChat v0.3.2 (04 jul 2013)


Post New Thread Reply   
 
Thread Tools Display Modes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-27-2012 , 11:23   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #151

You may want to use this : http://forums.alliedmods.net/showpos...1&postcount=14
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Gosc
Junior Member
Join Date: May 2011
Location: Lithuania
Old 02-09-2012 , 14:26   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #152

Quote:
Can i use this to modify Server commands that are showed for example like this?

I've seen that has radio command edited to show with other colors than ^1 can i have an example for how to use it like that...

Thanks
How !?
But it is impossible to be two team colors in one string!
Gosc is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-09-2012 , 14:27   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #153

Quote:
Originally Posted by Gosc View Post
How !?
But it is impossible to be two team colors in one string!
That is white (from con_color "255 255 255"), not the gray you get from spectator color.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 03-27-2012 , 12:22   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #154

Im trying to get colored messages trough rcon but I've got some problems.

After executing rcon saycolor "^3Just ^1a ^4test" and rcon saycolor2 I got that output:


And both of them should be the same.

Test plugin, using a edited version of the stock :
PHP Code:
#include < amxmodx >

enum _:Colors 

    
DONT_CHANGE
    
TERRORIST
    
CT
    
SPECTATOR 
}

new 
g_SayTextg_TeamInfo

public plugin_init( )
{
    
register_plugin"Color test""""" )
    
    
register_srvcmd"saycolor""saycolor" )
    
register_srvcmd"saycolor2""saycolor2" )
    
    
g_SayText get_user_msgid"SayText" )
    
g_TeamInfo get_user_msgid"TeamInfo" )
}

// rcon saycolor "^3Just ^1a ^4test"
public saycolor( )
{
    new 
message192 ]
    
read_argv1messagecharsmaxmessage ) )

    
client_print0print_chat"%s"message )
    
client_print_color0TERRORIST"%s"message )
}

// rcon saycolor2
public saycolor2( )
{
    new 
message[ ] = "^3Just ^1a ^4test"
    
    
client_print0print_chat"%s"message )
    
client_print_color0TERRORIST"%s"message )
}

stock const g_TeamName[Colors][] = 
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

stock client_print_color(idcolor DONT_CHANGE, const msg[], any:...)
{
    
// check if id is different from 0
    
if( id && !is_user_connected(id) )
    {
        return 
0;
    }

    if( 
color SPECTATOR )
    {
        
color DONT_CHANGE;
    }

    new 
message[192];
    
    if( 
color == DONT_CHANGE )
    {
        
message[0] = 0x04;
    }
    else
    {
        
message[0] = 0x03;
    }

    new 
params numargs();
    
// Specific player code
    
if(id)
    {
        if( 
params == )
        {
            
copy(message[1], charsmax(message)-1msg);
        }
        else
        {
            
vformat(message[1], charsmax(message)-1msg4);
        }

        if( 
color )
        {
            new 
team[11]; // store current team so we can restore it
            
get_user_team(idteamcharsmax(team));

            
// set id TeamInfo in consequence
            // so SayText msg gonna show the right color
            
Send_TeamInfo(ididg_TeamName[color]);

            
// Send the message
            
Send_SayText(ididmessage);

            
// restore TeamInfo
            
Send_TeamInfo(ididteam);
        }
        else
        {
            
Send_SayText(ididmessage);
        }
    } 
    
// Send message to all players
    
else
    {
        
// Figure out if at least 1 player is connected
        // so we don't send useless message if not
        // and we gonna use that player as team reference (aka SayText message sender) for color change
        
new players[32], num;
        
get_players(playersnum"ch");
        if( !
num )
        {
            return 
0;
        }

        new 
dummy players[0];

        if( 
params == )
        {
            
copy(message[1], charsmax(message)-1msg);
        }
        else
        {
            
vformat(message[1], charsmax(message)-1msg4);
        }

        if( 
color )
        {
            new 
team[11];
            
get_user_team(dummyteamcharsmax(team));
            
Send_TeamInfo(0dummyg_TeamName[color]);
            
Send_SayText(0dummymessage);
            
Send_TeamInfo(0dummyteam);
        }
        else
        {
            
Send_SayText(0dummymessage);
        }
    }
    return 
1;
}

stock Send_TeamInfo(receiveridteam[])
{
    
message_begin(receiver MSG_ONE_UNRELIABLE MSG_BROADCASTg_TeamInfo, .player=receiver);
    
write_byte(id);
    
write_string(team);
    
message_end();
}

stock Send_SayText(receiveridmessage[])
{
    
message_begin(receiver MSG_ONE_UNRELIABLE MSG_BROADCASTg_SayText, .player=receiver);
    
write_byte(id);
    
write_string(message);
    
message_end();

Any ideas about how I can fix that or get my purpose ?

Thanks
__________________
Javivi is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-27-2012 , 12:29   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #155

Quote:
Originally Posted by Javivi View Post
Im trying to get colored messages trough rcon but I've got some problems.

After executing rcon saycolor "^3Just ^1a ^4test" and rcon saycolor2 I got that output:


And both of them should be the same.

Any ideas about how I can fix that or get my purpose ?

Thanks
You don't understand that ^ are escaped at compile time and not run time.
Therefore, any input string that is not compiled will not recognize ^ as an escape character.
You have to escape the input yourself:

Code:
replace_all(input, charsmax(input), "^^3", "^3");

That will replace all "^3" from an input string with the 0x03 character.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-27-2012 , 12:30   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #156

The escape character only works in code not when passed as an argument (it's just plain text at that point).
__________________
fysiks is online now
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 03-27-2012 , 19:43   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #157

Oh, my bad, I didn't knew that ^ was escaped at compile time.

Fixed, thanks.
__________________
Javivi is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 04-25-2012 , 14:49   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #158

[QUOTE=ConnorMcLeod;851160]
DON'T USE STOCK VERSION, SEEMS TO HAVE PROBLEM WITH ML
I think I found workaround. I use that code and have no problems:
PHP Code:
formatex(msg127"%L"LANG_PLAYER"DICTIONARY_ITEM")
ColorChat(0GREENmsg
--

Also please explain to me what is it: Pro, Con, 'Module Version' and 'real native'?

Last edited by isotonic; 04-25-2012 at 14:50.
isotonic is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-25-2012 , 15:13   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #159

Use the module version, or the fake native, i don't support the stock.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 04-25-2012 , 15:21   Re: [Native/Stock] ColorChat v0.2.1 (28 dec 2010)
Reply With Quote #160

Ok. Could you explain when I should prefer one version to another?
isotonic is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode