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

[color chat]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 12-01-2009 , 10:40   [color chat]
Reply With Quote #1

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:
/*
*
* @param  id -- set 0 to all player on server, else to one player who index equal id.
* @param  cid -- get the color index, don't set it equal 0.
* @param  color -- set the color (0 -- don't change; 1 -- Red color; 2 -- Blue color; 3 -- Grey color)
* @param  message -- cons message.
*
*/
public print_color(idcidcolor, const message[], any:...)
{
 new 
msg[192]
 
vformat(msgcharsmax(msg), message5)
 
/*      //if you want to use ML, enable
 replace_all(msg, charsmax(msg), "!g", "^x04")
 replace_all(msg, charsmax(msg), "!n", "^x01")
 replace_all(msg, charsmax(msg), "!t", "^x03")*/
 
new param
 
if (!cid) return
 else 
param cid
 
new team[32]
 
get_user_team(paramteam31)
 switch (
color)
 {
  case 
0msg_teaminfo(paramteam)
  case 
1msg_teaminfo(param"TERRORIST")
  case 
2msg_teaminfo(param"CT")
  case 
3msg_teaminfo(param"SPECTATOR")
 }
 if (
idmsg_saytext(idparammsg)
 else 
msg_saytext(0parammsg)
 if (
color != 0msg_teaminfo(paramteam)
}
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
__________________
QQ:116268742

Last edited by K.K.Lv; 12-02-2009 at 00:20.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
 



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


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