回复: 插件修改:当双方都只剩下一人时强制用小刀PK插件
解决方法跟W3C的解决方法一样,自己试下吧再添加一个"HLTV"之类的"EVENT_NewRound"触发事件吗?我改了一下,不过就无法编译插件了。
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "Automatic Knife Duel"
#define VERSION "1.0"
#define AUTHOR "Administrator"
new bool:knifematic=false
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("CurWeapon", "event_holdwpn", "be", "1=1")
register_event("DeathMsg", "event_death", "a")
// 增加的部分
register_event( "HLTV", "EVENT_NewRound", "a", "1=0", "2=0")
register_event("SendAudio","event_round_end","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
}
public event_death()
{
if(get_playersnum(0)<2) return
new Tnum=0,CTnum=0
new playerlist,num
get_players(playerlist,num,"a")
for(new i=0;i<num;i++)
{
new team=get_user_team(playerlist)
if(team==1)
++Tnum
else
++CTnum
}
//log_amx("T is %d,CT is %d",Tnum,CTnum)
if(Tnum==1&&CTnum==1)
{
knifematic=true
new players,snum
get_players(players,snum,"a")
for(new i=0;i<snum;i++)
{
engclient_cmd(players,"weapon_knife")
set_hudmessage(32, 202, 32, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1)
show_hudmessage(0,"双方现在进入小刀PK模式")
}
}
}
public event_holdwpn(id)
{
new wpnid=read_data(2)
if(wpnid!=CSW_KNIFE && knifematic)
engclient_cmd(id,"weapon_knife")
}
public event_round_end()
{
knifematic=false
}
// 增加的部分
public EVENT_NewRound()
}
knifematic=false
}
回复: 插件修改:当双方都只剩下一人时强制用小刀PK插件
// 增加的部分public EVENT_NewRound()
} //花括号错了,应该是{
knifematic=false
}
回复: 插件修改:当双方都只剩下一人时强制用小刀PK插件
:cold: 汗~ 我真是太粗心了,细节决定成败啊!再次谢谢zwfgdlc楼主,问题终于解决了。回复: 插件修改:当双方都只剩下一人时强制用小刀PK插件
补充一句,其实不用检查t 或者 ct的人数,只要检查活着的人是不是2个就行了。回复: 插件修改:当双方都只剩下一人时强制用小刀PK插件
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Automatic Knife Duel"
#define VERSION "1.0"
#define AUTHOR "Administrator"
new bool:g_knifematic
new g_maxplayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_maxplayers = get_maxplayers()
register_event("CurWeapon", "event_holdwpn", "be", "1=1", "2!29")
register_event("DeathMsg", "event_death", "a")
register_logevent("reset", 2, "0=World triggered", "1=Round_Start")
register_logevent("reset", 2, "0=World triggered", "1=Round_End")
}
public reset()
{
g_knifematic = false
}
public event_death()
{
if(get_playersnum(0) < 2)
return
new players, num
get_players(players, num, "a")
if(num == 2)
{
g_knifematic = true
engclient_cmd(players, "weapon_knife")
engclient_cmd(players, "weapon_knife")
set_hudmessage(32, 202, 32, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1)
show_hudmessage(0,"双方现在进入小刀PK模式")
}
}
public event_holdwpn(id)
{
if(knifematic)
engclient_cmd(id, "weapon_knife")
} sadasdsadasdas 都是高手啊、。、
页:
1
[2]