Raised This Month: $ Target: $400
 0% 

[SOLVED]Again a Colorchat Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-04-2010 , 07:09   Again a Colorchat Problem
Reply With Quote #1

hi,

i tried to print Users name in Colorchat but idk why this not works.

PHP Code:
public startround()
{
    for ( new 
id0id g_maxPlayers;id++)
    {
        new 
users_frags get_user_frags(id)
        new 
users_deaths get_user_deaths(id
        new 
gerechnet users_frags users_deaths
        
        
new name[33]
        
get_user_name(id,name,32)
        if(
is_user_connected(id) && gerechnet >= 10 )
        {
            
ColorChat(id,RED,"\YELDu hast \GRN+%d Frags \YELund musst jetzt mit \GRNFunWaffen \YELSpielen!Schreibe \GRN/fungun \YELfuer mehr Info.",gerechnet)
            
ColorChat(0,NORMAL,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
            
ColorChat(0,NORMAL,"\TEM Das ist TEAMFARBE%s",name)
            
ColorChat(0,GREEN,"\TEM Das ist TEAMFARBE%s",name)
            
ColorChat(0,RED,"\TEM Das ist TEAMFARBE%s",name)
            
ColorChat(0,BLUE,"\TEM Das ist TEAMFARBE %s",name)
            
user_is_warned[id] = true
        
}
        else
        {
            
user_is_warned[id] = false
        
}
    }

colorchat code :

PHP Code:
ColorChatidColor:type, const szMessage[], {Float,Sql,Result,_}:... ) {
    if( !
get_playersnum( ) ) return;
    
    new 
message256 ];
    
    switch( 
type ) {
        case 
NORMALmessage[0] = 0x01;
        case 
GREENmessage[0] = 0x04;
        default: 
message[0] = 0x03;
    }
    
    
vformatmessage], 251szMessage);
    
    
message192 ] = '^0';
    
    
replace_allmessage191"\YEL""^1" );
    
replace_allmessage191"\GRN""^4" );
    
replace_allmessage191"\TEM""^3" );
    
    new 
iTeamColorChangeindexMSG_Type;
    
    if( 
id ) {
        
MSG_Type MSG_ONE_UNRELIABLE;
        
index id;
    } else {
        
index CC_FindPlayer();
        
MSG_Type MSG_BROADCAST;
    }
    
    
iTeam get_user_teamindex );
    
ColorChange CC_ColorSelection(indexMSG_Typetype);

    
CC_ShowColorMessage(indexMSG_Typemessage);
    
    if( 
ColorChange )
        
CC_Team_Info(indexMSG_TypeTeamName[iTeam]);
}

CC_ShowColorMessageidtypemessage[] ) {
    
message_begintypeg_iMsgSayText_id );
    
write_byteid );    
    
write_stringmessage );
    
message_end( );    
}

CC_FindPlayer( ) {
    for( new 
1<= g_maxPlayersi++ )
        if( 
is_user_alive(i) )
            return 
i;
    
    return -
1;
}
CC_ColorSelectionindextypeColor:Type ) {
    switch( 
Type ) {
        case 
RED: return CC_Team_InfoindextypeTeamName] );
        case 
BLUE: return CC_Team_InfoindextypeTeamName] );
    }
    
    return 
0;
}
CC_Team_Infoidtypeteam[] ) {
    
message_begintypeg_iMsgTeamInfo_id );
    
write_byteid );
    
write_stringteam );
    
message_end( );
    
    return 
1;

this should print something like this :

if is user T :

One blabla bla bla

if is user CT :

One bla bla bla bla


but what i get is just that what you can see in attached pic.

i have no idea why its so.
how you can see in pic. 3 of prints are in blue & only 1 is red.
user SNIPER is a T & all texts must be in RED
Attached Thumbnails
Click image for larger version

Name:	Unbenannt.jpg
Views:	152
Size:	92.4 KB
ID:	78489  
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 12-04-2010 , 08:02   Re: Again a Colorchat Problem
Reply With Quote #2

