搜索
查看: 2310|回复: 3

coolzsb来看看这段代码

[复制链接]
发表于 2003-6-22 14:36:25 | 显示全部楼层 |阅读模式 来自 中国–湖北–武汉
public new_score()
{
        if ((match_inprogress == 2)||(match_inprogress == 4)) { // Playing a half
                new team[32]
                read_data(1,team,31)
                if (equal(team,"CT"))
                        ct_score[1] = read_data(2)
                else {
                        if (equal(team,"TERRORIST"))
                                t_score[1] = read_data(2)
                }
                new show_score = get_cvar_num("amx_match_showscore")
                if (show_score) {
                        set_hudmessage(0, 100, 200, 0.05, 0.75, 0, 6.0, 6.0, 0.5, 0.15, 1)
                        if (match_inprogress == 2) {
                                if (ct_score[1] > t_score[1])
                                        show_hudmessage(0,"* [AMX MATCH] CT's are winning %d to %d",ct_score[1],t_score[1])
                                else {
                                        if (ct_score[1] < t_score[1])
                                                show_hudmessage(0,"* [AMX MATCH] T's are winning %d to %d",t_score[1],ct_score[1])
                                        else {
                                                if (ct_score[1] == t_score[1] && t_score[1] != 0)
                                                        show_hudmessage(0,"* [AMX MATCH] Both teams have won %d rounds",ct_score[1])
                                        }
                                }
                        }
                        else {
                                new total[2]
                                total[0] = ct_score[0] + t_score[1]
                                total[1] = t_score[0] + ct_score[1]
                                if (total[0] > total[1])
                                        show_hudmessage(0,"* [AMX MATCH] T's are winning %d to %d",total[0],total[1])
                                else {
                                        if (total[0] < total[1])
                                                show_hudmessage(0,"* [AMX MATCH] CT's are winning %d to %d",total[1],total[0])
                                        else {
                                                if (total[0] == total[1])
                                                        show_hudmessage(0,"* [AMX MATCH] Both teams have won %d rounds",total[0])
                                        }
                                }
                        }
                }
        }
        if (matchtype1 == 1) { //Playing mr
                if  ( (match_inprogress == 2) && ((ct_score[1] + t_score[1]) == matchtype2) ) { // Playing 1st half and it's finished
                        ct_score[0] = ct_score[1]
                        t_score[0] = t_score[1]
                        ct_score[1] = 0
                        t_score[1] = 0
                        new hudmsg[512]
                        format(hudmsg,511,"--[ 1st Half Finished. GH all ]--^n^nScore is: %s %i / %i %s%s^nWe are going back in warmup.",(cmdtype==1) ? clanCT : "CT",ct_score[0],t_score[0],(cmdtype==1) ? clanT : "T",(swap_type==1) ? "^n^nDON'T CHANGE YOUR TEAM! It's done automatically" : "")
                        set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 2.0, 8.0, 0.8, 0.8, 4)
                        show_hudmessage(0,hudmsg)
                        match_inprogress = 3
                        print_wonids()
                        take_screenshot()
                        set_task(2.0,"start_warmup")
                        if (recdemo > 0)
                                set_task(3.0,"stop_demo")
                        if (swap_type == 1)
                                set_task(5.0,"swap")
                }
                else {
                        if (match_inprogress == 4) { // Playing 2nd half
                                if ( ((ct_score[1] + t_score[1]) == matchtype2) || ((end_type == 1)&&( ((ct_score[0] + t_score[1]) == (matchtype2 + 1)) || ((t_score[0] + ct_score[1]) == (matchtype2 + 1)) )) ) { // 2nd half is finished
                                        ct_score[0] += t_score[1]
                                        t_score[0] += ct_score[1]
                                        new hudmsg[1024], pos
                                        pos = format(hudmsg,1023,"--[ Match Finished. GG all ]--^n^nAnd the winner of the map is...^n")
                                        if (ct_score[0] > t_score[0])
                                                format(hudmsg[pos],1023-pos,"%s with the score of %i/%i",(cmdtype==1) ? clanCT : "Current T team",ct_score[0],t_score[0])
                                        else {
                                                if (t_score[0] > ct_score[0])
                                                        format(hudmsg[pos],1023-pos,"%s with the score of %i/%i",(cmdtype==1) ? clanT : "Current CT team",t_score[0],ct_score[0])
                                                else
                                                        format(hudmsg[pos],1023-pos,"NONE!!! Both teams have %i wins.^n WHAT A MATCH!! :-D",ct_score[0])
                                        }
                                        set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 2.0, 8.0, 0.8, 0.8, 4)
                                        show_hudmessage(0,hudmsg)
                                        match_inprogress = 0
                                        print_wonids()
                                        take_screenshot()
                                        if (recdemo > 0)
                                                set_task(2.0,"stop_demo")
                                        set_task(3.0,"back_to_ffa")
                                }
                        }
                }
        }
        return PLUGIN_CONTINUE
}

