搜索
查看: 2176|回复: 1

请哪位版主帮修改一点,把原来穿墙杀人就记数变成穿墙暴头才记数,附原码.

[复制链接]
发表于 2008-1-7 19:22:15 | 显示全部楼层 |阅读模式 来自 中国–广西–百色–田东县
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <cstrike>

#define KEY8 (1<<7)
#define KEY9 (1<<8)

#define MAXSPEED  290
#define MAXCHECKTIME  12
#define MAXHODESEC 15

new g_playerSpeedFlag[33]={0,...};
new dot;
new g_bodyStr[7][10]={"@","头","枪","背","左手臂","右手臂","脚"};

//for count
new g_playerSpeedWarn[33]
new g_playerThWallWarn[33]
new bool:g_playerFlashed[33]
new g_playerFlashWarn[33]

//for vote
new g_startVoteType=0;
new g_voteCount[2];
new g_voteResStr[2][12]={"Yes.","No."};
new Float:holdTime;

new curMap[32];
public plugin_init()
{
register_plugin("FindCheater", "0.4", "Enigmaya");
register_event("ScreenFade", "eventFlash", "be","2>6000","4=255", "5=255", "6=255", "7=255")
register_event("DeathMsg", "death_msg", "a");

register_cvar("fc_enable", "1");
register_cvar("fc_beam_holdtime", "150");
register_cvar("fc_checkflash", "1");
register_cvar("fc_checkspeed", "1");
register_cvar("fc_checkthwall", "1");
register_cvar("fc_speedwarntime", "2");
register_cvar("fc_thwallwarntime", "10");
register_cvar("fc_flashwarntime", "3");
register_cvar("fc_startvote", "1");
register_cvar("fc_record", "1");
register_cvar("fc_voterate", "0.6");
register_cvar("fc_cmdstr","kick #%userid%");

register_menucmd(register_menuid("VoteMenu"), KEY8|KEY9, "actionMenu");
register_clcmd("say /fc", "disInfo")

get_mapname(curMap,31);

}

public client_color(id,msg[]){
  new playerslist[32],playerscount//,i
  get_players(playerslist,playerscount,"c")
  if(id==0){
   message_begin(MSG_ALL, get_user_msgid("SayText"), {0,0,0},1)
   write_byte(1)
   write_string(msg)
   message_end()
   
  }
  else{
   message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
   write_byte(id)
   write_string(msg)
   message_end()
  }
}

public plugin_precache()
{
    dot = precache_model("sprites/dot.spr");
}

public client_connect(id)
{
g_playerSpeedWarn[id]=0;
g_playerThWallWarn[id]=0;
g_playerFlashed[id]=false;
g_playerFlashWarn[id]=0;
}

public eventFlash(id)
{
if( get_cvar_num("fc_enable") && get_cvar_num("fc_checkflash") )
   {
  read_data(2,holdTime);
  holdTime*=0.0002;
  set_task(0.5,"startCheck",id);
}
}

public startCheck(id)
{
g_playerFlashed[id]=true;
set_task(holdTime,"endCheck",id);
}

public endCheck(id)
{
g_playerFlashed[id]=false;
}

public  client_PreThink ( id )
{
if( get_cvar_num("fc_enable") && get_cvar_num("fc_checkspeed") && is_user_alive(id) && entity_is_on_ground(id)  )
{
  new curSpe=get_speed (id);
  if( curSpe>MAXSPEED ){
   
   if( g_playerSpeedFlag[id]++ > MAXCHECKTIME ){
    new pname[32],Msg[128];
    get_user_name(id,pname,31);
   
    g_playerSpeedWarn[id]++;
   
    format(Msg,127,"^x04[FC] ^x03%s的速度^x04(^x03%i^x04)^x01太快了... 警告:^x03%d",pname,curSpe,g_playerSpeedWarn[id]);
   
    if( get_cvar_num("fc_record") )
     recordEvent(Msg);
   
    client_color(0, Msg)
   
    g_playerSpeedFlag[id]=0;
    if( g_playerSpeedWarn[id]>=get_cvar_num("fc_speedwarntime") ){
     g_startVoteType=0;
     InitVote(id);
     g_playerSpeedWarn[id]=0;
    }
   }
  }
  else if(g_playerSpeedFlag[id])g_playerSpeedFlag[id]--;
}
}


