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

Rage SubModule: ColorChat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-21-2012 , 09:35   Rage SubModule: ColorChat
Reply With Quote #1

ColorChat



.: Description :.


Finally a real native for colorchat.



.: Natives :.

  • client_print_color(id, color=DontChange, const fmt[], any:...)
  • client_print_color2(id, sender, const fmt[], any:...)
    Same as client_print_color excepted you set team color according to sender index


.: Stock :.

  • register_dictionary_colored(const filename[])
    Same as register_dictionary, but transform !g, !t and !n into colors code
    so you can use same ML Keys in normal chat or hudmessage or whereever you want
    It's not required at all to use this, you can directly put in a UTF-8 WITHOUT BOM file, 1 3 and 4,
    for this, use npp and hit Alt + corresponding key (1 2 or 4), you should respectively see (SOH) (ETX) and (EOT).
    if you still want to use !n !g and !t, use this stock and enjoy the compiled plugin increased size


.: Notes :.


You can find usage example on ColorChat fake native thread



.: Requirements :.


You need the Rage Module to be loaded in order the submodule work.



Attached Files
File Type: inc colorchat.inc (2.1 KB, 2371 views)
File Type: zip COLORCHAT_BINS_AND_SIGS.zip (84.8 KB, 2275 views)
File Type: zip COLORCHAT_SRC.zip (108.5 KB, 2006 views)
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-23-2012 at 06:42.
ConnorMcLeod is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 04-21-2012 , 10:55   Re: Rage SubModule: ColorChat
Reply With Quote #2

Nice job!
__________________
kiki33hun is offline
iBrazilian
Senior Member
Join Date: May 2011
Old 04-21-2012 , 12:28   Re: Rage SubModule: ColorChat
Reply With Quote #3

Great job with this Connor!
__________________
Pokemod Season 5 [ |||||||||| Complete]
iBrazilian is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-21-2012 , 20:09   Re: Rage SubModule: ColorChat
Reply With Quote #4

Question,

becuase with the other version without Rage, it had problems with ^n.
Is it fixed with this?
__________________
Retired.
Xalus is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-21-2012 , 20:34   Re: Rage SubModule: ColorChat
Reply With Quote #5

What you mean ^n ???
In .sma you have to pass ^1 ^3 and ^4, and in ML file, either you directly use 1 3 4 (see first post), either you use !n !g and !t and then you need to use register_dictionary_colored.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 04-22-2012 , 01:53   Re: Rage SubModule: ColorChat
Reply With Quote #6

nice connor,
but i write it into the amxmodx_mm, I think that will be more efficient than your(at least for me)

PHP Code:
static cell AMX_NATIVE_CALL client_print_color(AMX *amxcell *params)
{
    if (
params[2] < || params[2] > 3)
    {
        
LogError(amxAMX_ERR_NATIVE"Invalid color index %d"params[2]);
        return 
0;
    }
    
int len;
    
char *msg;
    if (
params[1] ==0)
    {
        for (
int i 1<= gpGlobals->maxClients; ++i)
        {
            
CPlayer *pPlayer GET_PLAYER_POINTER_I(i);
            if (
pPlayer->ingame)
            {
                
g_langMngr.SetDefLang(i);
                
msg format_amxstring(amxparams3len);
                
msg[len++] = '\n';
                
msg[len] = 0;
                if (
params[2])
                {
                    const 
char szTeamName[4][16] = 
                    {
                         
"",
                         
"TERRORIST",
                         
"CT",
                         
"SPECTATOR"
                    
};
                    
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgTeamInfoNULLpPlayer->pEdict);
                        
WRITE_BYTE(i);
                        
WRITE_STRING(szTeamName[params[2]]);
                    
MESSAGE_END();
                }
                
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgSayTextNULLpPlayer->pEdict);
                    
WRITE_BYTE(i);
                    
WRITE_STRING(msg);
                
MESSAGE_END();
            }
        }
    }else
    {
        
int index params[1];
 
        if (
index || index gpGlobals->maxClients)
        {
            
LogError(amxAMX_ERR_NATIVE"Invalid player id %d"index);
            return 
0;
        }
        
CPlayer *pPlayer GET_PLAYER_POINTER_I(index);
        if (
pPlayer->ingame)
        {
            
g_langMngr.SetDefLang(index);
            
msg format_amxstring(amxparams3len);
            
msg[len++] = '\n';
            
msg[len] = 0;
            if (
params[2])
            {
                const 
char szTeamName[4][16] = 
                {
                    
"",
                    
"TERRORIST",
                    
"CT",
                    
"SPECTATOR"
                
};
                
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgTeamInfoNULLpPlayer->pEdict);
                    
WRITE_BYTE(index);
                    
WRITE_STRING(szTeamName[params[2]]);
                
MESSAGE_END();
            }
            
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgSayTextNULLpPlayer->pEdict);
                
