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

Colorchat ^3 showing wrong team color


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 05-12-2019 , 11:52   Colorchat ^3 showing wrong team color
Reply With Quote #1

I'm using colorchat, tried a stock that I found somewhere then used CromChat, I use ^3 which is team color but it shows the wrong team color. Anyone has any idea why this could happen?
I checked that CromChat uses get_user_team to check the team, maybe get_user_team returns a wrong value?

__________________
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-12-2019 , 12:26   Re: Colorchat ^3 showing wrong team color
Reply With Quote #2

When does this happen? Show your code.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-12-2019 , 12:38   Re: Colorchat ^3 showing wrong team color
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
When does this happen? Show your code.
Obvious when you are changing the player team.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-12-2019 , 12:55   Re: Colorchat ^3 showing wrong team color
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
Obvious when you are changing the player team.
The team is checked when printing the message, so there's nothing obvious about it.

One of the reasons I decided to create CromChat is exactly this bug that ColorChat has. I personally haven't noticed it happening with CromChat, yet.
__________________

Last edited by OciXCrom; 05-12-2019 at 12:55.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 05-12-2019 , 13:11   Re: Colorchat ^3 showing wrong team color
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
The team is checked when printing the message, so there's nothing obvious about it.

One of the reasons I decided to create CromChat is exactly this bug that ColorChat has. I personally haven't noticed it happening with CromChat, yet.
Randomly, sometimes I start the round as a zombie and get a blue chat color, sometimes in the middle of the round my color changes.
Here's the part that is responsible for printing:
PHP Code:
public OnHookSayid )
{
    new 
g_iItemsPlayerData ];

    new 
szName32 ], szAuthID32 ], szPassword22 ], szArgs192 ];

    
read_argsszArgscharsmaxszArgs ) );
    
remove_quotesszArgs );
    
    
get_user_nameidszNamecharsmaxszName ) );
    
get_user_authididszAuthIDcharsmaxszAuthID ) );
    
get_user_infoid"_pw"szPasswordcharsmaxszPassword ) );
        
    for( new 
iIndexiIndex ArraySizeg_aDatabase ); iIndex++ )
    {
        
ArrayGetArrayg_aDatabaseiIndexg_iItems );
        
        
trimszName );
        
trimszPassword );

        if( 
equalg_iItemsPlayer_Name ], szName ) || equalg_iItemsPlayer_Name ], szAuthID ) )
        {
            if( 
equalg_iItemsPlayer_Password ], szPassword ) || g_iItemsPlayer_Password ][ ] == EOS )
            {
                if( 
g_iItemsPlayer_Suspended ] || g_iItemsPlayer_Prefix ][ ] == EOS 
                {
                    return 
PLUGIN_CONTINUE;
                }
                
                if( ! 
szArgs] )
                {
                    return 
PLUGIN_HANDLED;
                }
                
                else
                {
                    if( 
is_user_aliveid ) )
                    {        
                        switch( 
get_user_teamid ) )
                        {
                        case 
12:
                            {
                                
CC_SendMessage0"&x04%s &x03%s&x01: &x04%s"g_iItemsPlayer_Prefix ], szNameszArgs );
                                return 
PLUGIN_HANDLED_MAIN;
                            }
                        case 
3:
                            {
                                
CC_SendMessage0"&x03%s &x04%s &x03%s&x01: &x04%s"g_iConfigSPECTATOR_PREFIX ], g_iItemsPlayer_Prefix ], szNameszArgs );
                                return 
PLUGIN_HANDLED_MAIN;
                            }                        
                        }
                    }
                    else
                    {
                        
CC_SendMessage0"&x03%s &x04%s &x03%s&x01: &x04%s"g_iConfigDEAD_PREFIX ], g_iItemsPlayer_Prefix ], szNameszArgs );
                        return 
PLUGIN_HANDLED_MAIN;
                    }
                }
            }
        }
    }
    return 
PLUGIN_CONTINUE;

Here's full code:

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fakemeta >
#include < cromchat >

#define PLUGIN_AUTHOR "DoNii"
#define PLUGIN_VERSION "3.2"
#define PLUGIN_NAME "Elite Admin System"

#define SERVER_ID 0

enum _:PlayerData
{
    
Player_Name32 ],
    
