Raised This Month: $89 Target: $400
 22% 

Doubt Chromchat vs ColorChat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Senior Member
Join Date: Sep 2016
Old 11-05-2018 , 03:10   Doubt Chromchat vs ColorChat
Reply With Quote #1

How cromchat is better than normal colorchat include? how that effect i want to know.

Chromchat
PHP Code:
#if defined _cromchat_included
    #endinput
#endif

#define _cromchat_included

#if !defined CC_DONT_OVERWRITE_183_PRINT
    #define client_print_color CC_SendMatched
    #define print_team_default CC_COLOR_TEAM
    #define print_team_grey CC_COLOR_GREY
    #define print_team_blue CC_COLOR_BLUE
    #define print_team_red CC_COLOR_RED
#endif

#if !defined CC_DONT_OVERWRITE_COLORCHAT
    #define ColorChat CC_SendMatched
    #define NORMAL CC_COLOR_TEAM
    #define TEAM_COLOR CC_COLOR_TEAM
    #define GREEN CC_COLOR_TEAM
    #define GREY CC_COLOR_GREY
    #define BLUE CC_COLOR_BLUE
    #define RED CC_COLOR_RED
#endif

#if !defined CC_DONT_OVERWRITE_ACTIVITY
    #define show_activity CC_ShowActivity
    #define show_activity_id CC_ShowActivityId
    #define show_activity_key CC_ShowActivityKey
#endif

#define CC_VERSION                     2.1
#define CC_MAX_TEAM_SIZE             10
#define CC_MAX_ACT_PREFIX_SIZE         10
#define CC_MAX_PLAYERS                 32
#define CC_MAX_PREFIX_SIZE             64
#define CC_MAX_MESSAGE_SIZE         188
#define CC_FILTERING_FLAGS            "ch"
#define CromChat                     CC_SendMessage

#if !defined CC_COLORS_TYPE
    #define CC_COLORS_TYPE CC_COLORS_CROMCHAT
#endif

#if !defined CC_ACTIVITY_FLAG
    #define CC_ACTIVITY_FLAG -1
#endif

#if !defined CC_ACTIVITY_PREFIX_PLAYER
    #define CC_ACTIVITY_PREFIX_PLAYER "PLAYER"
#endif

#if !defined CC_ACTIVITY_PREFIX_ADMIN
    #define CC_ACTIVITY_PREFIX_ADMIN "ADMIN"
#endif

enum
{
    
CC_COLOR_TEAM         0,
    
CC_COLOR_GREY         = -1,
    
CC_COLOR_WHITE         = -1,
    
CC_COLOR_BLUE         = -2,
    
CC_COLOR_RED         = -3
}

enum
{
    
CC_COLORS_CROMCHAT,
    
CC_COLORS_SHORT,
    
CC_COLORS_NAMED,
    
CC_COLORS_NAMED_SHORT,
    
CC_COLORS_STANDARD,
    
CC_COLORS_CUSTOM
}

#define CC_SYM_MENU_YELLOW             "\y"
#define CC_SYM_MENU_WHITE             "\w"
#define CC_SYM_MENU_GREY             "\d"
#define CC_SYM_MENU_RIGHT             "\R"

#define CC_SYM_CHAT_DEF_NORMAL         "^x01"
#define CC_SYM_CHAT_DEF_TEAM         "^x03"
#define CC_SYM_CHAT_DEF_GREEN         "^x04"

#define CC_SYM_TEAM_T                 "TERRORIST"
#define CC_SYM_TEAM_CT                 "CT"
#define CC_SYM_TEAM_SPEC             "SPECTATOR"

#define CC_ACTIVITY_CVAR             "amx_show_activity"
#define CC_ACTIVITY_CVAR_DEF         "2"
#define CC_ACTIVITY_CVAR_TYPE        FCVAR_PROTECTED

new CC_PREFIX[CC_MAX_PREFIX_SIZE], bool:CC_FIRST_TIME truebool:CC_FIRST_TIME_ACTIVITY trueCC_ACTIVITY_POINTERCC_MSG_SAYTEXTCC_MSG_TEAMINFO
new const CC_MENU_COLORS[][] = { CC_SYM_MENU_YELLOWCC_SYM_MENU_WHITECC_SYM_MENU_GREYCC_SYM_MENU_RIGHT }

