Raised This Month: $12 Target: $400
 3% 

need help with color chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dejan
Senior Member
Join Date: Mar 2009
Location: Sweden
Old 11-20-2010 , 18:27   need help with color chat
Reply With Quote #1

how can i add the colors red and blue into this script?

PHP Code:
stock ChatColor(const id, const input[], any:...) 
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!t""^3"// Team Color
    
    
if (id
        
players[0] = id
    
else {
        
get_players(playerscount"ch"
        for (new 
0counti++) {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }

__________________
dejan is offline
Send a message via Skype™ to dejan
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-20-2010 , 18:50   Re: need help with color chat
Reply With Quote #2

Find a colorchat include that supports red and blue separately. However, you will never be able to use both red and blue in any single print.
__________________
fysiks is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 11-20-2010 , 20:08   Re: need help with color chat
Reply With Quote #3

try this
PHP Code:
enum color {
    
normal 1// clients scr_concolor cvar color
    
green,      // green Color
    
team,       // red, grey, blue
    
grey,       // grey
    
red,        // red
    
blue,       // blue
}

new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

ColorChat(const idcolor:type, const input[], any:...) {
    new 
count 1players[32], TeamColorChange
    
static msg[256]
    
    switch(
type
    {
        case 
normalmsg[0] = 0x01
            
        
case greenmsg[0] = 0x04
            
        
default: msg[0] = 0x03
        
    
}
    
vformat(msg[1], 255input4)
    
msg[192] = '^0'
    
    
replace_all(msg191"!g""^x04"// Green Color
    
replace_all(msg191"!y""^x01"// Default Color
    
replace_all(msg191"!t""^x03"// Team Color
    
    
if (id
        
players[0] = id
    
else 
        
get_players(playerscount"ch"
    
    for (new 
0counti++) 
    {
        
Team get_user_team(players[i])
        
ColorChange ColorSelection(players[i], type)
        
        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()
        }
        if(
ColorChange)
            
Team_Info(players[i], TeamName[Team])
    }
}

Team_Info(idTeam[]) {
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("TeamInfo"), _id)
    
write_byte(id)
    
write_string(Team)
    
message_end()
    
    return 
1
}

ColorSelection(idcolor:Type) {
    
    switch(
Type)
    {
        case 
red: return Team_Info(idTeamName[1])
            
        case 
blue: return Team_Info(idTeamName[2])
            
        case 
grey: return Team_Info(idTeamName[0])
            
    }
    return 
0

__________________
vato loco [GE-S] is offline
shadow.hk
Senior Member
Join Date: Dec 2008
Location: WA, Australia
Old 11-20-2010 , 23:34   Re: need help with color chat
Reply With Quote #4

Use Colorchat include.

Which is pretty much what vato loco copy-pasted.
shadow.hk is offline
Send a message via MSN to shadow.hk
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 16:02.


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