Player_Password32 ],
    
Player_AccessFlags32 ],
    
Player_Prefix32 ],
    
Player_Model_T32 ],
    
Player_Model_CT32 ],
    
Player_Expire_Date32 ],
    
Player_Immunity10 ],
bool:Player_Suspended
}

enum _:eConfig
{
    
DEAD_PREFIX32 ],
    
SPECTATOR_PREFIX32 ],
    
COMMAND_ADDADMIN32 ],
    
USERS_FILE32 ],
    
BANS_FILE32 ],
    
LOGS_FILE32 ],
    
SYSTEM_PREFIX32 ],
    
NO_ACCESS_COMMAND32 ],
    
ADMIN_ADD_FLAG,
Float:TIME_CHECK_ADMINS
}

enum _:Commands
{
    
Cmd_Name32 ],
    
Cmd_Callback32 ],
    
Cmd_Flags,
    
Cmd_Plugin,
    
Cmd_FuncId
}

// Configuration file
new const g_szConfigFile[ ] = "EliteAdminSystem_Config.ini";

new Array:
g_aDatabase;
new Array:
g_aCommands;

new 
g_iFwAdminAdded;
new 
g_iDummyResult;

new 
bool:g_bHasModel33 ];

new 
g_iConfigeConfig ];

new 
g_szConfigs64 ];

public 
plugin_precache( )
{
    
get_configsdirg_szConfigscharsmaxg_szConfigs ) );
        
    
g_aDatabase ArrayCreatePlayerData );
    
g_aCommands ArrayCreateCommands );

    
CheckDirectory( );
    
    
ReadIni( );
    
ReloadFile( );
    
    new 
eDataPlayerData ], szModel128 ];
    for( new 
iArraySizeg_aDatabase ); i++ )
    {
        
ArrayGetArrayg_aDatabaseieData );
        
        if( 
eDataPlayer_Model_T ][ ] )
        {
            
formatexszModelcharsmaxszModel ), "models/player/%s/%s.mdl"eDataPlayer_Model_T ], eDataPlayer_Model_T ] );
            
precache_modelszModel );
        }
        
        if( 
eDataPlayer_Model_CT ][ ] )
        {
            
formatexszModelcharsmaxszModel ), "models/player/%s/%s.mdl"eDataPlayer_Model_CT ], eDataPlayer_Model_CT ] );
            
precache_modelszModel );
        }
    }
}

public 
plugin_init( )
{
    
register_pluginPLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR );
    
    
remove_user_flagsSERVER_IDread_flags"z" ) );    
    
register_concmdg_iConfigCOMMAND_ADDADMIN ], "OnAddNewAdmin" );
    
    
register_clcmd"say""OnHookSay" );
    
register_clcmd"say_team""OnHookSay" );

    
set_taskg_iConfigTIME_CHECK_ADMINS ], "OnTaskResetAdmins"___"b" );
    
    
server_cmd"exec %s/amxx.cfg"g_szConfigs );
    
server_cmd"exec %s/sql.cfg"g_szConfigs );
    
    
g_iFwAdminAdded CreateMultiForward"AdminAdded"ET_IGNOREFP_STRINGFP_STRINGFP_STRINGFP_STRINGFP_STRINGFP_STRINGFP_STRING );
    
    
RegisterHamHam_Spawn"player""Ham_Spawn_Pre");
    
RegisterHamHam_Spawn"player""Ham_Spawn_Post");
    
    
register_forwardFM_ClientUserInfoChanged"fw_ClientUserInfoChanged" );
    
register_forwardFM_SetClientKeyValue"fw_SetClientKeyValue" );
}

public 
plugin_natives( )
{
    
register_library"elite_admin_system" );
    
    
register_native"RegisterCommand""OnNativeRegisterCommand");
}

public 
OnNativeRegisterCommandiPluginiParams )
{
    new 
eDataCommands ], szHandler32 ];
    
    
get_string1eDataCmd_Name ], charsmaxeDataCmd_Name ] ) );
    
get_string2szHandlercharsmaxszHandler ) );
    
    
eDataCmd_Flags ] = get_param);
    
eDataCmd_Plugin ] = iPlugin;
    
eDataCmd_FuncId ] = get_func_idszHandleriPlugin );
    
    
ArrayPushArrayg_aCommandseData );
}

