|
发表于 2007-5-2 22:28:06
|
显示全部楼层
来自 中国–广东–肇庆
回复: 请问有检测穿墙击中的代码吗?
public death_msg()
{
if( !get_cvar_num("fc_enable") || !get_cvar_num("fc_checkthwall") )
return PLUGIN_HANDLED;
new killer = read_data(1);
new victim = read_data(2);
if( killer==victim || read_data(5) )
return PLUGIN_HANDLED;
new weapon[32];
read_data(4, weapon, 31)
if( equal(weapon,"c4") || equal(weapon,"grenade") || equal(weapon,"knife") )
return PLUGIN_HANDLED;
if( g_playerFlashed[killer] ){
g_playerFlashWarn[killer]++;
new kName[32],vName[32];
get_user_name(killer,kName,31);
get_user_name(victim,vName,31);
new str[128];
format(str,127,"",kName,vName,weapon,g_playerFlashWarn[killer]);
if( get_cvar_num("fc_record") )
recordEvent(str);
client_print(0,print_chat,"%s",str);
if( g_playerFlashWarn[killer]>=get_cvar_num("fc_flashwarntime") ){
g_startVoteType=2;
InitVote(killer);
g_playerFlashWarn[killer]=0;
}
g_playerFlashed[killer]=false;
return PLUGIN_HANDLED;
}
/* check killer's aiming at first */
new target,body;
get_user_aiming(killer,target,body);
if( target==victim )
return PLUGIN_HANDLED;
/* trace from kill's eye to victim's origin */
new Float:vicOri[3],Float:kilOri[3],Float:viewOff[3],Float:hitOri[3];
entity_get_vector(victim,EV_VEC_origin,vicOri);
entity_get_vector(killer, EV_VEC_origin, kilOri);
entity_get_vector(killer, EV_VEC_view_ofs, viewOff);
kilOri[0]+=viewOff[0];
kilOri[1]+=viewOff[1];
kilOri[2]+=viewOff[2];
if( victim==trace_line(killer, kilOri, vicOri, hitOri) )
return PLUGIN_HANDLED;
new kName[32];
get_user_name(killer,kName,31);
new retV=checkPoint(killer,victim,kilOri,vicOri)
if( retV ){
client_print(victim,print_chat,""kName,g_bodyStr[retV]);
return PLUGIN_HANDLED;
}
//draws a beam form killer's eyes to the victim's hitplace
VelocityByAim ( killer,floatround( vector_distance(kilOri,vicOri) ),hitOri);
vicOri[0]=kilOri[0] + hitOri[0];
vicOri[1]=kilOri[1] + hitOri[1];
vicOri[2]=kilOri[2] + hitOri[2];
/* if there is no wall,use following to get hit position: */
//get_user_origin(killer,vicOri,3);
new start[3],end[3];
FVecIVec(kilOri,start);
FVecIVec(vicOri,end);
new players[32],num;
get_players(players,num,"bc")
for(new i=0;i<num;i++){
if( is_user_connected(players) )
drawBeam(players,start,end);
}
//drawBeam(victim,start,end);
g_playerThWallWarn[killer]++;
new vName[32];
get_user_name(victim,vName,31);
new str[128];
format(str,127," ",kName,vName,weapon,g_playerThWallWarn[killer]);
if( get_cvar_num("fc_record") )
recordEvent(str);
client_print(0,print_chat,"%s",str);
client_print(0,print_chat,"",kName,vName,weapon,g_playerThWallWarn[killer]);
if( g_playerThWallWarn[killer]>=get_cvar_num("fc_thwallwarntime") ){
g_startVoteType=1;
InitVote(killer);
g_playerThWallWarn[killer]=0;
}
return PLUGIN_HANDLED;
}
len += format(msg[len], SIZE - len, "^n穿墙限制次数警告(TW_警告):%d^n",get_cvar_num("fc_thwallwarntime")); |
|