搜索
查看: 1708|回复: 4

插件代码修改难题。。郁闷啊

[复制链接]
发表于 2003-7-14 02:00:58 | 显示全部楼层 |阅读模式 来自 中国–湖北–武汉
看了amxmod.inc文件后发现可以通过
set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35,effects=0,Float:fxtime=6.0,Float:holdtime=12.0,Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4)代码来设置要显示不同颜色的hud彩色信息,然后通过show_hudmessage (id,"的客户端屏幕要显示的字符内容")但是看了许多插件代码,发现代码的每个public事件只能设置一次信息的格式和颜色。
我本来是希望修改match_deluxe插件达到“下面附图”的效果,除了显示本身自带的warmup信息外,把say ready字样也可以以hudmessage来表达。源插件只有warmup信息,command信息是在chat拦显示的。代码如下:
public warmup_msg()
{
        if ((match_inprogress == 1)||(match_inprogress == 3)) {
                set_hudmessage(255, 160, 0, -1.0, 0.02, 0, 2.0, 10.0, 0.8, 0.9, 3)
                if ((recdemo==1)||(recdemo==3))
                        show_hudmessage(0,"--[ Warmup Time ]--^n^nDemos are automatically recorded on your PC^nScreenshots are also taken%s",(swap_type==1) ? "^nTeams will automatically swap after the 1st half" : "")
                else
                        show_hudmessage(0,"--[ Warmup Time ]--^n^nScreenshots are taken.%s^nPlease remember to record demos ",(swap_type==1) ? "^nTeams will automatically swap after the 1st half" : "")                        
                if (cmdtype == 1)
                        client_print(0,print_chat,"* [AMX MATCH] %s vs %s",clanCT,clanT)
                client_print(0,print_chat,"* [AMX MATCH] Warmup Time...")
                if (ready_type == 0) {
                        if (teams_ready == 0)
                                client_print(0,print_chat,"* [AMX MATCH] Both teams aren't ready.")
                        if (teams_ready == 4) {
                                if (cmdtype == 1)
                                        client_print(0,print_chat,"* [AMX MATCH] %s are ready. Waiting for %s to be ready.",(match_inprogress==1) ? clanCT : clanT,(match_inprogress==1) ? clanT : clanCT)
                                else
                                        client_print(0,print_chat,"* [AMX MATCH] CT are ready. Waiting for T to be ready.")
                        }
                        if (teams_ready == 8) {
                                if (cmdtype == 1)
                                        client_print(0,print_chat,"* [AMX MATCH] %s are ready. Waiting for %s to be ready.",(match_inprogress==1) ? clanT : clanCT,(match_inprogress==1) ? clanCT : clanT)
                                else
                                        client_print(0,print_chat,"* [AMX MATCH] T are ready. Waiting for CT to be ready.")
                        }
                        client_print(0,print_chat,"* [AMX MATCH] When your team is ready: say ready")
                        client_print(0,print_chat,"* [AMX MATCH] If your team isn't ready anymore: say notready")
                }
                else {
                        if (ready_type == 1) {
                                client_print(0,print_chat,"* [AMX MATCH] When you are ready: say ready")
                                client_print(0,print_chat,"* [AMX MATCH] If you're not ready anymore: say notready")
                                client_print(0,print_chat,"* [AMX MATCH] The match starts when everybody is ready")
                        }
                        else
                                client_print(0,print_chat,"* [AMX MATCH] The admin will start the match when needed (by saying ^"/start^")")
                }
                set_task(90.0,"warmup_msg",1338)
        }
        return PLUGIN_CONTINUE
}

开始我试过想把“command”信息与“warmup”信息合在一起显示,但是这样就无法像图中所示这么规则,工整了。因为两个"不同位置"的信息是无法通过一个set_hudmessage来进行设置的。如此是显然行不通的。
于是我想到新开一个public事件,在
if ((match_inprogress == 1)||(match_inprogress == 3)) {的条件下触发彩色信息显示事件,于是写下了如下代码:
public warmup_cmd()
{
        if ((match_inprogress == 1)||(match_inprogress == 3)) {
                new hudmessage[548]
                show_hudmessage(0,"Commands^n^n---------------------------------^nsay ready : start or restart a set^nsay notready : cansel ready or cancel a set (back to warmup)^nMatch info is on (say 'info' to turn it off)       
                set_task(80.0,"warmup_cmd",1336)
        }
        return PLUGIN_CONTINUE
}

但是还是行不通,难道是因为一个条件下只能显示一个彩色信息??可是statsx插件可以作到同时显示多个彩色信息了,各种方法我都试过了,都不行。。。郁闷啊。。。
各位谁懂代码的提醒指教一下谢谢。。。:D:D:]:)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
 楼主| 发表于 2003-7-14 04:03:29 | 显示全部楼层 来自 中国–湖北–武汉
新问题:
首先感谢TDK报告bug,match插件在下半场的时候彩色字幕无法正常显示比分和胜利方的队标,上半场一切正常,下半场显示的时候不管谁赢都显示的CT WIN而且队标也是反的。
今天好困。ZZZZZzzzzzz.....明天弄了。。。
以下是比分显示部分的代码,感兴趣的朋友可以捉捉虫:)
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,-1.0, 0.3, 0, 6.0, 6.0, 0.5, 0.15, 1)
if (match_inprogress == 2) {
if (ct_score[1] > t_score[1])
show_hudmessage(0,"  [SCORE] CT win  *  %s (%d  :  %d) %s *",clanCT,ct_score[1],t_score[1],clanT)
else {
if (ct_score[1] < t_score[1])
show_hudmessage(0,"  [SCORE] T win  * %s (%d  :  %d) %s *",clanT,t_score[1],ct_score[1],clanCT)
else {
if (ct_score[1] == t_score[1] && t_score[1] != 0)
show_hudmessage(0,"  [MATCH SCORE] 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," [SCORE] T win  * %s (%d  :  %d) %s *",clanT,total[0],total[1],clanCT)
else {
if (total[0] < total[1])
show_hudmessage(0,"  [SCORE] CT win  * %s (%d  :  %d) %s *",clanCT,total[1],total[0],clanT)
else {
if (total[0] == total[1])
show_hudmessage(0,"  [SCORE] Both teams have won %d rounds",total[0])
}
}
}
}
}
回复

使用道具 举报

发表于 2003-7-14 16:07:30 | 显示全部楼层 来自 中国–广西–柳州
看来要让Coolzsb出马了,呵,(头好大好大)
回复

使用道具 举报

发表于 2003-7-15 08:41:22 | 显示全部楼层 来自 中国–福建–厦门

关于你的第一个问题

赫赫,becking,其实,论坛上已经有相关内容的贴子了~~~没有仔细看论坛上的贴子吧?这回可被大家抓到了吧?

ative set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4)

这个是set_hudmessage函数的定义,请注意,最后的那个channel参数

当你set_hudmessage定义用的channel都是一样的话,下一个show_hudmessage显示的内容就会覆盖第一个show_hudmessage的内容

所以说呢,要完成你的第一个目的的话,你只需要把你想同时显示分成不同的channel跟显示位置就ok了
回复

使用道具 举报

 楼主| 发表于 2003-7-15 16:04:55 | 显示全部楼层 来自 中国–湖北–武汉
我改过的啊.我开始的时候猜也是这个意思了,因为我看statx的代码,四个信息的最后的channal定义是1.2.3.4,可是我后面的改成3也不行啊...郁闷....
回复

使用道具 举报

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

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