public 
client_connectid )
{
    
g_bHasModelid ] = false;
    
    
remove_user_flagsid );
    
set_user_flagsidADMIN_USER );
}

public 
client_disconnectid )
{
    
g_bHasModelid ] = false;
    
    
remove_user_flagsid );
    
set_user_flagsidADMIN_USER );
}

public 
Ham_Spawn_Preid )
{
    
g_bHasModelid ] = false;
}

public 
Ham_Spawn_Postid )
{
    if( ! 
is_user_aliveid ) )
    {
        return 
HAM_IGNORED;
    }
    
    new 
szName32 ], szSteamId32 ], eDataPlayerData ];
    
get_user_nameidszNamecharsmaxszName ) );
    
get_user_authididszSteamIdcharsmaxszSteamId ) );
    
    for( new 
iArraySizeg_aDatabase ); i++ )
    {
        
ArrayGetArrayg_aDatabaseieData );
        
        if( 
equaleDataPlayer_Name ], szName ) || equaleDataPlayer_Name ], szSteamId ) )
        {
            switch( 
get_user_teamid ) )
            {
            case 
1:
                {
                    if( 
eDataPlayer_Model_T ][ ] )
                    {
                        
set_user_infoid"model"eDataPlayer_Model_T ] );
                        
                        
g_bHasModelid ] = true;
                    }
                }
                
            case 
2:
                {
                    if( 
eDataPlayer_Model_CT ][ ] )
                    {
                        
set_user_infoid"model"eDataPlayer_Model_CT ] );
                        
                        
g_bHasModelid ] = true;
                    }
                }
            }
        }
    }
    return 
HAM_IGNORED;
}

public 
fw_SetClientKeyValueid, const szBuffer[ ], const szKey[ ] )
{
    if( ! 
g_bHasModelid ] )
    {
        return 
FMRES_IGNORED;
    }

    if( 
equalszKey"model" ) )
    {
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}

public 
fw_ClientUserInfoChangedid )
{    
    if( 
g_bHasModelid ] )
    {
        return 
FMRES_IGNORED;
    }

    static 
szCurrentModel32 ];
    
get_user_infoid"model"szCurrentModelcharsmaxszCurrentModel ) );
    
    new 
eDataPlayerData ], szName32 ], szSteamId32 ];
    
get_user_nameidszNamecharsmaxszName ) );
    
get_user_authididszSteamIdcharsmaxszSteamId ) );
    
    for( new 
iArraySizeg_aDatabase ); i++ )
    {
        
ArrayGetArrayg_aDatabaseieData );
        
        if( 
equaleDataPlayer_Name ], szName ) || equaleDataPlayer_Name ], szSteamId ) )
        {
            switch( 
get_user_teamid ) )
            {
            case 
1:
                {
                    if( 
eDataPlayer_Model_T ][ ] )
                    {
                        
set_user_infoid"model"eDataPlayer_Model_T ] );
                    }
                }
                
            case 
2:
                {
                    if( 
eDataPlayer_Model_CT ][ ] )
                    {
                        
set_user_infoid"model"eDataPlayer_Model_CT ] );
                    }
                }
            }
        }
    }
    return 
FMRES_IGNORED;
}

public 
client_commandid )
{
    new 
szCommand32 ];
    
read_argv0szCommandcharsmaxszCommand ) );
    
    new 
eDataCommands ];
    for( new 
iArraySizeg_aCommands ); i++ )
    {
        
ArrayGetArrayg_aCommandsieData );
        
        if( 
equalszCommandeDataCmd_Name ] ) )
        {
            if( ~ 
get_user_flagsid ) & eDataCmd_Flags ] )
            {
                
client_printidprint_console"%s %s"g_iConfigSYSTEM_PREFIX ], g_iConfigNO_ACCESS_COMMAND ] );
                return 
PLUGIN_HANDLED;
            }
            
            
callfunc_begin_ieDataCmd_FuncId ], eDataCmd_Plugin ] );
            
callfunc_push_intid );
            
callfunc_end( );
            
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
OnAddNewAdminid )
{
    if( ~ 
get_user_flagsid ) & g_iConfigADMIN_ADD_FLAG ] )
    {
        
client_printidprint_console"%s %s"g_iConfigSYSTEM_PREFIX ], g_iConfigNO_ACCESS_COMMAND ] );
        return 
