Raised This Month: $ Target: $400
 0% 

Colorchat not working properly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-12-2013 , 17:11   Colorchat not working properly
Reply With Quote #1

Okay so I'm using Connor's API for colorchat and I'm getting a weird problem:
http://i.imgur.com/SMnJpim.jpg

Never encountered this before, no idea what's wrong. HLDS build hs the latest one, using windows 7 x64.

The code:

PHP Code:
#include < amxmodx >
#include < geoip >
#include < cstrike >
#include < chatcolor >


enum _:SteamIdData
{
    
_szName32 ],
    
_szSteamId34 ]
}

enum _:AdminRightsData
{
    
_szName32 ],
    
_iBitFlags
}

// CONFIG START

new const g_SteamIdPrefixes[ ][ SteamIdData ] = 
{
    { 
"Majitel",        "STEAM_0:0:00000000" },
    { 
"Globalny Admin",    "STEAM_0:0:00000000" }
}


new const 
g_AdminRightsPrefixes[ ][ AdminRightsData ] = 
{
    { 
"Hl. Admin",        ADMIN_IMMUNITY },
    { 
"Admin",        ADMIN_BAN },
    { 
"Apprentice",        ADMIN_KICK },
    { 
"VIP",        ADMIN_LEVEL_H },
    { 
"ExtraVIP",        ADMIN_LEVEL_G }
}

new const 
g_NormalPlayerPrefix[ ] = "Player"

// CONFIG END


/* COLORCHAT 
enum { 
    Grey = 33, 
    Red, 
    Blue 
}
*/    
new const g_szTeamNamesCsTeams ][ ] = 

    
"Spectator",
    
"Terrorist"
    
"Counter-Terrorist"
    
"Spectator" 
}


public 
plugin_init( )
{
    
register_plugin"Prefix pred jmenem""1.0""IdiotStrike" )
    
    
register_clcmd"say""_cSay" 
    
register_clcmd"say_team""_cSayTeam" )
    
    
register_clcmd"say /test""client_putinserver" )
}

public 
_cSayid )
{
    new 
szMessage192 ]
    
    
read_argsszMessagecharsmaxszMessage ) )
    
remove_quotesszMessage )
    
    if( !
UTIL_IsMessageValidszMessage ) )
        return 
PLUGIN_HANDLED
    
    
new szName32 ]
    
get_user_nameidszNamecharsmaxszName ) )
    
    new 
boolbAlive boolis_user_aliveid )
    
    new 
szTag]
    
    if( 
cs_get_user_teamid ) == CS_TEAM_SPECTATOR )
    {
        
copyszTagcharsmaxszTag ), "*SPEC* " )
    }
    else if( !
bAlive )
    {
        
copyszTagcharsmaxszTag ), "*DEAD* " )
    }
    
    new 
szPrefix32 ], szSteamId34 ]
    
get_user_authididszSteamIdcharsmaxszSteamId ) )
    
    new 
iSteamIdPrefixId = -1iAdminRightsPrefixId = -1
    
    
for( new isizeof g_SteamIdPrefixes++ )
    {
        if( 
equalszSteamIdg_SteamIdPrefixes][ _szSteamId ] ) )
        {
            
iSteamIdPrefixId i
            
break
        }
    }
    
    if( 
iSteamIdPrefixId == -)
    {
        new 
iBitFlags get_user_flagsid )
        
        for( new 
isizeof g_AdminRightsPrefixes++ )
        {
            if( 
iBitFlags g_AdminRightsPrefixes][ _iBitFlags ] )
            {
                
iAdminRightsPrefixId i
            
}
        }
    }
    
    if( 
iSteamIdPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_SteamIdPrefixesiSteamIdPrefixId ][ _szName ] )
    }
    else if( 
iAdminRightsPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_AdminRightsPrefixesiAdminRightsPrefixId ][ _szName ] )
    }
    else
    {
        
copyszPrefixcharsmaxszPrefix ), g_NormalPlayerPrefix )
    }
    
    new 
szMessage2192 ]
    
formatexszMessage2charsmaxszMessage2 ), "[^4%s^1] %s^3%s^1 :  %s"szPrefixszTagszNameszMessage )
    
    
    new 
aPlayers32 ], iNumidPlayer
    get_players
aPlayersiNum )
    
    new 
boolbAlive2
    
    
for( new iiNum++ )
    {
        
idPlayer aPlayers]
        
        
bAlive2 boolis_user_aliveidPlayer )
        
        if( 
bAlive != bAlive2 )
            continue
        
        