stock entity_is_on_ground(entity)
{
return entity_get_int(entity, EV_INT_flags) & FL_ONGROUND
}
public death_msg()
{
if( !get_cvar_num("fc_enable") )
  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,"^x04[FC] ^x01玩家^x03%s^x01被闪时用^x04%s^x01杀死^x03%s ^x01警告:^x03%d",kName,weapon,vName,g_playerFlashWarn[killer]);

  if( get_cvar_num("fc_record") )
   recordEvent(str);

  client_color(0,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;
}

if( !get_cvar_num("fc_checkthwall") )
  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],msg[128]
get_user_name(killer,kName,31);
new retV=checkPoint(killer,victim,kilOri,vicOri)
if( retV ){
  format(msg, 127, "^x04[FC] ^x03%s^x01能看见你的^x03%s",kName,g_bodyStr[retV])
  client_color(victim,msg)
  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,"^x04[FC] ^x01玩家^x03%s^x01用^x04%s^x01穿墙杀死^x03%s ^x01警告:^x03%d",kName,weapon,vName,g_playerThWallWarn[killer]);

if( get_cvar_num("fc_record") )
  recordEvent(str);

client_color(0,str);

if( g_playerThWallWarn[killer]>=get_cvar_num("fc_thwallwarntime") ){
  g_startVoteType=1;
  InitVote(killer);
  g_playerThWallWarn[killer]=0;
}


return PLUGIN_HANDLED;
}
/*make 6 traces at the victim to check can the killer see the victim*/
public checkPoint(killer,victim,Float:kilOri[3],Float:vicOri[3])
{
new isDuck=0,Float:hitVec[3];
if( get_user_button (victim)&IN_DUCK )
  isDuck=1;

//------get head pos
//new Float:H_reV[3];
VelocityByAim (victim, 7 ,hitVec);
hitVec[2]+=24;
hitVec[0] += vicOri[0];
hitVec[1] += vicOri[1];
hitVec[2] += vicOri[2];
if(isDuck)
  hitVec[2]+=5;//higher
if( checkVisible(killer,victim,kilOri,hitVec) )
  return 1;
//------get gun pos
//new Float:G_reV[3]
VelocityByAim (victim, 38 ,hitVec);
hitVec[0] +=vicOri[0];
hitVec[1] +=vicOri[1];
hitVec[2] +=vicOri[2];
hitVec[2]+=10;//higher
if( checkVisible(killer,victim,kilOri,hitVec) )
  return 2;
  
//change the angle to get the origin of another check points
new Float:ang[3]
entity_get_vector(victim,EV_VEC_v_angle,ang)

//turn left--to get left pos
ang[1]+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13 ,hitVec);
hitVec[0] += vicOri[0];
hitVec[1] += vicOri[1];
hitVec[2] += vicOri[2]+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
  return 4;
  
//turn back--to get back pos
ang[1]+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
new backpos=10;
if(isDuck)
  backpos+=10
VelocityByAim (victim,backpos,hitVec);
hitVec[0] +=vicOri[0];
hitVec[1] +=vicOri[1];
hitVec[2] +=vicOri[2];
if(isDuck)
  hitVec[2]+=7;
if( checkVisible(killer,victim,kilOri,hitVec) )
  return 3;
  
//turn right--to get right pos
ang[1]+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13+4 ,hitVec);
hitVec[0] += vicOri[0];
hitVec[1] += vicOri[1];
hitVec[2] += vicOri[2]+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
  return 5;
  
//------get foot pos
//new Float:F_reV[3];
new footpos=34
if(isDuck)
  footpos-=18;
hitVec[0]=vicOri[0];
hitVec[1]=vicOri[1];
hitVec[2]=vicOri[2]-footpos;
if( checkVisible(killer,victim,kilOri,hitVec) )
  return 6;
return 0;
}

checkVisible(killer,victim,Float:startOri[3],Float:endOri[3])
{
new Float:hitOri[3];
if( victim==trace_line(killer, startOri, endOri, hitOri) )
  return 1;
else if( vector_distance(startOri,hitOri) == vector_distance(startOri,endOri) )
   return 1;

return 0;
}