WRITE_BYTE(index);
                
WRITE_STRING(msg);
            
MESSAGE_END();
        }
    }
    return 
len;
}; 
__________________
QQ:116268742

Last edited by K.K.Lv; 04-22-2012 at 02:34.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-22-2012 , 02:01   Re: Rage SubModule: ColorChat
Reply With Quote #7

Quote:
Originally Posted by K.K.Lv View Post
nice connor,
but i write it into the amxmodx_mm, I think that will be more efficient than your(at least for me)
Sorry offtopic.
Private or public? if public can you share to us? wanna try too.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 04-22-2012 , 02:32   Re: Rage SubModule: ColorChat
Reply With Quote #8

Quote:
Originally Posted by yokomo View Post
Sorry offtopic.
Private or public? if public can you share to us? wanna try too.
I have edit my post, please see the code
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-22-2012 , 03:23   Re: Rage SubModule: ColorChat
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
What you mean ^n ???
In .sma you have to pass ^1 ^3 and ^4, and in ML file, either you directly use 1 3 4 (see first post), either you use !n !g and !t and then you need to use register_dictionary_colored.
^n -> Space in hudmessages,
If U added that in ML file, with ur register_dictionary_colored, it didn't show,
So there wasn't a space.
__________________
Retired.
Xalus is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-22-2012 , 05:03   Re: Rage SubModule: ColorChat
Reply With Quote #10

Quote:
Originally Posted by Xalus View Post
^n -> Space in hudmessages,
If U added that in ML file, with ur register_dictionary_colored, it didn't show,
So there wasn't a space.

Didn't know, should be the same with that version.
So you mean hudmessages are broken after you use register_dictionary_colored on a ml file ?

Edit : Just had an idea, i you know that a file will be proceeded with register_dictionary_colored, try to change all ^n with ^^n, i think the problem may be that strings are formated 2 times.



Quote:
Originally Posted by K.K.Lv View Post
nice connor,
but i write it into the amxmodx_mm, I think that will be more efficient than your(at least for me)

PHP Code:
static cell AMX_NATIVE_CALL client_print_color(AMX *amxcell *params)
{
    if (
params[2] < || params[2] > 3)
    {
        
LogError(amxAMX_ERR_NATIVE"Invalid color index %d"params[2]);
        return 
0;
    }
    
int len;
    
char *msg;
    if (
params[1] ==0)
    {
        for (
int i 1<= gpGlobals->maxClients; ++i)
        {
            
CPlayer *pPlayer GET_PLAYER_POINTER_I(i);
            if (
pPlayer->ingame)
            {
                
g_langMngr.SetDefLang(i);
                
msg format_amxstring(amxparams3len);
                
msg[len++] = '\n';
                
msg[len] = 0;
                if (
params[2])
                {
                    const 
char szTeamName[4][16] = 
                    {
                         
"",
                         
"TERRORIST",
                         
"CT",
                         
"SPECTATOR"
                    
};
                    
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgTeamInfoNULLpPlayer->pEdict);
                        
WRITE_BYTE(i);
                        
WRITE_STRING(szTeamName[params[2]]);
                    
MESSAGE_END();
                }
                
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgSayTextNULLpPlayer->pEdict);
                    
WRITE_BYTE(i);
                    
WRITE_STRING(msg);
                
MESSAGE_END();
            }
        }
    }else
    {
        
int index params[1];
 
        if (
index || index gpGlobals->maxClients)
        {
            
LogError(amxAMX_ERR_NATIVE"Invalid player id %d"index);
            return 
0;
        }
        
CPlayer *pPlayer GET_PLAYER_POINTER_I(index);
        if (
pPlayer->ingame)
        {
            
g_langMngr.SetDefLang(index);
            
msg format_amxstring(amxparams3len);
            
msg[len++] = '\n';
            
msg[len] = 0;
            if (
params[2])
            {
                const 
char szTeamName[4][16] = 
                {
                    
"",
                    
"TERRORIST",
                    
"CT",
                    
"SPECTATOR"
                
};
                
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgTeamInfoNULLpPlayer->pEdict);
                    
WRITE_BYTE(index);
                    
WRITE_STRING(szTeamName[params[2]]);
                
MESSAGE_END();
            }
            
MESSAGE_BEGIN(MSG_ONE_UNRELIABLEgmsgSayTextNULLpPlayer->pEdict);
                
WRITE_BYTE(index);
                
WRITE_STRING(msg);
            
MESSAGE_END();
        }
    }
    return 
len;
}; 
Why would it be more efficient ?
Your way gonna change players place in scoreboard (only for themselves but still), also you should make sure the message length is 191 max.
Anyway you would have to recompile any new amxx update.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-24-2012 at 19:05.
ConnorMcLeod 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 21:50.


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