#if CC_COLORS_TYPE == CC_COLORS_CUSTOM
    #if !defined CC_SYM_CHAT_NORMAL
        #define CC_SYM_CHAT_NORMAL         "&x01"
    #endif
    
    #if !defined CC_SYM_CHAT_TEAM
        #define CC_SYM_CHAT_TEAM         "&x03"
    #endif
    
    #if !defined CC_SYM_CHAT_GREEN
        #define CC_SYM_CHAT_GREEN        "&x04"
    #endif
    
    #if !defined CC_SYM_CHAT_WHITE
        #define CC_SYM_CHAT_WHITE        "&x05"
    #endif
    
    #if !defined CC_SYM_CHAT_BLUE
        #define CC_SYM_CHAT_BLUE         "&x06"
    #endif
    
    #if !defined CC_SYM_CHAT_RED
        #define CC_SYM_CHAT_RED            "&x07"
    #endif
    
    #if !defined CC_SYM_CHAT_NOPREF
        #define CC_SYM_CHAT_NOPREF        "&x00"
    #endif
#else    
    #if CC_COLORS_TYPE == CC_COLORS_CROMCHAT
        #define CC_SYM_CHAT_NORMAL         "&x01"
        #define CC_SYM_CHAT_TEAM         "&x03"
        #define CC_SYM_CHAT_GREEN         "&x04"
        #define CC_SYM_CHAT_WHITE         "&x05"
        #define CC_SYM_CHAT_BLUE         "&x06"
        #define CC_SYM_CHAT_RED         "&x07"
        #define CC_SYM_CHAT_NOPREF         "&x00"
    #endif
    
    #if CC_COLORS_TYPE == CC_COLORS_SHORT
        #define CC_SYM_CHAT_NORMAL         "!n"
        #define CC_SYM_CHAT_TEAM         "!t"
        #define CC_SYM_CHAT_GREEN         "!g"
        #define CC_SYM_CHAT_WHITE         "!w"
        #define CC_SYM_CHAT_BLUE         "!b"
        #define CC_SYM_CHAT_RED         "!r"
        #define CC_SYM_CHAT_NOPREF         "!p"
    #endif
    
    #if CC_COLORS_TYPE == CC_COLORS_NAMED
        #define CC_SYM_CHAT_NORMAL         "{normal}"
        #define CC_SYM_CHAT_TEAM         "{team}"
        #define CC_SYM_CHAT_GREEN         "{green}"
        #define CC_SYM_CHAT_WHITE         "{white}"
        #define CC_SYM_CHAT_BLUE         "{blue}"
        #define CC_SYM_CHAT_RED         "{red}"
        #define CC_SYM_CHAT_NOPREF         "{nopref}"
    #endif
    
    #if CC_COLORS_TYPE == CC_COLORS_NAMED_SHORT
        #define CC_SYM_CHAT_NORMAL         "{n}"
        #define CC_SYM_CHAT_TEAM         "{t}"
        #define CC_SYM_CHAT_GREEN         "{g}"
        #define CC_SYM_CHAT_WHITE         "{w}"
        #define CC_SYM_CHAT_BLUE         "{b}"
        #define CC_SYM_CHAT_RED         "{r}"
        #define CC_SYM_CHAT_NOPREF         "{p}"
    #endif
    
    #if CC_COLORS_TYPE == CC_COLORS_STANDARD
        #define CC_SYM_CHAT_NORMAL         "^1"
        #define CC_SYM_CHAT_TEAM         "^3"
        #define CC_SYM_CHAT_GREEN         "^4"
        #define CC_SYM_CHAT_WHITE         "^5"
        #define CC_SYM_CHAT_BLUE         "^6"
        #define CC_SYM_CHAT_RED         "^7"
        #define CC_SYM_CHAT_NOPREF         "^0"
    #endif
#endif