PLUGIN_HANDLED;
    }

    if( 
read_argc( ) != )
    {
        
client_printidprint_console"Usage is : %s <Nick|SteamID> <Password> <Flags> <Prefix> <T_Model> <CT_Model> <Immunity> <Expire_Date>"g_iConfigCOMMAND_ADDADMIN ] );
        return 
PLUGIN_HANDLED;
    }

    new 
szAdminName32 ], szAdminPassword18 ], szAdminFlags32 ], szAdminPrefix18 ], szModelT32 ], szModelCT32 ], szImmunity32 ], szExpireDate32 ];
    
    new 
szAdminName232 ];
    
get_user_nameidszAdminName2charsmaxszAdminName2 ) );
    
    
read_argv1szAdminNamecharsmaxszAdminName ) );
    
read_argv2szAdminPasswordcharsmaxszAdminPassword ) );
    
read_argv3szAdminFlagscharsmaxszAdminFlags ) );
    
read_argv4szAdminPrefixcharsmaxszAdminPrefix ) );
    
read_argv5szModelTcharsmaxszModelT ) );
    
read_argv6szModelCTcharsmaxszModelCT ) );
    
read_argv7szImmunitycharsmaxszImmunity ) );
    
read_argv8szExpireDatecharsmaxszExpireDate ) );
    
    if( ( 
strlenszAdminName ) < ) || ( strlenszAdminFlags ) < ) )
    {
        
client_printidprint_console"%s Incorrect format"g_iConfigSYSTEM_PREFIX ] );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szFormat128 ];
    
    
formatexszFormatcharsmaxszFormat ), "%s/%s"g_szConfigsg_iConfigUSERS_FILE ] );
    new 
iFile fopenszFormat"r+" ); 

    new 
szByteVal], szNewLine128 ]; 
    
    
fseekiFile , -SEEK_END ); 
    
fread_rawiFile szByteVal sizeofszByteVal ) , BLOCK_BYTE ); 
    
fseekiFile SEEK_END ); 
    
    
formatexszNewLine charsmaxszNewLine ) , "%s^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^" ^"%s^"" , ( szByteVal] == 10 ) ? "" "^n"szAdminNameszAdminPasswordszAdminFlagsszAdminPrefixszModelTszModelCTszImmunityszExpireDate ); 

    
fprintfiFileszNewLine );
    
fcloseiFile );  
    
    
client_printidprint_console"%s Successfully Added New Admin: Name: %s | Password: %s | Flags: %s | Prefix: %s | Model_T: %s | Model_CT: %s | Immunity: %s | Expire Date: %s |"g_iConfigSYSTEM_PREFIX ], szAdminNameszAdminPasswordszAdminFlagsszAdminPrefixszModelTszModelCTszImmunityszExpireDate );
    
CC_SendMessage0"&x04%s &x03ADMIN &x04%s ^1successfully added a new admin &x03[^1Name: &x04%s &x03| &x01Flags: &x04%s &x03| &x01Prefix: &x04%s&x03]"g_iConfigSYSTEM_PREFIX ], szAdminName2szAdminNameszAdminFlagsszAdminPrefix );
    
    new 
szDate32 ];
    
get_time"%m/%d/%Y - %H:%M:%S"szDatecharsmaxszDate ) );
    
    
log_to_fileg_iConfigLOGS_FILE ], "(%s) ADMIN %s added a new admin: Name: %s | Password: %s | Flags: %s | Prefix: %s | Model_T: %s | Model_CT: %s | Immunity: %s | Expire Date: %s |"szDateszAdminName2szAdminNameszAdminPasswordszAdminFlagsszAdminPrefixszModelTszModelCTszImmunityszExpireDate );
    
    
ExecuteForwardg_iFwAdminAddedg_iDummyResultszAdminNameszAdminPasswordszAdminFlagsszAdminPrefixszModelTszModelCTszExpireDate );
    
    return 
PLUGIN_CONTINUE;
}

public 
client_authorizedid )
{
    
CheckPlayerAdminid );
}

public 
OnTaskResetAdmins( )
{
    
ReloadFile( );
    
    new 
szPlayers32 ], iNum;
    
