搜索
楼主: cityhonghu

client_coler的使用方法?(rulzy版主请进)(消化中)

[复制链接]
发表于 2009-10-4 10:49:35 | 显示全部楼层 来自 福建漳州
完整的SayText消息的结构是这样的:
byte  SenderID
string  String1
string  String2
string  String3

这里的SenderID就是指colorid,string1即是client_color中的msg。string2和string3是可选的(即可有可无)。如果string1中包含%s,则根据需要增加string2和string3。上个帖子提到,对于string1="^x02%s",其实要求string2为空,否则显示不了玩家的名字的。现在写几个这个消息的例子:
  1. message_begin(MSG_ALL, get_user_msgid("SayText"), _, 0);
  2. write_byte(senderid);
  3. write_string("^x03%s1 : %s2");
  4. write_string("Text of s1");
  5. write_string("Text of s2");
  6. message_end();
复制代码
效果如下(假设我的名字是Rulzy,这里的senderid指的是我,我是CT。下同):
Text of s1 : Text of s2
  1. message_begin(MSG_ALL, get_user_msgid("SayText"), _, 0);
  2. write_byte(senderid);
  3. write_string("^x02%s1 : %s2");
  4. write_string("");
  5. write_string("Text");
  6. message_end();
复制代码
效果如下:
Rulzy : Text
回复

使用道具 举报

 楼主| 发表于 2009-10-4 11:44:35 | 显示全部楼层 来自 日本
谢谢rulzy版大详细讲解,有点多,稍后慢慢看了。
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表