apocalyptic 发表于 2008-12-6 18:50:09

求助关于人质模式下的几个事件出错问题

我在插件中添加了以下代码:
//全部人质获救,处死所有T
register_event("TextMsg","All_Hostages_Rescued","a","2=#All_Hostages_Rescued")
//人质未获救,处死所有CT
register_event("TextMsg","Hostages_Not_Rescued","a","2=#Hostages_Not_Rescued")
//杀人质
register_event("TextMsg","Killed_Hostage","b","2&#Killed_Hostage")
//伤人质
register_event("TextMsg","Injured_Hostage","b","2&#Injured_Hostage")
//救出一个人质
register_event("SendAudio", "Hostage_Rescued", "a", "2&%!MRAD_rescued")

在单人测试的时候,如果CT把所有人质救走(不管是分多次还是一次完成),都没有任何问题。
在多人测试的时候,如果CT把所有人质救走(不管是分多次还是一次完成),在救出最后一个人质的时候,不但T会被处死,CT也会被处死。而且还会出现错误的杀伤人质的提示信息。
见下图

我怀疑是事件设定上面有问题,请各位高手赐教!

zwfgdlc 发表于 2008-12-7 00:03:16

回复: 求助关于人质模式下的几个事件出错问题

源码贴上来吧,断章取义很难猜到是什么原因

Rulzy 发表于 2008-12-7 00:42:05

回复: 求助关于人质模式下的几个事件出错问题

T和CT都被处死应该是“任务失败方处死”插件有问题。

心静如水 发表于 2008-12-7 09:33:31

回复: 求助关于人质模式下的几个事件出错问题

希望版主帮写出人质全部死时的假设

立刻判定CT胜利...................有些T就是爱杀人质.............

apocalyptic 发表于 2008-12-7 12:28:32

回复: 求助关于人质模式下的几个事件出错问题

以下是代码,其实我觉得应该是register_event的问题,跟具体的public函数关系不是很大。
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_event("TextMsg","All_Hostages_Rescued","a","2=#All_Hostages_Rescued")
register_event("TextMsg","Hostages_Not_Rescued","a","2=#Hostages_Not_Rescued")
register_event("TextMsg","Killed_Hostage","b","2&#Killed_Hostage")
register_event("TextMsg","Injured_Hostage","b","2&#Injured_Hostage")
register_event("SendAudio", "Hostage_Rescued", "a", "2&%!MRAD_rescued")
}
public All_Hostages_Rescued()
{
client_print(id,print_chat,"All hostages have been rescued! Good job!")
}
public Hostages_Not_Rescued()
{
client_print(id,print_chat,"There are still some hostages have NOT been rescued!")
}
public Killed_Hostage(id)
{
client_print(id,print_chat,"You KILLED a hostage!")
}
public Injured_Hostage(id)
{
client_print(id,print_chat,"You INJURED a hostage!")
}

Rulzy 发表于 2008-12-7 12:39:39

回复: 求助关于人质模式下的几个事件出错问题

左下角那个提示,应该是本局总情况吧?

apocalyptic 发表于 2008-12-7 15:23:03

回复: 求助关于人质模式下的几个事件出错问题

Post by Rulzy
左下角那个提示,应该是本局总情况吧?
图中左下角的部分本应该是某人杀死或伤害人质时出现的提示信息。

zwfgdlc 发表于 2008-12-7 17:40:06

回复: 求助关于人质模式下的几个事件出错问题

试下这样,我没试过.

#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "New Plug-In"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_logevent("Team_Win",6,"0=Team","2=triggered","3=Hostages_Not_Rescued","3=All_Hostages_Rescued");
register_logevent("Hostage_Killed",3,"1=triggered","2=Killed_A_Hostage");
register_logevent("Hostages_Rescued",3,"1=triggered", "2=Rescued_A_Hostage");
register_event("TextMsg", "Injured_Hostage", "be", "1=4", "2=#Injured_Hostage")
return PLUGIN_CONTINUE;
}

public Team_Win()
{
new reason;
read_logargv(3,reason,31);
if(equali(reason,"All_Hostages_Rescued")){
//人质被救出,CT胜利
client_print(0,print_chat,"所有人质被救出,CT胜利!!!!")
}else{
//人质没有被救出,TE胜利
client_print(0,print_chat,"没有救出人质,TE胜利!!!!")
}
}
public Hostage_Killed()
{
new log,name;
read_logargv(0,log,63);
parse_loguser(log,name,31);
client_print(0,print_chat,"%s杀了一个人质",name)
}

public Hostages_Rescued()
{
new log,name;
read_logargv(0,log,63);
parse_loguser(log,name,31);
client_print(get_user_index(name),print_chat,"你救出了一个人质!!!!")

}
public Injured_Hostage(id)
{
client_print(id,print_chat,"你伤害了一个人质!!!!")
}

apocalyptic 发表于 2008-12-7 19:39:05

回复: 求助关于人质模式下的几个事件出错问题

先感谢一下,拿回来慢慢看,慢慢研究。

apocalyptic 发表于 2008-12-7 21:03:50

回复: 求助关于人质模式下的几个事件出错问题

public plugin_init()
{
register_logevent("Team_Win",6,"0=Team","2=triggered","3=Hostages_Not_Rescued","3=All_Hostages_Rescued");
}

public Team_Win()
{
new reason;
read_argv(3,reason,31);
}

Post by zwfgdlc
试下这样,我没试过.
很感谢你提供的资料,大部分问题已经解决。但还有一个问题,就是无法正确判断胜负。
我查看了一下,就是在上述代码中,reason读取到的是一个空值,所以才会出错。
请问还有进一步解决办法吗?
再次感谢!
页: [1] 2
查看完整版本: 求助关于人质模式下的几个事件出错问题