client_print_coloridPlayeridszMessage2 )
    }
    
    return 
PLUGIN_HANDLED_MAIN
}

public 
_cSayTeamid )
{
    new 
szMessage192 ]
    
    
read_argsszMessagecharsmaxszMessage ) )
    
remove_quotesszMessage )
    
    if( !
UTIL_IsMessageValidszMessage ) )
        return 
PLUGIN_HANDLED
    
    
new szName32 ]
    
get_user_nameidszNamecharsmaxszName ) )
    
    new 
boolbAlive boolis_user_aliveid )
    new 
CsTeamsiTeam cs_get_user_teamid )
    
    new 
szPrefix32 ], szSteamId34 ]
    
get_user_authididszSteamIdcharsmaxszSteamId ) )
    
    new 
iSteamIdPrefixId = -1iAdminRightsPrefixId = -1
    
    
for( new isizeof g_SteamIdPrefixes++ )
    {
        if( 
equalszSteamIdg_SteamIdPrefixes][ _szSteamId ] ) )
        {
            
iSteamIdPrefixId i
            
break
        }
    }
    
    if( 
iSteamIdPrefixId == -)
    {
        new 
iBitFlags get_user_flagsid )
        
        for( new 
isizeof g_AdminRightsPrefixes++ )
        {
            if( 
iBitFlags g_AdminRightsPrefixes][ _iBitFlags ] )
            {
                
iAdminRightsPrefixId i
            
}
        }
    }
    
    if( 
iSteamIdPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_SteamIdPrefixesiSteamIdPrefixId ][ _szName ] )
    }
    else if( 
iAdminRightsPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_AdminRightsPrefixesiAdminRightsPrefixId ][ _szName ] )
    }
    else
    {
        
copyszPrefixcharsmaxszPrefix ), g_NormalPlayerPrefix )
    }
    
    new 
szMessage2192 ]
    
formatexszMessage2charsmaxszMessage2 ), "[^4%s^1] %s(%s) ^3%s^1 :  %s"szPrefixbAlive "" "*DEAD* "g_szTeamNamesiTeam ], szNameszMessage )
    
    new 
aPlayers32 ], iNumidPlayer
    get_players
aPlayersiNum )
    
    new 
boolbAlive2CsTeamsiTeam2
    
    
for( new iiNum++ )
    {
        
idPlayer aPlayers]
        
        
bAlive2 boolis_user_aliveidPlayer )
        
iTeam2 cs_get_user_teamidPlayer )
        
        if( 
bAlive != bAlive2 || iTeam != iTeam2 )
            continue
        
        
client_print_coloridPlayeridszMessage2 )
    }
    
    return 
PLUGIN_HANDLED_MAIN
}

    
public 
client_putinserverid )
{
    
    new 
szName32 ], szIp15 ], szSteamId34 ], szCountry45 ]
    
    
get_user_nameidszNamecharsmaxszName ) )
    
get_user_ipidszIpcharsmaxszIp ), )
    
get_user_authididszSteamIdcharsmaxszSteamId ) )
    
geoip_countryszIpszCountrycharsmaxszCountry ) )
    
    new 
iSteamIdPrefixId = -1iAdminRightsPrefixId = -1
    
    
for( new isizeof g_SteamIdPrefixes++ )
    {
        if( 
equalszSteamIdg_SteamIdPrefixes][ _szSteamId ] ) )
        {
            
iSteamIdPrefixId i
            
break
        }
    }
    
    if( 
iSteamIdPrefixId == -)
    {
        new 
iBitFlags get_user_flagsid )
        
        for( new 
isizeof g_AdminRightsPrefixes++ )
        {
            if( 
iBitFlags g_AdminRightsPrefixes][ _iBitFlags ] )
            {
                
iAdminRightsPrefixId i
            
}
        }
    }
    
    new 
szPrefix32 ]
    
    if( 
iSteamIdPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_SteamIdPrefixesiSteamIdPrefixId ][ _szName ] )
    }
    else if( 
iAdminRightsPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_AdminRightsPrefixesiAdminRightsPrefixId ][ _szName ] )
    }
    else
    {
        
copyszPrefixcharsmaxszPrefix ), g_NormalPlayerPrefix )
    }
    
    
client_print_color0Grey"*^4[^3%s^4]^1* ^4%s^1 s IP ^3%s ^1 sa pripojil (^3%s^1)^1"szPrefixszNameszIpszCountry )
    
}

public 
client_disconnectid )
{
    new 
szName32 ], szSteamId34 ]
    
    
get_user_nameidszNamecharsmaxszName ) )
    
