LittleKu 发表于 2009-12-2 19:30:01

由本人自己研究写的[COLOR CHAT]

本代码在三大论坛同时发布

异度
AMXX官方论坛
点通论坛

代码如下:/*
*
* @paramid -- set 0 to all player on server, else to one player who index equal id.
* @paramcid -- get the color index, don't set it equal 0.
* @paramcolor -- set the color (0 -- don't change; 1 -- Red color; 2 -- Blue color; 3 -- Grey color)
* @parammessage -- cons message.
*
*/
public print_color(id, cid, color, const message[], any:...)
{
new msg
vformat(msg, charsmax(msg), message, 5)
/*      //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
get_user_team(param, team, 31)
switch (color)
{
case 0: msg_teaminfo(param, team)
case 1: msg_teaminfo(param, "TERRORIST")
case 2: msg_teaminfo(param, "CT")
case 3: msg_teaminfo(param, "SPECTATOR")
}
if (id) msg_saytext(id, param, msg)
else msg_saytext(0, param, msg)
if (color != 0) msg_teaminfo(param, team)
}
msg_saytext(id, cid, msg[])
{
message_begin(id?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(cid)
write_string(msg)
message_end()
}
msg_teaminfo(id, team[])
{
message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, id)
write_byte(id)
write_string(team)
message_end()
}
为了方便各位朋友,就在原创区发表了!希望能给大家带来方便!:)
用法如下:print_color(id, cid, color, const message[], any:...)

rsdtt 发表于 2009-12-2 20:14:29

彩色聊天?

INSUN 发表于 2009-12-2 20:26:13

板凳支持

yesterday 发表于 2009-12-2 20:40:14

支持楼主,谢谢分享

alangong 发表于 2009-12-3 04:12:20

支持KK,下了测试

xuwenqi 发表于 2009-12-4 13:53:48

这个不错,可以自由控制CHAT显示的颜色(以前一直用玩家队伍来判定颜色)

tides 发表于 2010-2-11 12:02:54

嗯,支持

liangxiaomao 发表于 2010-2-11 12:14:12

支持楼主,谢谢分享

renruntan 发表于 2010-12-27 23:05:55

支持楼主,谢谢分享
但愿1.5可以使用

Ayune2 发表于 2011-1-9 09:45:11

上图啊············
页: [1] 2
查看完整版本: 由本人自己研究写的[COLOR CHAT]