- 听众
- 收听
- 积分
- 90
- 主题
- 回帖
- 0
- 精华
注册时间2008-11-24
最后登录1970-1-1
该用户从未签到
|
这是显示最佳杀手的插件,但是没局结束显示:无伤亡,
请帮我看看
#include <amxmodx>
#include <cstrike>
#include <unlimited_money>
new playerkilled[33]
new Round_Control
new g_iRoundEndTriggered
public client_disconnect(id){
playerkilled[id]=0
return PLUGIN_CONTINUE
}
public client_connect(id){
playerkilled[id]=0;
}
public new_round(){
new i
if (!Round_Control){
Round_Control = 1
g_iRoundEndTriggered=0
for(i=0;i<=32;i++)playerkilled[i]=0;
}
}
public eEndRound(){
if (g_iRoundEndTriggered) return PLUGIN_CONTINUE
g_iRoundEndTriggered=1
Round_Control=0
new i,maxkillcount
maxkillcount=0
new RoundEndMsg[513],ipos
new playerslist[32],playerscount
ipos=0
ipos+=format(RoundEndMsg[ipos],512-ipos,"本局最佳杀手")
get_players(playerslist,playerscount)//Get Players
for(i=0;i<playerscount;i++){
if(playerkilled[playerslist[i]]&&playerkilled[playerslist[i]]>maxkillcount) maxkillcount=playerkilled[playerslist[i]]
}
if(maxkillcount){
new playername[33],playeradded=0
ipos+=format(RoundEndMsg[ipos],512-ipos,"^n(杀%d人)^n————————————————^n",maxkillcount)
for(i=0;i<playerscount;i++){
if(playerkilled[playerslist[i]]==maxkillcount){//WeiGet this players
if (get_user_name(playerslist[i],playername,32))
ipos+=format(RoundEndMsg[ipos],512-ipos,"%s^n",playername)
else ipos+=format(RoundEndMsg[ipos],512-ipos,"未知或已离开游戏^n")
++playeradded
}
if(playeradded>=2){
ipos+=format(RoundEndMsg[ipos],512-ipos,"......^n")
break;
}
}
}
else{
ipos+=format(RoundEndMsg[ipos],512-ipos,"^n————————————————^n无伤亡^n")
}
ipos+=format(RoundEndMsg[ipos],512-ipos,"^n金钱最多的玩家^n---------------------------------^n")
new maxctmoney=0,maxtmoney=0,maxmoneytid=0,maxmoneyctid=0
new id, usermoney
for(i=0;i<playerscount;i++){
id=playerslist[i]
usermoney=cs_get_user_money2(id)
if(cs_get_user_team(id)==CS_TEAM_T){
if(usermoney>maxtmoney){
maxtmoney=usermoney
maxmoneytid=id
}
}
else {
if(usermoney>maxctmoney){
maxctmoney=usermoney
maxmoneyctid=id
}
}
}
new ctname[33],tname[33]
if(maxmoneytid)get_user_name(maxmoneytid,tname,32)
else tname="没有人"
if(maxmoneyctid)get_user_name(maxmoneyctid,ctname,32)
else ctname="没有人"
ipos+=format(RoundEndMsg[ipos],512-ipos,"警察^n%s %d^n匪徒^n%s %d",ctname,maxctmoney,tname,maxtmoney)
set_hudmessage( 100, 200, 0, 0.05, 0.55, 0, 0.02, 5.0, 0.1, 0.2, 2 )
show_hudmessage(0,RoundEndMsg)
return PLUGIN_CONTINUE
}
public eRestart(){
Round_Control = 0
}
public plugin_init(){
register_plugin("First Killer Reward","0.1","ZhangSheng修改分离代码-原代码是larnk编写的")
register_event("RoundTime", "new_round", "bc")
register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w")
} |
|