get_playersszPlayersiNum"ch" );

    static 
iTempID;
    
    for( new 
iiNumi++ )
    {
        
iTempID szPlayers];

        
CheckPlayerAdminiTempID );
    }
}

public 
OnHookSayid )
{
    new 
g_iItemsPlayerData ];

    new 
szName32 ], szAuthID32 ], szPassword22 ], szArgs192 ];

    
read_argsszArgscharsmaxszArgs ) );
    
remove_quotesszArgs );
    
    
get_user_nameidszNamecharsmaxszName ) );
    
get_user_authididszAuthIDcharsmaxszAuthID ) );
    
get_user_infoid"_pw"szPasswordcharsmaxszPassword ) );
        
    for( new 
iIndexiIndex ArraySizeg_aDatabase ); iIndex++ )
    {
        
ArrayGetArrayg_aDatabaseiIndexg_iItems );
        
        
trimszName );
        
trimszPassword );

        if( 
equalg_iItemsPlayer_Name ], szName ) || equalg_iItemsPlayer_Name ], szAuthID ) )
        {
            if( 
equalg_iItemsPlayer_Password ], szPassword ) || g_iItemsPlayer_Password ][ ] == EOS )
            {
                if( 
g_iItemsPlayer_Suspended ] || g_iItemsPlayer_Prefix ][ ] == EOS 
                {
                    return 
PLUGIN_CONTINUE;
                }
                
                if( ! 
szArgs] )
                {
                    return 
PLUGIN_HANDLED;
                }
                
                else
                {
                    if( 
is_user_aliveid ) )
                    {        
                        switch( 
get_user_teamid ) )
                        {
                        case 
12:
                            {
                                
CC_SendMessage0"&x04%s &x03%s&x01: &x04%s"g_iItemsPlayer_Prefix ], szNameszArgs );
                                return 
PLUGIN_HANDLED_MAIN;
                            }
                        case 
3:
                            {
                                
CC_SendMessage0"&x03%s &x04%s &x03%s&x01: &x04%s"g_iConfigSPECTATOR_PREFIX ], g_iItemsPlayer_Prefix ], szNameszArgs );
                                return 
PLUGIN_HANDLED_MAIN;
                            }                        
                        }
                    }
                    else
                    {
                        
CC_SendMessage0"&x03%s &x04%s &x03%s&x01: &x04%s"g_iConfigDEAD_PREFIX ], g_iItemsPlayer_Prefix ], szNameszArgs );
                        return 
PLUGIN_HANDLED_MAIN;
                    }
                }
            }
        }
    }
    return 
PLUGIN_CONTINUE;
}

CheckPlayerAdmin( const id )
{
    new 
g_iItemsPlayerData ];

    new 
szName32 ], szAuthID32 ], szPassword22 ];

    
get_user_nameidszNamecharsmaxszName ) );
    
get_user_authididszAuthIDcharsmaxszAuthID ) );
    
get_user_infoid"_pw"szPasswordcharsmaxszPassword ) );
    
    for( new 
iIndexiIndex ArraySizeg_aDatabase ); iIndex++ )
    {
        
ArrayGetArrayg_aDatabaseiIndexg_iItems );
        
        if( 
equalg_iItemsPlayer_Name ], szName ) || equalg_iItemsPlayer_Name ], szAuthID ) )
        {
            if( 
equalg_iItemsPlayer_Password ], szPassword ) || g_iItemsPlayer_Password ][ ] == EOS )
            {                
                if( 
g_iItemsPlayer_Suspended ] ) 
                {
                    
remove_user_flagsid );
                    
set_user_flagsidADMIN_USER );
                }
                
                else
                {
                    
remove_user_flagsid );
                    
set_user_flagsidread_flagsg_iItemsPlayer_AccessFlags ] ) );
                }                
            }
            
            else if( ! 
equalg_iItemsPlayer_Password ], szPassword ) )
            {
                
server_cmd"kick #%d ^"Incorrect Password^""get_user_useridid ) );  
            }            
        } 
    }
}

ReloadFile( )
{
    
ArrayClearg_aDatabase );

    new 
g_iItemsPlayerData ];

    new 
szFormat64 ], szPlayerData128 ];    
    