new const CC_REPLACE_COLORS[][] = { CC_SYM_CHAT_GREENCC_SYM_CHAT_DEF_GREENCC_SYM_CHAT_TEAMCC_SYM_CHAT_DEF_TEAMCC_SYM_CHAT_NORMALCC_SYM_CHAT_DEF_NORMAL }
new const 
CC_PLUS_COLORS[][] = { CC_SYM_CHAT_REDCC_SYM_TEAM_TCC_SYM_CHAT_BLUECC_SYM_TEAM_CTCC_SYM_CHAT_WHITECC_SYM_TEAM_SPEC }
new const 
CC_COLORS_LIST[][] = { CC_SYM_CHAT_REDCC_SYM_CHAT_BLUECC_SYM_CHAT_WHITECC_SYM_CHAT_GREENCC_SYM_CHAT_TEAMCC_SYM_CHAT_NORMALCC_SYM_CHAT_NOPREF }
new const 
CC_NO_PREFIX[] = CC_SYM_CHAT_NOPREF

/**
 * Sends a colored chat message.
 *
 * @param id         Client index (use 0 to send to all players)
 * @param szInput    The message to send
 * @param ...         Variable number of formatting parameters
 *
 * @return          Length of the printed message
 */
stock CC_SendMessage(const id, const szInput[], any:...)
{
    static 
iPlayers[CC_MAX_PLAYERS], iPnum
    
    
if(id)
    {
        if(!
is_user_connected(id))
            return 
0
    
}
    else
    {
        
get_players(iPlayersiPnumCC_FILTERING_FLAGS)
        
        if(!
iPnum)
            return 
0
    
}
    
    static 
szMessage[CC_MAX_MESSAGE_SIZE], szTeam[CC_MAX_TEAM_SIZE], bool:bNoPrefixi
    vformat
(szMessage[1], charsmax(szMessage), szInput3)
    
szMessage[0] = 0x01
    szTeam
[0] = EOS
    
    bNoPrefix 
bool:(equal(szMessage[1], CC_NO_PREFIXcharsmax(CC_NO_PREFIX)) || equal(szMessage[2], CC_NO_PREFIXcharsmax(CC_NO_PREFIX)))
    
    if(
bNoPrefix)
        
replace(szMessagecharsmax(szMessage), CC_NO_PREFIX"")
    else if(
CC_PREFIX[0])
        
format(szMessagecharsmax(szMessage), "%s%s %s%s"CC_SYM_CHAT_DEF_NORMALCC_PREFIXCC_SYM_CHAT_DEF_NORMALszMessage)
    
    for(
0sizeof(CC_REPLACE_COLORS) - 1+= 2)
        
replace_all(szMessagecharsmax(szMessage), CC_REPLACE_COLORS[i], CC_REPLACE_COLORS[1])
        
    for(
0sizeof(CC_PLUS_COLORS) - 1+= 2)
    {
        if(
contain(szMessageCC_PLUS_COLORS[i]) != -1)
        {
            
copy(szTeamcharsmax(szTeam), CC_PLUS_COLORS[1])
            break
        }
    }
    
    if(
szTeam[0])
    {
        for(
03i++)
            
replace_all(szMessagecharsmax(szMessage), CC_COLORS_LIST[i], CC_SYM_CHAT_DEF_TEAM)
    }
    
    if(
id)
        
_CC_WriteMessage(idszMessageszTeam)
    else
    {
        for(
0iPnumi++)
            
_CC_WriteMessage(iPlayers[i], szMessageszTeam)
    }
    
    return 
strlen(szMessage)
}

/**
 * Sends a colored chat message matching a specific player's color.
 *
 * @note You can use the iPlayer argument to set a specific color instead of matching
 *       it automtaically. To do this, you can use one of the following color arguments:
 *         CC_COLOR_TEAM, CC_COLOR_GREY (or CC_COLOR_WHITE), CC_COLOR_BLUE, CC_COLOR_RED.
 *
 * @param id         Client index (use 0 to send to all players)
 * @param iPlayer   Matching player's index
 * @param szInput    The message to send
 * @param ...         Variable number of formatting parameters
 *
 * @return          Length of the printed message
 */