try this
PHP Code:
public startround()
{
    new 
name[32], users_fragsusers_deathsgerechnet 
    
    
for(new id id <= g_maxPlayers id++) 
    {
        if(
is_user_connected(id))
        {
            
users_frags get_user_frags(id)
            
users_deaths get_user_deaths(id
            
gerechnet users_frags users_death
            
            
if(gerechnet >= 10)
            {
                
get_user_name(idname31)
                
                
ColorChat(id,RED,"\YELDu hast \GRN+%d Frags \YELund musst jetzt mit \GRNFunWaffen \YELSpielen!Schreibe \GRN/fungun \YELfuer mehr Info.",gerechnet)
                
ColorChat(0,NORMAL,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
                
ColorChat(0,NORMAL,"\TEM Das ist TEAMFARBE%s",name)
                
ColorChat(0,GREEN,"\TEM Das ist TEAMFARBE%s",name)
                
ColorChat(0,RED,"\TEM Das ist TEAMFARBE%s",name)
                
ColorChat(0,BLUE,"\TEM Das ist TEAMFARBE %s",name)
                
user_is_warned[id] = true
            
}
        }
        else
        {
            
user_is_warned[id] = false
        
}
    }

__________________

Last edited by vato loco [GE-S]; 12-04-2010 at 08:11.
vato loco [GE-S] is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-04-2010 , 11:04   Re: Again a Colorchat Problem
Reply With Quote #3

nope...

check the attached pic. how you can see i'm T & my nickname is BLUE
& your code is like mine. its the same just you check if is user alive before checking frags...its for sure better but this cant solve the print problem



i think i have to get users team by print. something like :

if(cs_get_user_team(id) == cs_team_ct)
{
colorchat(0,BLUE,.............
}
else if(cs_get_user_team(id) == cs_team_t)
{
colorchat(0,RED,.........


i hope anyone has a better idea or colorchat native

PHP Code:
public startround()
{
    new 
name[32], users_fragsusers_deathsgerechnet 
    
    
for(new id id <= g_maxPlayers id++) 
    {
        if(
is_user_connected(id))
        {
            
users_frags get_user_frags(id)
            
users_deaths get_user_deaths(id
            
gerechnet users_frags users_deaths
            
            
if(gerechnet >= 10)
            {
                
get_user_name(idname31)
                
                
ColorChat(id,RED,"\YELDu hast \GRN+%d Frags \YELund musst jetzt mit \GRNFunWaffen \YELSpielen!Schreibe \GRN/fungun \YELfuer mehr Info.",gerechnet)
                
//ColorChat(0,NORMAL,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
                
if(cs_get_user_team(id) == CS_TEAM_CT)
                {
                    
ColorChat(0,NORMAL,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
                }
                else if(
cs_get_user_team(id) == CS_TEAM_T)
                {
                    
ColorChat(0,RED,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
                }
                
user_is_warned[id] = true
            
}
        }
        else
        {
            
user_is_warned[id] = false
        
}
    }

Attached Thumbnails
Click image for larger version

Name:	Unbenannt.jpg
Views:	94
Size:	99.3 KB
ID:	78497  
__________________

Last edited by One; 12-04-2010 at 11:31.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 12-04-2010 , 12:30   Re: Again a Colorchat Problem
Reply With Quote #4

Quote:
Originally Posted by One View Post
nope...

check the attached pic. how you can see i'm T & my nickname is BLUE
& your code is like mine. its the same just you check if is user alive before checking frags...its for sure better but this cant solve the print problem



i think i have to get users team by print. something like :

if(cs_get_user_team(id) == cs_team_ct)
{
colorchat(0,BLUE,.............
}
else if(cs_get_user_team(id) == cs_team_t)
{
colorchat(0,RED,.........


i hope anyone has a better idea or colorchat native

PHP Code:
public startround()
{
    new 
name[32], users_fragsusers_deathsgerechnet 
    
    
for(new id id <= g_maxPlayers id++) 
    {
        if(
is_user_connected(id))
        {
            
users_frags get_user_frags(id)
            
users_deaths get_user_deaths(id
            
gerechnet users_frags users_deaths
            
            
if(gerechnet >= 10)
            {
                
get_user_name(idname31)
                
                
ColorChat(id,RED,"\YELDu hast \GRN+%d Frags \YELund musst jetzt mit \GRNFunWaffen \YELSpielen!Schreibe \GRN/fungun \YELfuer mehr Info.",gerechnet)
                
//ColorChat(0,NORMAL,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
                
if(cs_get_user_team(id) == CS_TEAM_CT)
                {
                    
ColorChat(0,NORMAL,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
                }
                else if(
cs_get_user_team(id) == CS_TEAM_T)
                {
                    
ColorChat(0,RED,"\TEM%s \YELhat +%d Frags \YELund muss jetzt mit \GRNFunWaffen \YELSpielen!",name,gerechnet)
                }
                
user_is_warned[id] = true
            
}
        }
        else
        {
            
user_is_warned[id] = false
        
}
    }

I think color chat uses get_user_team to retrieve user's team and then mess it for the color message and according to Conner, get_user_team can return some false results some times so it would be better to replace that part in the include file with cs_get_user_team or it would be much better to use some other color chat function to achieve what u want
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 12-04-2010 , 13:22   Re: Again a Colorchat Problem
Reply With Quote #5

why don't you use simply colorchat.inc
__________________
vato loco [GE-S] is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 12-04-2010 , 13:36   Re: Again a Colorchat Problem
Reply With Quote #6

Quote:
Originally Posted by vato loco [GE-S] View Post
why don't you use simply colorchat.inc
It is the same thing ..
colorchat.inc also uses get_user_team which is buggy !
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-04-2010 , 13:44   Re: Again a Colorchat Problem
Reply With Quote #7

Why not just put that guy as sender, simple.
__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-04-2010 , 15:40   Re: Again a Colorchat Problem
Reply With Quote #8

ok ty for posts.
i got it but there a problem again :

Code:
ColorChat(0,TEAM_COLOR,"%s ^x01hat ^x04+%d Frags ^x01und muss jetzt mit ^x04FunWaffen ^x01Spielen!",name,gerechnet)
Printed text = User hat XX Frags und muss jetzt mit Ounwaffen spielen!

should be = user hat XX Frags und muss jetzt mit Funwaffen spielen!

idk why F willbe replaced to O ????!!
Attached Thumbnails
Click image for larger version

Name:	Unbenannt.JPG
Views:	143
Size:	96.9 KB
ID:	78503  
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-04-2010 , 16:27   Re: Again a Colorchat Problem
Reply With Quote #9

mit^x04 F
__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-04-2010 , 16:29   Re: Again a Colorchat Problem
Reply With Quote #10

yop. ty Xpaw. its now done
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 11:17.


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