|
楼主 |
发表于 2008-3-10 15:18:30
|
显示全部楼层
来自 中国–甘肃–兰州
回复: 插件修改:当双方都只剩下一人时强制用小刀PK插件
再添加一个"HLTV"之类的"EVENT_NewRound"触发事件吗?我改了一下,不过就无法编译插件了。
[php]#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[32],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[32],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
} [/php] |
|