formatexszFormatcharsmaxszFormat ), "%s/%s"g_szConfigsg_iConfigUSERS_FILE ] );
    
    new 
iFile fopenszFormat"rt" );
    
    if( 
iFile )
    {
        while( 
fgetsiFileszPlayerDatacharsmaxszPlayerData ) ) )
        {
            
trimszPlayerData );
            
            switch( 
szPlayerData] )
            {
            case 
EOS'#''/':
                {
                    continue;
                }
                
            default:
                {
                    
parseszPlayerDatag_iItemsPlayer_Name ], charsmaxg_iItemsPlayer_Name ] ), g_iItemsPlayer_Password ], charsmaxg_iItemsPlayer_Password ] ), g_iItemsPlayer_AccessFlags ], 
                    
charsmaxg_iItemsPlayer_AccessFlags ] ), g_iItemsPlayer_Prefix ], charsmaxg_iItemsPlayer_Prefix ] ), g_iItemsPlayer_Model_T ], charsmaxg_iItemsPlayer_Model_T ] ), 
                    
g_iItemsPlayer_Model_CT ], charsmaxg_iItemsPlayer_Model_CT ] ), g_iItemsPlayer_Immunity ], charsmaxg_iItemsPlayer_Immunity ] ), g_iItemsPlayer_Expire_Date ], charsmaxg_iItemsPlayer_Expire_Date ] ) );
                    
                    if( 
szPlayerData] == ';' )
                    {
                        
g_iItemsPlayer_Suspended ] = true;                        
                        
replaceg_iItemsPlayer_Name ], charsmaxg_iItemsPlayer_Name ] ), ";""" );
                    }
                    
                    if( 
g_iItemsPlayer_Expire_Date ][ ] )
                    {
                        if( 
HasAdminExpiredg_iItemsPlayer_Expire_Date ] ) )
                        {
                            
g_iItemsPlayer_Suspended ] = true;
                        }
                    }
                    
                    
ArrayPushArrayg_aDatabaseg_iItems );
                    
arraysetg_iItems0sizeofg_iItems ) );
                }
            }
        }
        
fcloseiFile );
    }
}

ReadIni( )
{
    new 
szFile64 ], szData256 ];
    
    
formatexszFilecharsmaxszFile ), "%s/%s"g_szConfigsg_szConfigFile );
    
    new 
iFile fopenszFile"rt" );
    
    if( 
iFile )
    {
        while( 
fgetsiFileszDatacharsmaxszData ) ) )
        {    
            
trimszData );
            
remove_quotesszData );
            
            switch( 
szData] )
            {
            case 
EOS'#'';''/'
                {
                    continue;
                }

            default:
                {
                    new 
szKey32 ], szValue32 ];
                    
strtokszDataszKeycharsmaxszKey ), szValuecharsmaxszValue ), '=' );
                    
trimszKey ); 
                    
trimszValue );
                    
                    
remove_quotesszKey );
                    
remove_quotesszValue );
                    
                    if( ! 
szValue] )
                    {
                        continue;
                    }
                    
                    if( 
equalszKey"DEAD_PREFIX" ) )
                    {
                        
g_iConfigDEAD_PREFIX ] = szValue;
                    }
                    
                    else if( 
equalszKey"SPECTATOR_PREFIX" ) )
                    {
                        
g_iConfigSPECTATOR_PREFIX ] = szValue;
                    }
                    
                    else if( 
equalszKey"COMMAND_ADDADMIN" ) )
                    {
                        
g_iConfigCOMMAND_ADDADMIN ] = szValue;
                    }
                    
                    else if( 
equalszKey"ADMIN_ADD_FLAG" ) )
                    {
                        
g_iConfigADMIN_ADD_FLAG ] = read_flagsszValue );
                    }
                    
                    else if( 
equalszKey"USERS_FILE" ) )
                    {
                        
g_iConfigUSERS_FILE ] = szValue;
                    }
                    
                    else if( 
equalszKey"SYSTEM_PREFIX" ) )
                    {
                        
g_iConfigSYSTEM_PREFIX ] = szValue;
                    }
                    
                    else if( 
equalszKey"TIME_CHECK_ADMINS" ) )
                    {
                        
g_iConfigTIME_CHECK_ADMINS ] = _:str_to_floatszValue );
                    }
                    
                    else if( 
equalszKey"BANS_FILE" ) )
                    {
                        
g_iConfigBANS_FILE ] = szValue;
                    }
                    
                    else if( 
equalszKey"LOGS_FILE" ) )
                    {
                        
g_iConfigLOGS_FILE ] = szValue;
                    }
                    
                    else if( 
equalszKey"NO_ACCESS_COMMAND" ) )
                    {
                        
g_iConfigNO_ACCESS_COMMAND ] = szValue;
                    }
                }
            }
        }
        
