Raised This Month: $51 Target: $400
 12% 

cant understand chatcolor..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Adomaz1
Senior Member
Join Date: Feb 2014
Old 02-04-2015 , 15:04   cant understand chatcolor..
Reply With Quote #1

hello, i'm writing like the fifth time about chatcolor... I can't get it working, it always shows !gMessage.. I added the #include <chatcolor>, changed the client_print to ColorChat and print_chat to NORMAL, but it doesnt work.. I could paste the code, but in the galileo code there are like 3000 lines.. Is there a tutorial or something?
Adomaz1 is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 02-04-2015 , 18:41   Re: cant understand chatcolor..
Reply With Quote #2

did you mean include -> ColorChat ? because there is a chatcolor & ColorChat .

Last edited by Freezo Begin; 02-04-2015 at 18:42.
Freezo Begin is offline
Xunfop
Member
Join Date: Mar 2012
Location: 97Club
Old 02-04-2015 , 20:03   Re: cant understand chatcolor..
Reply With Quote #3

Replace !n, !t and !g to
^1 - Yellow
^3 - TeamColor
^4 - Green
Xunfop is offline
Adomaz1
Senior Member
Join Date: Feb 2014
Old 02-05-2015 , 04:27   Re: cant understand chatcolor..
Reply With Quote #4

I'm using this: https://forums.alliedmods.net/showthread.php?t=94960, and i wroted the include as chatcolor, because it doesnt work when I rewrote it to colorchat, it doesnt find it
Adomaz1 is offline
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 02-05-2015 , 05:52   Re: cant understand chatcolor..
Reply With Quote #5

