Raised This Month: $ Target: $400
 0% 

need help with color chat


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:18.


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