stock CC_SendMatched(const id, const iPlayer, const szInput[], any:...)
{
    static 
szMessage[CC_MAX_MESSAGE_SIZE], bool:bPlusi
    vformat
(szMessage[1], charsmax(szMessage), szInput4)
    
szMessage[0] = 0x01
    bPlus 
false
    
    
for(0sizeof(CC_PLUS_COLORS) - 1+= 2)
    {
        if(
contain(szMessageCC_PLUS_COLORS[i]) != -1)
        {
            
bPlus true
            
break
        }
    }
    
    if(!
bPlus)
    {
        static 
iColor
        
        
if(is_user_connected(iPlayer))
        {
            switch(
get_user_team(iPlayer))
            {
                case 
1iColor CC_COLOR_RED
                
case 2iColor CC_COLOR_BLUE
                
default: iColor CC_COLOR_GREY
            
}
        }
        else
            
iColor iPlayer
            
        
switch(iColor)
        {
            case 
CC_COLOR_REDadd(szMessagecharsmax(szMessage), CC_COLORS_LIST[0])
            case 
CC_COLOR_BLUEadd(szMessagecharsmax(szMessage), CC_COLORS_LIST[1])
            case 
CC_COLOR_GREYadd(szMessagecharsmax(szMessage), CC_COLORS_LIST[2])
        }
    }
    
    return 
CC_SendMessage(idszMessage)
}

/**
 * Sends a colored chat message to a group of players matching the flags from the get_players() function.
 *
 * @note The filtering flags are the same that are use by the get_players() function
 *
 * @param szFlags   Filtering flags
 * @param szParams  String to match against if the flags require it
 * @param szInput    The message to send
 * @param ...         Variable number of formatting parameters
 *
 * @return          Length of the printed message or 0 if no players were matched
 */
stock CC_GroupMessage(const szFlags[] = "", const szParams[] = "", const szInput[], any:...)
{
    static 
szMessage[CC_MAX_MESSAGE_SIZE], iPlayers[CC_MAX_PLAYERS], iPnum
    vformat
(szMessagecharsmax(szMessage), szInput4)
    
get_players(iPlayersiPnumszFlagsszParams)
    
    if(!
iPnum)
        return 
0
    
    
static i
    
    
for(0iPnumi++)
        
CC_SendMessage(iPlayers[i], szMessage)
    
    return 
strlen(szMessage)
}

/**
 * Sends a colored chat message to all players who have the specified admin flags.
 *
 * @param szFlags    Admin flags
 * @param bAllFlags If set to true it will match players who have ALL of the specified admin flags, otherwise it will match players with ANY of the flags
 * @param szInput    The message to send
 * @param ...         Variable number of formatting parameters
 *
 * @return          Length of the printed message or 0 if no players were matched
 */
stock CC_SendAdminMessage(const szFlags[] = "", const bool:bAllFlags true, const szInput[], any:...)
{
    static 
szMessage[CC_MAX_MESSAGE_SIZE], iPlayers[CC_MAX_PLAYERS], iPnum
    vformat
(szMessagecharsmax(szMessage), szInput4)
    
get_players(iPlayersiPnumCC_FILTERING_FLAGS)
    
    if(!
iPnum)
        return 
0
    
    
static iCountiFlagsiPlayeri
    iFlags 
read_flags(szFlags)
    
iCount 0
    
    
for(0iPnumi++)
    {
        
iPlayer iPlayers[i]
        
        switch(
bAllFlags)
        {
            case 
true:
            {
                if(
get_user_flags(iPlayer) & iFlags != iFlags)
                    continue
            }
            case 
false:
            {
                if(!(
get_user_flags(iPlayer) & iFlags))
                    continue
            }
        }
        
        
iCount++
        
CC_SendMessage(iPlayerszMessage)
    }
    
    if(!
iCount)
        return 
0
    
    
return strlen(szMessage)
}

/**
 * Sends a colored chat message and logs it at the same time.
 *
 * @note If the file name is not set, the default log file will be used instead.
 *
 * @param id         Client index (use 0 to send to all players)
 * @param szFile       The log file that will be used
 * @param szInput    The message to send
 * @param ...         Variable number of formatting parameters
 *
 * @return          Length of the printed message
 */
stock CC_LogMessage(const id, const szFile[] = "", const szInput[], any:...)
{
    static 
szMessage[CC_MAX_MESSAGE_SIZE]
    
vformat(szMessagecharsmax(szMessage), szInput4)
    
    if(!
CC_SendMessage(idszMessage))
        return 
0
        
    CC_RemoveColors
(szMessagecharsmax(szMessage))
    
szFile[0] ? log_to_file(szFileszMessage) : log_amx(szMessage)
    return 
strlen(szMessage)
}

