Thread: [color chat]
View Single Post
Cuchii
BANNED
Join Date: Sep 2009
Location: Cordoba,Argentina
Old 12-01-2009 , 12:00   Re: [color chat]
Reply With Quote #3

Quote:
Originally Posted by K.K.Lv View Post
Hi everyone, I just make another code can show color chat, I test it ,and work well, so I post it and hope some one can point out the bug if there is(are) bug(s), or if you think this code is so bad, please give me some good code than this ! because I don't think this topic and this topic is so good !

Note that: I come here for learning , so don't say anything hurt some one ! you can post your opinion here !

Thx all !!!

PHP Code:
public print_color(idcidcolormessage[])
{
 new 
team[32]
 
get_user_team(cidteam31)
 switch (
color)
 {
  case 
0msg_teaminfo(cidteam)
  case 
1msg_teaminfo(cid"TERRORIST")
  case 
2msg_teaminfo(cid"CT")
  case 
3msg_teaminfo(cid"SPECTATOR")
 }
 if (
idmsg_saytext(idcidmessage)
 else 
msg_saytext(0cidmessage)
 if (
color != 0msg_teaminfo(cidteam)
}
msg_saytext(idcidmsg[])
{
 
message_begin(id?MSG_ONE:MSG_ALLget_user_msgid("SayText"), {0,0,0}, id)
 
write_byte(cid)
 
write_string(msg)
 
message_end()
}
msg_teaminfo(idteam[])
{
 
message_begin(MSG_ONEget_user_msgid("TeamInfo"), {0,0,0}, id)
 
write_byte(id)
 
write_string(team)
 
message_end()

color settings:

0 -- Don't change
1 -- Red color
2 -- Blue color
3 -- Grey color
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"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
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();
            }
        }
    }

This was done by kiske...

I just brought it to this thread
Cuchii is offline
Send a message via MSN to Cuchii