AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   need help with color chat (https://forums.alliedmods.net/showthread.php?t=143502)

dejan 11-20-2010 18:27

need help with color chat
 
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();
        }
    }



fysiks 11-20-2010 18:50

Re: need help with color chat
 
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.

vato loco [GE-S] 11-20-2010 20:08

Re: need help with color chat
 
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



shadow.hk 11-20-2010 23:34

Re: need help with color chat
 
Use Colorchat include.

Which is pretty much what vato loco copy-pasted.


All times are GMT -4. The time now is 11:18.

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