drawBeam(id,staPos[],endPos[])
{
message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, id);
// message_begin(MSG_ALL,SVC_TEMPENTITY)
write_byte(0);
write_coord(staPos[0]);
write_coord(staPos[1]);
write_coord(staPos[2]);
write_coord(endPos[0]);
write_coord(endPos[1]);
write_coord(endPos[2]);
write_short(dot);
write_byte(1);    //start frame
write_byte(1);    //frame rate in 0.1's
write_byte(get_cvar_num("fc_beam_holdtime")); //life in 0.1's
write_byte(10);    //width
write_byte(0);    //noise
write_byte(0);    //r,g,b
write_byte(255);
write_byte(0);
write_byte(200);   //brightness
write_byte(0);    //scroll speed
message_end();
  

new size=20;
message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, id);
// message_begin(MSG_ALL,SVC_TEMPENTITY)
write_byte( 30 )
write_coord( endPos[0] ) //startPos
write_coord( endPos[1] )
write_coord( endPos[2]-size )
write_coord( endPos[0] ) //endPos      
write_coord( endPos[1] )
write_coord( endPos[2]+size )
write_short(get_cvar_num("fc_beam_holdtime"))
write_byte(220)   //r,g,b
write_byte(20)
write_byte(60)
message_end()

message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, id);
// message_begin(MSG_ALL,SVC_TEMPENTITY)
write_byte( 30 )
write_coord( endPos[0]-size ) //startPos
write_coord( endPos[1] )
write_coord( endPos[2] )
write_coord( endPos[0]+size ) //endPos      
write_coord( endPos[1] )
write_coord( endPos[2] )
write_short(get_cvar_num("fc_beam_holdtime"))
write_byte(220)   //r,g,b
write_byte(20)
write_byte(60)
message_end()

message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, id);
// message_begin(MSG_ALL,SVC_TEMPENTITY)
write_byte( 30 )
write_coord( endPos[0] ) //startPos
write_coord( endPos[1]-size )
write_coord( endPos[2] )
write_coord( endPos[0] ) //endPos      
write_coord( endPos[1]+size )
write_coord( endPos[2] )
write_short(get_cvar_num("fc_beam_holdtime"))
write_byte(220)   //r,g,b
write_byte(20)
write_byte(60)
message_end()
}
excutePunish(id)
{
new cmdStr[64],useridStr[32];
get_cvar_string("fc_cmdstr",cmdStr,63);
num_to_str(get_user_userid(id),useridStr,31);
replace(cmdStr, 63, "%userid%", useridStr);
server_cmd(cmdStr);
}
recordEvent(Msg[])
{
new data[256];
format(data,255,"%s [Map:%s]",Msg,curMap);
log_to_file("FindCheater.log",data);
//log_to_file("../configs/FindCheater.log",data);
}
/*  ----------------------------- Vote ------------------------------ */
public InitVote(target)
{
if( !is_user_connected(target) || is_user_admin(target) )
  return PLUGIN_HANDLED;
  
if( !get_cvar_num("fc_startvote") ){
  excutePunish(target);
  return PLUGIN_HANDLED;
}

/* new Float:voting = get_cvar_float("amx_last_voting")
if ( voting > get_gametime() )
{
  client_print(0,print_chat,"vote will delay %d s",MAXHODESEC);
  set_task(MAXHODESEC*1.0,"InitVote",target)
  return PLUGIN_HANDLED;
}*/

new str[128];
switch( g_startVoteType ){
  
  case 0: format(str,127," %d 速度超过过了限制速度",g_playerSpeedWarn[target]);
  case 1: format(str,127," %d 超过穿墙限制次数杀死玩家",g_playerThWallWarn[target]);
  case 2: format(str,127," %d 超过限制次数杀死被闪玩家",g_playerFlashWarn[target]);
}
new menuBody[512],pname[32];
get_user_name(target,pname,31);
     new len=format(menuBody,511,"\r 你认为 %s 是在作弊吗 ? ^n",pname);
len+=format(menuBody[len],511-len,"\d( [FC] %s )^n^n",str);
len+=format(menuBody[len],511-len,"\w8. 是的 ! ^n");
len+=format(menuBody[len],511-len,"\w9. 不确定 ! ^n");
     show_menu(0,KEY8|KEY9,menuBody,MAXHODESEC-1,"anyVoteMenu");
   
/* new Float:vote_time = MAXHODESEC*1.0 + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time)*/

g_voteCount[0]=0;
g_voteCount[1]=0;

set_task(MAXHODESEC*1.0,"showResult",target);

    return PLUGIN_HANDLED
}