/**
 * Sends a colored chat message to all players that obeys the amx_show_activity cvar.
 *
 * @note This function is made to mimic the show_activity() function, but sends a
 *         colored chat message instead using the CC_SendMessage() function. This means
 *         that the default AMXX function can directly be replaced with this one in order
 *         for it to display a colored chat message rather than a default one.
 * @note By default, cromchat.inc will replace all show_activity() functions in the file
 *         with the CC_ShowActivity() function. You can disable this feature by adding
 *         #define CC_DONT_OVERWRITE_ACTIVITY before #include <cromchat> in your plugin.
 *
 * @param id         Client index performing the action
 * @param szName       Name of client performing the action
 * @param szInput   Formatting rules
 * @param ...        Variable number of formatting parameters
 *
 * @noreturn
 */
stock CC_ShowActivity(id, const szName[], const szInput[], any:...)
{
    if(
CC_FIRST_TIME_ACTIVITY)
        
_CC_ActivityInit()

    static 
szMessage[CC_MAX_MESSAGE_SIZE], szPrefix[CC_MAX_ACT_PREFIX_SIZE], iPlayers[CC_MAX_PLAYERS], iPlayeriPnumi
    vformat
(szMessagecharsmax(szMessage), szInput4)
    
_CC_GetActivityPrefix(idszPrefixcharsmax(szPrefix))

    switch(
get_pcvar_num(CC_ACTIVITY_POINTER))
    {
        case 
1CC_SendMessage(0"%L: %s"LANG_PLAYERszPrefixszMessage)
        case 
2CC_SendMessage(0"%L %s: %s"LANG_PLAYERszPrefixszNameszMessage)
        case 
3:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                if(
_CC_IsActivityAdmin(iPlayer))
                    
CC_SendMessage(iPlayer"%L %s: %s"iPlayerszPrefixszNameszMessage)
                else
                    
CC_SendMessage(iPlayer"%L: %s"iPlayerszPrefixszMessage)
            }
        }
        case 
4:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                if(
_CC_IsActivityAdmin(iPlayer))
                    
CC_SendMessage(iPlayer"%L %s: %s"iPlayerszPrefixszNameszMessage)
            }
        }
        case 
5:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                if(
_CC_IsActivityAdmin(iPlayer))
                    
CC_SendMessage(iPlayer"%L: %s"iPlayerszPrefixszMessage)
            }
        }
    }
}

/**
 * Sends a colored chat message to a single client that obeys the amx_show_activity cvar.
 *
 * @note This function is made to mimic the show_activity_id() function, but sends a
 *         colored chat message instead using the CC_SendMessage() function. This means
 *         that the default AMXX function can directly be replaced with this one in order
 *         for it to display a colored chat message rather than a default one.
 * @note By default, cromchat.inc will replace all show_activity_id() functions in the file
 *         with the CC_ShowActivityId() function. You can disable this feature by adding
 *         #define CC_DONT_OVERWRITE_ACTIVITY before #include <cromchat> in your plugin.
 *
 * @param iTarget   Client index to display message to
 * @param id        Client index performing the action
 * @param szName    Name of client performing the action
 * @param szInput   Formatting rules
 * @param ...       Variable number of formatting parameters
 *
 * @noreturn
 */
