|
 coolzsb
今天编译MATCH_DELUXE插件遇到一些麻烦
很棘手。。。所以求助于你
我找到一个amx match manager的插件
他可以把比分显示以工具条的形式放到玩家的chat栏位置
玩家可以通过say info来选择打开或者关闭此工具栏,下面是那个功能的具体代码:
public toggle_scores(id)
{
if ((is_user_bot(id))||(id==0)||(match_inprogress<1))
return PLUGIN_CONTINUE
if (match_info_off[id]) {
match_info_off[id] = 0
update_score(id)
client_print(id,print_chat,"* [AMX MM] Match info is now on (say 'info' to turn it off).")
}
else {
match_info_off[id] = 1
message_begin( MSG_ONE, gmsgStatusText, {0,0,0}, id)
write_byte(0)
write_string("")
message_end()
client_print(id,print_chat,"* [AMX MM] Match info is now off (say 'info' to turn it back on).")
}
return PLUGIN_CONTINUE
}
public update_score(id)
{
if ((is_user_bot(id))||(id==0)||(match_info_off[id])||(matchtype1 == 2))
return PLUGIN_CONTINUE
new status[64]
if (match_inprogress == 0)
format(status,63,"")
if (match_inprogress == 1)
format(status,63,"Warmup before 1st half")
if ((match_inprogress == 2)||(match_inprogress == 5)) {
if ((ct_score[1]+t_score[1])==matchtype2)
format(status,63,"%s (%i / %i) %s - 1st half finished",(cmdtype==1) ? clanCT : "CT",ct_score[1],t_score[1],(cmdtype==1) ? clanT : "Terrorist")
else
format(status,63,"%s (%i / %i) %s - %i %s left",(cmdtype==1) ? clanCT : "CT",ct_score[1],t_score[1],(cmdtype==1) ? clanT : "Terrorist",(matchtype2-ct_score[1]-t_score[1]),((ct_score[1]+t_score[1])==(matchtype2-1)) ? "round" : "rounds")
}
if (match_inprogress == 3)
format(status,63,"Warmup before 2nd half")
if ((match_inprogress == 4)||(match_inprogress == 6)) {
if (cmdtype==1) {
if ((ct_score[1]+t_score[1])==matchtype2)
format(status,63,"%s (%i / %i) %s - 2nd half finished",clanCT,(ct_score[0]+t_score[1]),(t_score[0]+ct_score[1]),clanT)
else
format(status,63,"%s (%i / %i) %s - %i %s left",clanCT,(ct_score[0]+t_score[1]),(t_score[0]+ct_score[1]),clanT,(matchtype2-ct_score[1]-t_score[1]),((ct_score[1]+t_score[1])==(matchtype2-1)) ? "round" : "rounds")
}
else {
if ((ct_score[1]+t_score[1])==matchtype2)
format(status,63,"%s (%i / %i) %s - 2nd half finished","CT",(t_score[0]+ct_score[1]),(ct_score[0]+t_score[1]),"Terrorist")
else
format(status,63,"%s (%i / %i) %s - %i %s left","CT",(t_score[0]+ct_score[1]),(ct_score[0]+t_score[1]),"Terrorist",(matchtype2-ct_score[1]-t_score[1]),((ct_score[1]+t_score[1])==(matchtype2-1)) ? "round" : "rounds")
}
}
message_begin( MSG_ONE, gmsgStatusText, {0,0,0}, id)
write_byte(0)
write_string(status)
message_end()
return PLUGIN_CONTINUE
}
然后是新增加的注册命令:
register_clcmd("say info","toggle_scores")
register_clcmd("say_team info","toggle_scores")
其中大部分的函数与match_deluxe相同的,可以共用(因为作者本来就是在此插件基础上融合其他插件的功能修改出来的),后来编译的时候总是因为无效组件无法编译,于是我把前面的函数声明也加了进去
new match_info_off[33],SpecName[16],gmsgStatusText,gmsgSayText,gmsg_TeamInfo
这个是match manager插件的新的声明,我把SpecName[16],gmsgSayText,gmsg_TeamInfo等无用的(至少我在那段功能代码里没有看到使用)函数去掉了,最后终于编译成功了。
可是当我使用新的比赛插件的时候say info,服务器却down掉了
然后显示:L 06/26/2003 - 17:25:49: FATAL ERROR (shutting down): Tried to create a message with a bogus message type ( 0 )
试图产生一个不存在的信息(服务器关闭)
这次真是郁闷了,无语了,所以只好来求助了。。。
最后送上三个插件的代码,one is match manager, one is match_dluxe original code, and the other is match_deluxe edit version by becking :]
希望能够尽快得到答复,功能很小,但从中可以知道许多函数的功能和左右
PS: 最后以个问题new match_info_off[33]后面的[33]是虾米东西啊??为什么其他的new symbol后面的数字不一样呢?麻烦解释。。。:)thx。。。。
我没学过C所以这么多问题,^_^。。麻烦了 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|