public actionMenu(id,key)
{
g_voteCount[key-7]++;

new pname[32],msg[128]
     get_user_name(id,pname,31);
format(msg,127,"^x03%s ^x01选 ^x04%s",pname,g_voteResStr[key-7])
client_color(0,msg);
     
return PLUGIN_HANDLED
}
public showResult(target)
{
    new Float:result=0.0;
    new msg[128]
    result = ( g_voteCount[0]+g_voteCount[1] ) ? (float(g_voteCount[0]) / float( get_playersnum(0) ) ) : 0.0
    if( result>=get_cvar_float("fc_voterate") && is_user_connected(target) ){
     format(msg,127,"^x04[FC] ^x01投票结果 ^x03%0.1f . ^x01同意^x04是的 ^x03%d . ^x01同意^x04不是的 ^x03%d .^x01作弊者将会遭到惩罚!",result,g_voteCount[0],g_voteCount[1]);
excutePunish(target);
    }
    else format(msg,127,"^x04[FC] ^x01投票结果 ^x03%0.1f . ^x04是的 ^x03%d . ^x04不是的 ^x03%d ",result,g_voteCount[0],g_voteCount[1]);
    client_color(0,msg)
    return PLUGIN_HANDLED;
}
/* ------------------ Info --------------------*/
public disInfo(id)
{
const SIZE=1536
new istate[4],msg[SIZE+1],len=0,players[32],num,pname[32],t;
get_players(players,num);

//CS1.6
len += format(msg[len], SIZE - len, "<head><META http-equiv=Content-Type content='text/html ;charset=UTF-8'></head><style>");

len += format(msg[len], SIZE - len, "body{color:#FFCC99;background-color:black;margin-top:5}.A{background-color:#310000}.B{background-color:#630000}td{font-size:14px}");
len += format(msg[len], SIZE - len, "</style><center><b><font size=4>作弊检测</b><table width=500>");
len += format(msg[len], SIZE - len, "<tr bgcolor=#9C0000><td><b>CS_ID</b></td><td><b>穿墙杀人警告</b></td><td><b>超速警告</b></td><td><b>被闪杀人警告</b></td>");

for(new i=0;i<num;i++){
  t=players;
  if( !g_playerThWallWarn[t] && !g_playerSpeedWarn[t] && !g_playerFlashWarn[t])
   continue;
  else {
   if (equal(istate,"A")) copy(istate,3,"B")
                        else copy(istate,3,"A")
          get_user_name(t,pname,31);
   len += format(msg[len], SIZE - len, "<tr class=%s><td>%s<td style='text-align=right'>%d<td style='text-align=right'>%d<td style='text-align=right'>%d",istate,pname,g_playerThWallWarn[t],g_playerSpeedWarn[t],g_playerFlashWarn[t]);
  }
}

len += format(msg[len], SIZE - len, "</table><hr size=1 color=blue><font size=2>");
if( get_cvar_num("fc_startvote") )
  len += format(msg[len], SIZE - len, "如果你的警告达到系统界限,系统将会投票 !");
else  len += format(msg[len], SIZE - len, "如果你的警告达到系统界限,你将会被踢!");
len += format(msg[len], SIZE - len, "<p align=left><b>服务器默认设置:</b>");
len += format(msg[len], SIZE - len, "<p></p>");
len += format(msg[len], SIZE - len, "<p align=left>穿墙杀人警告次数: %d</p>",get_cvar_num("fc_thwallwarntime"));
len += format(msg[len], SIZE - len, "<p align=left>超速警告次数: %d</p>",get_cvar_num("fc_speedwarntime"));
len += format(msg[len], SIZE - len, "<p align=left>被闪杀人警告次数: %d</p>",get_cvar_num("fc_flashwarntime"));
   
show_motd ( id, msg, "FC 作弊检测");

return PLUGIN_CONTINUE;
}
穿墙是经常的事,但穿墙就暴头的应该是作弊的多,所以想给这个插件完美....谢谢先...
 楼主| 发表于 2008-1-10 09:39:05 | 显示全部楼层 来自 中国–广西–百色

回复: 请哪位版主帮修改一点,把原来穿墙杀人就记数变成穿墙暴头才记数,附原码.

几天了?自己顶一下..........
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表