get_user_authididszSteamIdcharsmaxszSteamId ) )
    
    new 
iSteamIdPrefixId = -1iAdminRightsPrefixId = -1
    
    
for( new isizeof g_SteamIdPrefixes++ )
    {
        if( 
equalszSteamIdg_SteamIdPrefixes][ _szSteamId ] ) )
        {
            
iSteamIdPrefixId i
            
break
        }
    }
    
    if( 
iSteamIdPrefixId == -)
    {
        new 
iBitFlags get_user_flagsid )
        
        for( new 
isizeof g_AdminRightsPrefixes++ )
        {
            if( 
iBitFlags g_AdminRightsPrefixes][ _iBitFlags ] )
            {
                
iAdminRightsPrefixId i
            
}
        }
    }
    
    new 
szPrefix32 ]
    
    if( 
iSteamIdPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_SteamIdPrefixesiSteamIdPrefixId ][ _szName ] )
    }
    else if( 
iAdminRightsPrefixId != -)
    {
        
copyszPrefixcharsmaxszPrefix ), g_AdminRightsPrefixesiAdminRightsPrefixId ][ _szName ] )
    }
    else
    {
        
copyszPrefixcharsmaxszPrefix ), g_NormalPlayerPrefix )
    }
    
    
client_print_color0Red"*^4[^3%s^4]^1* ^4%s^1 sa odpojil (^3%d^1 min.)^1"szPrefixszNameget_user_timeid ) / 60 )
    
}
    
boolUTIL_IsMessageValid( const said[ ] ) 

    for( new 
0said]; i++ )
    { 
        if( 
said] != ' ' 
        { 
            return 
true
        

    } 
     
    return 
false

Any ideas?
Backstabnoob is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 11-12-2013 , 19:42   Re: Colorchat not working properly
Reply With Quote #2

Simple, you are using what build of amxmodx?

because the client_print_color command it is a same from last dev build.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-13-2013 , 03:06   Re: Colorchat not working properly
Reply With Quote #3

that's not the problem since other plugins work fine. I use the latest stable 1.8.2 and I'd rather not use a dev build.
Backstabnoob is offline
kHRYSTER
New Member
Join Date: Nov 2013
Old 11-13-2013 , 06:38   Re: Colorchat not working properly
Reply With Quote #4

Use chatcolor.inc and this lines ur sources:

PHP Code:
stock print_color(const id, const input[], any:...)
{
new 
count 1players[32]
static 
msg[191]
vformat(msg190input3)

replace_all(msg190"!g""^4")
replace_all(msg190"!y""^1")
replace_all(msg190"!t""^3")
replace_all(msg190"""á")
replace_all(msg190"""Ă")
replace_all(msg190"""Ă")
replace_all(msg190"""Ăł")
replace_all(msg190"""Ă")
replace_all(msg190"ő""Ĺ")
replace_all(msg190"""Ăş")
replace_all(msg190"""ĂĽ")
replace_all(msg190"ű""Ĺ")
replace_all(msg190"""Ă")
replace_all(msg190"""Ă")
replace_all(msg190"""ĂŤ")
replace_all(msg190"""Ă")
replace_all(msg190"""Ă")
replace_all(msg190"Ő""Ĺ")
replace_all(msg190"""Ă")
replace_all(msg190"""Ăś")
replace_all(msg190"Ű""Ĺ")
 
if (
idplayers[0] = id; else get_players(playerscount"ch")
{
for (new 
0counti++)
{
if (
is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
return 
PLUGIN_HANDLED

Attached Files
File Type: inc colorchat.inc (2.4 KB, 91 views)

Last edited by kHRYSTER; 11-13-2013 at 06:38.
kHRYSTER is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 11-13-2013 , 07:00   Re: Colorchat not working properly
Reply With Quote #5

Happened to me before, can't remmeber how did I fix it......
Try starting your chat message with ^4 or anything ...
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 11-13-2013 at 07:04.
pokemonmaster is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-13-2013 , 09:59   Re: Colorchat not working properly
Reply With Quote #6

Quote:
Originally Posted by pokemonmaster View Post
Happened to me before, can't remmeber how did I fix it......
Try starting your chat message with ^4 or anything ...
Weird, but it seems to have solved it.

Many thanks, I feel like this should be visible somewhere though.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-13-2013 , 10:54   Re: Colorchat not working properly
Reply With Quote #7

Message HAS to start with ^1, ^2, ^3 or ^4
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 23:17.


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