stock CC_ShowActivityId(iTargetid, const szName[], const szInput[], any:...)
{
    if(!
is_user_connected(iTarget))
        return

    if(
CC_FIRST_TIME_ACTIVITY)
        
_CC_ActivityInit()

    static 
szMessage[CC_MAX_MESSAGE_SIZE], szPrefix[CC_MAX_ACT_PREFIX_SIZE]
    
vformat(szMessagecharsmax(szMessage), szInput5)
    
_CC_GetActivityPrefix(idszPrefixcharsmax(szPrefix))

    switch(
get_pcvar_num(CC_ACTIVITY_POINTER))
    {
        case 
1CC_SendMessage(iTarget"%L: %s"iTargetszPrefixszMessage)
        case 
2CC_SendMessage(iTarget"%L %s: %s"iTargetszPrefixszNameszMessage)
        case 
3:
        {
            if(
_CC_IsActivityAdmin(iTarget))
                
CC_SendMessage(iTarget"%L %s: %s"iTargetszPrefixszNameszMessage)
            else
                
CC_SendMessage(iTarget"%L: %s"iTargetszPrefixszMessage)
        }
        case 
4:
        {
            if(
_CC_IsActivityAdmin(iTarget))
                
CC_SendMessage(iTarget"%L %s: %s"iTargetszPrefixszNameszMessage)
        }
        case 
5:
        {
            if(
_CC_IsActivityAdmin(iTarget))
                
CC_SendMessage(iTarget"%L: %s"iTargetszPrefixszMessage)
        }
    }
}

/**
 * Sends a colored chat message to all client using nromal language keys that obeys the amx_show_activity cvar.
 *
 * @note This function is made to mimic the show_activity_key() function, but sends a
 *         colored chat message instead using the CC_SendMessage() function. This means
 *         that the default AMXX function can directly be replaced with this one in order
 *         for it to display a colored chat message rather than a default one.
 * @note By default, cromchat.inc will replace all show_activity_key() functions in the file
 *         with the CC_ShowActivityKey() function. You can disable this feature by adding
 *         #define CC_DONT_OVERWRITE_ACTIVITY before #include <cromchat> in your plugin.
 *
 * @param szWithout The language key that does not have the name field
 * @param szWith    The language key that does have the name field
 * @param szName    The name of the person doing the action
 * @param ...       Pass any extra format arguments for the language key in the variable arguments list
 *
 * @noreturn
 */
stock CC_ShowActivityKey(const szWithout[], const szWith[], const szName[], any:...)
{
    
#pragma unused szName

    
if(CC_FIRST_TIME_ACTIVITY)
        
_CC_ActivityInit()

    static 
szMessage[CC_MAX_MESSAGE_SIZE], szKey[CC_MAX_MESSAGE_SIZE], iPlayers[CC_MAX_PLAYERS], iPnumiPlayeri

    
switch(get_pcvar_num(CC_ACTIVITY_POINTER))
    {
        case 
1:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                
LookupLangKey(szKeycharsmax(szKey), szWithoutiPlayer)
                
vformat(szMessagecharsmax(szMessage), szKey4)
                
CC_SendMessage(iPlayerszMessage)
            }
        }
        case 
2:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                
LookupLangKey(szKeycharsmax(szKey), szWithiPlayer)
                
vformat(szMessagecharsmax(szMessage), szKey3)
                
CC_SendMessage(iPlayerszMessage)
            }
        }
        case 
3:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                if(
_CC_IsActivityAdmin(iPlayer))
                {
                    
LookupLangKey(szKeycharsmax(szKey), szWithiPlayer)
                    
vformat(szMessagecharsmax(szMessage), szKey3)
                }
                else
                {
                    
LookupLangKey(szKeycharsmax(szKey), szWithoutiPlayer)
                    
vformat(szMessagecharsmax(szMessage), szKey4)
                }

                
CC_SendMessage(iPlayerszMessage)
            }
        }
        case 
4:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                if(
_CC_IsActivityAdmin(iPlayer))
                {
                    
LookupLangKey(szKeycharsmax(szKey), szWithiPlayer)
                    
vformat(szMessagecharsmax(szMessage), szKey3)
                    
CC_SendMessage(iPlayerszMessage)
                }
            }
        }
        case 
5:
        {
            
get_players(iPlayersiPnumCC_FILTERING_FLAGS)

            for(
0iPnumi++)
            {
                
iPlayer iPlayers[i]

                if(
_CC_IsActivityAdmin(iPlayer))
                {
                    
LookupLangKey(szKeycharsmax(szKey), szWithoutiPlayer)
                    
vformat(szMessagecharsmax(szMessage), szKey4)
                    
CC_SendMessage(iPlayerszMessage)
                }
            }
        }
    }
}

/**
 * Removes the color codes from a message.
 *
 * @param szMessage The message to work with
 * @param iLen        Maximum buffer length
 * @param bChat        If set to true, it will remove the chat color codes
 * @param bMenu        If set to true, it will remove the menu color codes
 *
 * @noreturn
 */