fcloseiFile );
    }
}

CheckDirectory( )
{
    new 
szUsersFile256 ], szBansFile256 ], szConfigFile256 ];

    
formatexszUsersFilecharsmaxszUsersFile ), "%s/%s"g_szConfigsg_iConfigUSERS_FILE ] );
    
formatexszBansFilecharsmaxszBansFile ), "%s/%s"g_szConfigsg_iConfigBANS_FILE ] );
    
formatexszConfigFilecharsmaxszConfigFile ), "%s/%s"g_szConfigsg_szConfigFile );
    
    new 
iFile;
    
    if( ! 
file_existsszUsersFile ) )
    {
        
iFile fopenszUsersFile"w" );
        
        
fcloseiFile );
    }

    if( ! 
file_existsszBansFile ) )
    {
        
iFile fopenszBansFile"w" );
        
        
fcloseiFile );
    }

    if( ! 
file_existsszConfigFile ) )
    {
        
iFile fopenszConfigFile"w" );

        
fcloseiFile );
    }
    return 
1;
}

bool:HasAdminExpired( const szDate[ ] )
{
    return 
get_systime( ) >= parse_timeszDate"%m/%d/%Y - %H:%M:%S" );  

__________________
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-12-2019 , 15:00   Re: Colorchat ^3 showing wrong team color
Reply With Quote #6

You're sending a message to all players at once (using 0 as the index in CC_SendMessage). This means that players will see &x03 as the color of THEIR team, not the team of the player who wrote the message. So, if you're a zombie/terrorist, you will get the message in red, even if the person who sent it is CT/human.

You need to use CC_SendMatched and force the message to use the sender's team color instead.

PHP Code:
// Send a message to all players by matching id's team color.
CC_SendMatched(0id"message"
__________________

Last edited by OciXCrom; 05-12-2019 at 15:01.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 05-12-2019 , 15:27   Re: Colorchat ^3 showing wrong team color
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
You're sending a message to all players at once (using 0 as the index in CC_SendMessage). This means that players will see &x03 as the color of THEIR team, not the team of the player who wrote the message. So, if you're a zombie/terrorist, you will get the message in red, even if the person who sent it is CT/human.

You need to use CC_SendMatched and force the message to use the sender's team color instead.

PHP Code:
// Send a message to all players by matching id's team color.
CC_SendMatched(0id"message"
Makes sense, am I using the stock wrong? It still happens.
PHP Code:
CC_SendMatched0id"&x04%s &x03%s&x01: &x04%s"g_iItemsPlayer_Prefix ], szNameszArgs ); 
__________________

Last edited by edon1337; 05-12-2019 at 15:47.
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-12-2019 , 16:14   Re: Colorchat ^3 showing wrong team color
Reply With Quote #8

It's correct. If it's still happening, it may be that some other plugin is interfering with the teams. Not sure what else can be causing this.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 05-14-2019 , 12:27   Re: Colorchat ^3 showing wrong team color
Reply With Quote #9

Quote:
Originally Posted by OciXCrom View Post
It's correct. If it's still happening, it may be that some other plugin is interfering with the teams. Not sure what else can be causing this.
The plugin that sets the prefix is at the top of the .ini file and I disabled all the possible plugins that could interfere, but it still happens, I think this is a include-side problem.
__________________
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-14-2019 , 17:44   Re: Colorchat ^3 showing wrong team color
Reply With Quote #10

I don't really think it's a problem from the include, because it gets the user's team in the exact moment when sending the message. It may be something else.

If you can test it, try adding another message with the default "client_print_color" function using ^3 and see if that one will have the correct color in the moment when the other one doesn't.
__________________

Last edited by OciXCrom; 05-14-2019 at 17:45.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 17:30.


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