这段是match_deluxe显示比赛双方比分的代码,但是过于简单了,我希望在比赛中显示以战队名分边的比分,这样比较好区分开来。
你认为该怎么修改一下????
就像这个图片显示的一样。。。
发表于 2003-6-22 22:01:56 | 显示全部楼层 来自 中国–广西–柳州
头好大好大,哈哈
回复

使用道具 举报

发表于 2003-6-22 22:27:47 | 显示全部楼层 来自 中国–福建–厦门

应该是这样了,你自己测试一下吧

该的眼睛都花掉了~~

public new_score()
{
if ((match_inprogress == 2)||(match_inprogress == 4)) { // Playing a half
new team[32]
read_data(1,team,31)
if (equal(team,"CT"))
ct_score[1] = read_data(2)
else {
if (equal(team,"TERRORIST"))
t_score[1] = read_data(2)
}
new show_score = get_cvar_num("amx_match_showscore")
if (show_score) {
set_hudmessage(0, 100, 200, 0.05, 0.75, 0, 6.0, 6.0, 0.5, 0.15, 1)
if (match_inprogress == 2) {
if (ct_score[1] > t_score[1])
show_hudmessage(0,"* [AMX MATCH] CT's are winning! %s:%d to %s:%d",clanCT,ct_score[1],clanT,t_score[1])
else {
if (ct_score[1] < t_score[1])
show_hudmessage(0,"* [AMX MATCH] T's are winning %s:%d to %s:%d",clanT,t_score[1],clanCT,ct_score[1])
else {
if (ct_score[1] == t_score[1] && t_score[1] != 0)
show_hudmessage(0,"* [AMX MATCH] Both teams have won %d rounds",ct_score[1])
}
}
}
else {
new total[2]
total[0] = ct_score[0] + t_score[1]
total[1] = t_score[0] + ct_score[1]
if (total[0] > total[1])
show_hudmessage(0,"* [AMX MATCH] T's are winning %s:%d to %s:%d",clanT,total[0],clanCT,total[1])
else {
if (total[0] < total[1])
show_hudmessage(0,"* [AMX MATCH] CT's are winning %s:%d to %s:%d",clanCT,total[1],clanT,total[0])
else {
if (total[0] == total[1])
show_hudmessage(0,"* [AMX MATCH] Both teams have won %d rounds",total[0])
}
}
}
}
}
if (matchtype1 == 1) { //Playing mr
if ( (match_inprogress == 2) && ((ct_score[1] + t_score[1]) == matchtype2) ) { // Playing 1st half and it's finished
ct_score[0] = ct_score[1]
t_score[0] = t_score[1]
ct_score[1] = 0
t_score[1] = 0
new hudmsg[512]
format(hudmsg,511,"--[ 1st Half Finished. GH all ]--^n^nScore is: %s %i / %s %i %s^nWe are going back in warmup.",clanCT ,ct_score[0],clanT,t_score[0],(swap_type==1) ? "^n^nDON'T CHANGE YOUR TEAM! It's done automatically" : "")
set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 2.0, 8.0, 0.8, 0.8, 4)
show_hudmessage(0,hudmsg)
match_inprogress = 3
print_wonids()
take_screenshot()
set_task(2.0,"start_warmup")
if (recdemo > 0)
set_task(3.0,"stop_demo")
if (swap_type == 1)
set_task(5.0,"swap")
}
else {
if (match_inprogress == 4) { // Playing 2nd half
if ( ((ct_score[1] + t_score[1]) == matchtype2) || ((end_type == 1)&&( ((ct_score[0] + t_score[1]) == (matchtype2 + 1)) || ((t_score[0] + ct_score[1]) == (matchtype2 + 1)) )) ) { // 2nd half is finished
ct_score[0] += t_score[1]
t_score[0] += ct_score[1]
new hudmsg[1024], pos
pos = format(hudmsg,1023,"--[ Match Finished. GG all ]--^n^nAnd the winner of the map is...^n")
if (ct_score[0] > t_score[0])
format(hudmsg[pos],1023-pos,"%s with the score of %s:%i/%s:%i",clanCT ,clanCT,ct_score[0],clanT,t_score[0])
else {
if (t_score[0] > ct_score[0])
format(hudmsg[pos],1023-pos,"%s with the score of %s:%i/%s:%i", clanT,clanT,t_score[0],clanCT,ct_score[0])
else
format(hudmsg[pos],1023-pos,"NONE!!! Both teams have %i wins.^n WHAT A MATCH!! :-D",ct_score[0])
}
set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 2.0, 8.0, 0.8, 0.8, 4)
show_hudmessage(0,hudmsg)
match_inprogress = 0
print_wonids()
take_screenshot()
if (recdemo > 0)
set_task(2.0,"stop_demo")
set_task(3.0,"back_to_ffa")
}
}
}
}
return PLUGIN_CONTINUE
}
回复

使用道具 举报

 楼主| 发表于 2003-6-23 00:05:39 | 显示全部楼层 来自 中国–湖北–武汉
^_^。。果然强。。。。
不愧是AMX版代码研究第一高手。。。
回去试看:)
回复

使用道具 举报

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

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