stock CC_RemoveColors(szMessage[], iLenbool:bChat truebool:bMenu false)
{
    static 
i
    
    
if(bChat)
    {
        for(
0sizeof(CC_COLORS_LIST); i++)
            
replace_all(szMessageiLenCC_COLORS_LIST[i], "")
    }
    
    if(
bMenu)
    {
        for(
0sizeof(CC_MENU_COLORS); i++)
            
replace_all(szMessageiLenCC_MENU_COLORS[i], "")
    }
}

/**
 * Sets a global prefix that will be used for all sent messages.
 *
 * @note The prefix can be removed in a given message if the prefix-removing symbol is
 *       used in the beginning of the message. By default, this symbol is equal to &x00.
 *
 * @param szPrefix  The prefix
 *
 * @noreturn
 */
stock CC_SetPrefix(const szPrefix[])
    
copy(CC_PREFIXcharsmax(CC_PREFIX), szPrefix)
    
/**
 * Removes the global message prefix.
 *
 * @noreturn
 */
stock CC_RemovePrefix()
    
CC_PREFIX[0] = EOS

/**
 * This function is used by the other stocks to send a raw message.
 *
 * @param id         Client index (use 0 to send to all players)
 * @param szMessage    The message to send
 * @param szTeam     Message color according to the team
 *
 * @noreturn
 */
stock _CC_WriteMessage(const id, const szMessage[], szTeam[CC_MAX_TEAM_SIZE])
{
    static 
bool:bRefresh
    bRefresh 
true
    
    
if(!szTeam[0])
    {
        
bRefresh false
        get_user_team
(idszTeamcharsmax(szTeam))
    }
    
    if(
CC_FIRST_TIME)
    {
        
CC_FIRST_TIME false
        CC_MSG_SAYTEXT 
get_user_msgid("SayText")
        
CC_MSG_TEAMINFO get_user_msgid("TeamInfo")
    }
        
    
_CC_SendTeamInfo(idszTeam)

    
message_begin(MSG_ONECC_MSG_SAYTEXT_id)
    
write_byte(id)
    
//write_string("%s") -- Good Job, Valve!
    
write_string(szMessage)
    
message_end()
    
    if(
bRefresh)
    {
        
get_user_team(idszTeamcharsmax(szTeam))
        
_CC_SendTeamInfo(idszTeam)
    }
}

/**
 * Updates the player's team info.
 *
 * @param id         Client index
 * @param szTeam    Team to use
 *
 * @noreturn
 */
stock _CC_SendTeamInfo(const id, const szTeam[CC_MAX_TEAM_SIZE])
{
    
message_begin(MSG_ONECC_MSG_TEAMINFO_id)
    
write_byte(id)
    
write_string(szTeam)
    
message_end()
}

/**
 * Stores the amx_show_activity pointer for use with "ShowActivity" functions.         
 *
 * @noreturn
 */
stock _CC_ActivityInit()
 {
     
CC_FIRST_TIME_ACTIVITY false
     CC_ACTIVITY_POINTER 
get_cvar_pointer(CC_ACTIVITY_CVAR)

     if(!
CC_ACTIVITY_POINTER)
         
CC_ACTIVITY_POINTER register_cvar(CC_ACTIVITY_CVARCC_ACTIVITY_CVAR_DEFCC_ACTIVITY_CVAR_TYPE)
 }

/**
 * Returns the player prefix used with "ShowActivity" functions.
 *
 * @param id         Client index
 *
 * @noreturn
 */
stock _CC_GetActivityPrefix(const idszPrefix[CC_MAX_ACT_PREFIX_SIZE], const iLen)
    
copy(szPrefixiLen_CC_IsActivityAdmin(id) ? CC_ACTIVITY_PREFIX_ADMIN CC_ACTIVITY_PREFIX_PLAYER)

/**
 * Checks whether or not the client has the required flag to be marked as an admin for the "ShowActivity" functions.
 *
 * @param id         Client index
 *
 * @return          True if he has, false otherwise
 */