use newest dev build, then #include <ColorChat>, then type where you want:
PHP Code:
ColorChat(idGREEN"[TEST]^x01 Normal color^x03 Team color^x04 Green color"
Color chat inc
PHP Code:
//ColorChat(id, GREEN,"[Cosik]^x01 A nic");
#define MAXSLOTS 32

enum Color{
    
YELLOW 1// Yellow
    
GREEN// Green Color
    
TEAM_COLOR// Red, grey, blue
    
GREY// grey
    
RED// Red
    
BLUE// Blue
}
new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

public 
ColorChat(idColor:type, const msg[], {Float,Sql,Result,_}:...)
{
    static 
message[256];

    switch(
type)
    {
        case 
YELLOW:{ // Yellow
        
            
message[0] = 0x01;
        }
        case 
GREEN:{// Green

            
message[0] = 0x04;
        }
        default:{ 
// White, Red, Blue
            
message[0] = 0x03;
        }
    }
    
vformat(message[1], 251msg4);

    
// Make sure message is not longer than 192 character. Will crash the server.
    
message[192] = '^0';
    new 
teamColorChangeindexMSG_Type;
    if(!
id)    {
        
index FindPlayer();
        
MSG_Type MSG_ALL;
    } else {
        
MSG_Type MSG_ONE;
        
index id;
    }
    
team get_user_team(index);    
    
ColorChange ColorSelection(indexMSG_Typetype);
    
ShowColorMessage(indexMSG_Typemessage);
    if(
ColorChange){
        
Team_Info(indexMSG_TypeTeamName[team]);
    }
}

ShowColorMessage(idtypemessage[]){
    
message_begin(type76_id);
    
write_byte(id)        
    
write_string(message);
    
message_end();    
}

Team_Info(idtypeteam[]){
    
message_begin(type86_id);
    
write_byte(id);
    
write_string(team);
    
message_end();
    return 
1;
}

ColorSelection(indextypeColor:Type){
    switch(
Type)    {
        case 
RED:        {
            return 
Team_Info(indextypeTeamName[1]);
        }
        case 
BLUE:        {
            return 
Team_Info(indextypeTeamName[2]);
        }
        case 
GREY:        {
            return 
Team_Info(indextypeTeamName[0]);
        }
    }
    return 
0;
}

FindPlayer(){
    new 
= -1;
    while(
<= MAXSLOTS){
        if(
is_user_connected(++i)){
            return 
i;
        }
    }

    return -
1;


Last edited by grs4; 02-05-2015 at 05:53.
grs4 is offline
Adomaz1
Senior Member
Join Date: Feb 2014
Old 02-05-2015 , 06:41   Re: cant understand chatcolor..
Reply With Quote #6

It still shows the same.. x03Messagex01

what is the problem?

PHP Code:
ColorChat(idGREEN"^x03%L"idLANG_PLAYER"GAL_CHOICE_EXTEND"); 

Last edited by Adomaz1; 02-05-2015 at 06:43.
Adomaz1 is offline
grs4
Senior Member
Join Date: Dec 2010
Location: Poland
Old 02-05-2015 , 07:39   Re: cant understand chatcolor..
Reply With Quote #7

you are using amxx 1.8.3 ? if yes, you have to use this:

client_print_color
(index, sender, const fmt[], any:...)
register_dictionary_colored(const filename[]
)
it means that you have to register dictionary using this function (regist..dic..colo...) and if you want to print message from Multilangual, you have to use this:
client_prnt_clr, where "sender" is id of player who is sending, and index is id of player who have to see this message, if you want to show everyone, type 0 . If im telling stupid things then someone tell plz.

if no, use stock.

PHP Code:
http://www.amxmodx.org/api/amxmodx/client_print_color 

Last edited by grs4; 02-05-2015 at 07:40.
grs4 is offline
Adomaz1
Senior Member
Join Date: Feb 2014
Old 02-05-2015 , 08:05   Re: cant understand chatcolor..
Reply With Quote #8

thanks for the help. its working now.
Adomaz1 is offline
Adomaz1
Senior Member
Join Date: Feb 2014
Old 02-07-2015 , 09:02   Re: cant understand chatcolor..
Reply With Quote #9

I can't get multilanguage colors to work...

colorchat.inc
PHP Code:
#if defined _colorchat_included
  #endinput
#endif
#define _colorchat_included

/* ColorChat Support */
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color
/* ColorChat Support */

enum {
    
Grey 33,
    
Red,
    
Blue
};

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

    static const 
szTeamName[][] = 
    {
        
"",
        
"TERRORIST",
        
"CT"
    
};

    new 
szMessage[192];

    new 
iParams numargs();
    
// Specific player code
    
if( id )
    {
        if( 
iParams == )
        {
            
copy(szMessagecharsmax(szMessage), fmt); // copy so message length doesn't exceed critical 192 value
        
}
        else
        {
            
vformat(szMessagecharsmax(szMessage), fmt4);
        }

        if( 
sender Grey )
        {
            if( 
sender Blue )
            {
                
sender id;
            }
            else
            {
                
_CC_TeamInfo(idsenderszTeamName[sender-Grey]);
            }
        }
        
_CC_SayText(idsenderszMessage);
    } 

    
// Send message to all players
    
else
    {
        
// Figure out if at least 1 player is connected
        // so we don't execute useless useless code if not
        
new iPlayers[32], iNum;
        
get_players(iPlayersiNum"ch");
        if( !
iNum )
        {
            return 
0;
        }

        new 
iMlNumberij;
        new Array:
aStoreML ArrayCreate();
        if( 
iParams >= // ML can be used
        
{
            for(
j=3j<iParamsj++)
            {
                
// retrieve original param value and check if it's LANG_PLAYER value
                
if( getarg(j) == LANG_PLAYER )
                {
                    
i=0;
                    
// as LANG_PLAYER == -1, check if next parm string is a registered language translation
                    
while( ( szMessage] = getarg1i++ ) ) ) {}
                    if( 
GetLangTransKey(szMessage) != TransKey_Bad )
                    {
                        
// Store that arg as LANG_PLAYER so we can alter it later
                        
ArrayPushCell(aStoreMLj++);

                        
// Update ML array saire so we'll know 1st if ML is used,
                        // 2nd how many args we have to alterate
                        
iMlNumber++;
                    }
                }
            }
        }

        
// If arraysize == 0, ML is not used
        // we can only send 1 MSG_ALL message if sender != 0
        
if( !iMlNumber )
        {
            if( 
iParams == )
            {
                
copy(szMessagecharsmax(szMessage), fmt);
            }
            else
            {
                
vformat(szMessagecharsmax(szMessage), fmt4);
            }
            if( 
sender Blue // if 0 is passed, need to loop
            
{
                if( 
sender Grey )
                {
                    
_CC_TeamInfo(0senderszTeamName[sender-Grey]);
                }
                
_CC_SayText(0senderszMessage);
                return 
1;
            }
        }

        if( 
sender Blue )
        {
            
sender 0// use receiver index
        
}

        for(--
iNumiNum>=0iNum--)
        {
            
id iPlayers[iNum];

            if( 
iMlNumber )
            {
                for(
j=0j<iMlNumberj++)
                {
                    
// Set all LANG_PLAYER args to player index ( = id )
                    // so we can format the text for that specific player
                    
setarg(ArrayGetCell(aStoreMLj), _id);
                }
                
                
// format string for specific player
                
vformat(szMessagecharsmax(szMessage), fmt4);
            }

            if( 
sender Grey )
            {
                
_CC_TeamInfo(idsenderszTeamName[sender-Grey]);
            }
            
_CC_SayText(idsenderszMessage);
        }

        
ArrayDestroy(aStoreML);
    }
    return 
1;
}

stock _CC_TeamInfo(iReceiveriSenderszTeam[])
{
    static 
iTeamInfo 0;
    if( !
iTeamInfo )
    {
        
iTeamInfo get_user_msgid("TeamInfo");
    }
    
message_begin(iReceiver MSG_ONE MSG_ALLiTeamInfo_iReceiver);
    
write_byte(iSender);
    
write_string(szTeam);
    
message_end();
}

stock _CC_SayText(iReceiveriSenderszMessage[])
{
    static 
iSayText 0;
    if( !
iSayText )
    {
        
iSayText get_user_msgid("SayText");
    }
    
message_begin(iReceiver MSG_ONE MSG_ALLiSayText_iReceiver);
    
write_byte(iSender iSender iReceiver);
    
write_string(szMessage);
    
message_end();
}

stock register_dictionary_colored(const filename[])
{
    if( !
register_dictionary(filename) )
    {
        return 
0;
    }

    new 
szFileName[256];
    
get_localinfo("amxx_datadir"szFileNamecharsmax(szFileName));
    
format(szFileNamecharsmax(szFileName), "%s/lang/%s"szFileNamefilename);
    new 
fp fopen(szFileName"rt");
    if( !
fp )
    {
        
log_amx("Failed to open %s"szFileName);
        return 
0;
    }

    new 
szBuffer[512], szLang[3], szKey[64], szTranslation[256], TransKey:iKey;

    while( !
feof(fp) )
    {
        
fgets(fpszBuffercharsmax(szBuffer));
        
trim(szBuffer);

        if( 
szBuffer[0] == '[' )
        {
            
strtok(szBuffer[1], szLangcharsmax(szLang), szBuffer1']');
        }
        else if( 
szBuffer[0] )
        {
            
strbreak(szBufferszKeycharsmax(szKey), szTranslationcharsmax(szTranslation));
            
iKey GetLangTransKey(szKey);
            if( 
iKey != TransKey_Bad )
            {
                
replace_all(szTranslationcharsmax(szTranslation), "!g""^4");
                
replace_all(szTranslationcharsmax(szTranslation), "!t""^3");
                
replace_all(szTranslationcharsmax(szTranslation), "!n""^1");
                
AddTranslation(szLangiKeyszTranslation[2]);
            }
        }
    }
    
    
fclose(fp);
    return 
1;

I added the #include <colorchat>

replaced register_dictionary to register_dictionary_colored, and client_print to client_print_color and it doesn't work

the line:

PHP Code:
client_print_color(idid"%L"id"GAL_CHOICE_MAP"g_mapChoice[key]); 
PHP Code:
GAL_CHOICE_MAP Tu pasirinkai zemelapi !t%s!n
EDIT:

FINALLY FIXED! I downloaded this include again: https://forums.alliedmods.net/showthread.php?t=94960

added the #include <chatcolor>

rewrited the two lines:

register_dictionary(map.txt) ------> register_dictionary_colored

and

client_print -------------> client_print_color, then rewrited print_chat to Red, but it didn't do anything.. xD

thanks for the help.

Last edited by Adomaz1; 02-08-2015 at 04:33.
Adomaz1 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 01:56.


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