stock bool:_CC_IsActivityAdmin(const id)
{
    
#if CC_ACTIVITY_FLAG == -1
    
static iFlags
    iFlags 
get_user_flags(id)
    return (
iFlags && !(iFlags ADMIN_USER))
    
#else
    
return bool:(get_user_flags(id) & CC_ACTIVITY_FLAG)
    
#endif

__________________
let me Sleep ZZzzzzzzzzz
Cs-Dev
Message Me | Facebook | My Blog
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: I am living in house bsd
Old 11-05-2018 , 03:15   Re: Doubt Chromchat vs ColorChat
Reply With Quote #2

hows about chromecolor
__________________
MY ENGLISH = A0

FB : https://m.facebook.com/lucky.mali.755 (LUCKY GEHLOT)

SENTRY GUN LOVER : NEW SENTRY GUN MOD(CLICK HERE)
SHIELD755 is offline
Sanjay Singh
Senior Member
Join Date: Sep 2016
Old 11-05-2018 , 03:26   Re: Doubt Chromchat vs ColorChat
Reply With Quote #3

Quote:
Originally Posted by SHIELD755 View Post
hows about chromecolor
haha nice currently i am using default ColorChat but if chromchat is better in some way then i want to try that.
__________________
let me Sleep ZZzzzzzzzzz
Cs-Dev
Message Me | Facebook | My Blog
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
shauli
Member
Join Date: Jun 2018
Old 11-05-2018 , 06:34   Re: Doubt Chromchat vs ColorChat
Reply With Quote #4

That's not a question of which one is better, it's about the features. CromChat has a lot of features compared to the regular stock (or client_print_color), so you should pick one based on what you're trying to do.
shauli is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-06-2018 , 08:32   Re: Doubt Chromchat vs ColorChat
Reply With Quote #5

colorchat.inc:
  • WILL throw errors in the server console when you try sending a message to all players while the server is empty;
  • WILL randomly fail to use the correct team color when using ^3;
  • CANNOT manually switch to red, blue or gray color;
  • DOES NOT HAVE a feature that helps with using colored messages in the default AMXX plugins.
  • DOES NOT HAVE any other useful features.

cromchat.inc:
  • WILL NOT throw errors in the server console when you try sending a message to all players while the server is empty;
  • WILL NOT randomly fail to use the correct team color when using ^3;
  • CAN manually switch to red, blue or gray color;
  • DOES HAVE a feature that automatically adds color to the messages in the default AMXX plugins.
  • DOES HAVE a lot of other useful features.
__________________

Last edited by OciXCrom; 11-06-2018 at 08:32.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: I am living in house bsd
Old 11-06-2018 , 08:54   Re: Doubt Chromchat vs ColorChat
Reply With Quote #6

your cromchat does not have a single error ? interesting
__________________
MY ENGLISH = A0

FB : https://m.facebook.com/lucky.mali.755 (LUCKY GEHLOT)

SENTRY GUN LOVER : NEW SENTRY GUN MOD(CLICK HERE)
SHIELD755 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-06-2018 , 09:37   Re: Doubt Chromchat vs ColorChat
Reply With Quote #7

It doesn't.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 11-06-2018 , 12:16   Re: Doubt Chromchat vs ColorChat
Reply With Quote #8

Will these God damn useless colored chat stocks ever die? Like 70% of random plugins I work with have another 'new' colorchat include.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-07-2018 , 00:19   Re: Doubt Chromchat vs ColorChat
Reply With Quote #9

Quote:
Originally Posted by NiHiLaNTh View Post
Will these God damn useless colored chat stocks ever die? Like 70% of random plugins I work with have another 'new' colorchat include.
You won't see a push for that until after 1.8.3 is actually released.

Quote:
Originally Posted by Sanjay Singh View Post
How cromchat is better than normal colorchat include? how that effect i want to know.
In the future, please post your question about a topic in that topic's thread.
__________________

Last edited by fysiks; 11-07-2018 at 00:22.
fysiks is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-07-2018 , 06:24   Re: Doubt Chromchat vs ColorChat
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
You won't see a push for that until after 1.8.3 is actually released.



In the future, please post your question about a topic in that topic's thread.
Even then, the include still has more futures than 1.8.3/1.9/1.10 currently has.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 17:11.


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