【求】高手看下findCheater源码不能编译
本帖最后由 homework 于 2011-8-29 09:57 编辑你发代码也不是这样发的吧。。。。既然太长就直接打包上来有那么难吗
rsdtt 发表于 2011-8-28 15:43 http://www.dt-club.net/forum/images/common/back.gif
我怕下载扣DTB啊,哈哈,既然r版说了,那我就直接上源码咯。#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={0,...};
new dot;
new g_bodyStr={"@","head","gun","back","left arm","right arm","foot"};
//for count
new g_playerSpeedWarn
new g_playerThWallWarn
new bool:g_playerFlashed
new g_playerFlashWarn
//for vote
new g_startVoteType=0;
new g_voteCount;
new g_voteResStr={"Yes.","No."};
new Float:holdTime;
new curMap;
public client_color(playerid, colorid, msg[])
{
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
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","amx_pcheater #%userid% 6");
register_menucmd(register_menuid("VoteMenu"), KEY8|KEY9, "actionMenu");
register_clcmd("say /fc", "disInfo")
get_mapname(curMap,31);
}
public plugin_precache()
{
dot = precache_model("sprites/dot.spr");
}
public client_connect(id)
{
g_playerSpeedWarn=0;
g_playerThWallWarn=0;
g_playerFlashed=false;
g_playerFlashWarn=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=true;
set_task(holdTime,"endCheck",id);
}
public endCheck(id)
{
g_playerFlashed=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++ > MAXCHECKTIME ){
new pname,Msg;
get_user_name(id,pname,31);
g_playerSpeedWarn++;
format(Msg,511,"^x04【征战检测】^x03%s^x04的移動速度是^x03(%i)^x04太快了(警告:^x03%d^x04次)",pname,curSpe,g_playerSpeedWarn)
client_color(0, id, Msg);
if( get_cvar_num("fc_record") )
recordEvent(Msg);
set_hudmessage(200, 100, 0, 0.0, 0.7, 0, 2.0, 2.0, 0.5, 0.15, 1);
show_hudmessage(0,"%s",Msg);
g_playerSpeedFlag=0;
if( g_playerSpeedWarn>=get_cvar_num("fc_speedwarntime") ){
g_startVoteType=0;
InitVote(id);
g_playerSpeedWarn=0;
}
}
}
else if(g_playerSpeedFlag)g_playerSpeedFlag--;
}
}
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;
read_data(4, weapon, 31)
if( equal(weapon,"c4") || equal(weapon,"grenade") || equal(weapon,"knife") )
return PLUGIN_HANDLED;
if( g_playerFlashed ){
g_playerFlashWarn++;
new kName,vName;
get_user_name(killer,kName,31);
get_user_name(victim,vName,31);
new str;
format(str,511,"^x04【征战检测】^x03%s^x04在被閃時殺了^x03%s^x04與^x03%s^x04(警告:^x03%d^x04次)",kName,vName,weapon,g_playerFlashWarn)
client_color(0, killer, str);
if( get_cvar_num("fc_record") )
recordEvent(str);
client_print(0,print_chat,"%s",str);
if( g_playerFlashWarn>=get_cvar_num("fc_flashwarntime") ){
g_startVoteType=2;
InitVote(killer);
g_playerFlashWarn=0;
}
g_playerFlashed=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,Float:kilOri,Float:viewOff,Float:hitOri;
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+=viewOff;
kilOri+=viewOff;
kilOri+=viewOff;
if( victim==trace_line(killer, kilOri, vicOri, hitOri) )
return PLUGIN_HANDLED;
new kName;
get_user_name(killer,kName,31);
new str;
new retV=checkPoint(killer,victim,kilOri,vicOri)
if( retV ){
format(str,511,"^x04【征战检测】^x03%s^x04看見您的[^x03%s^x04]",kName,g_bodyStr)
client_color(victim, killer, str);
//client_print(victim,print_chat,"^x04%s^x01看見您^x04%s",kName,g_bodyStr);
return PLUGIN_HANDLED;
}
//draws a beam form killer's eyes to the victim's hitplace
VelocityByAim ( killer,floatround( vector_distance(kilOri,vicOri) ),hitOri);
vicOri=kilOri + hitOri;
vicOri=kilOri + hitOri;
vicOri=kilOri + hitOri;
/* if there is no wall,use following to get hit position: */
//get_user_origin(killer,vicOri,3);
new start,end;
FVecIVec(kilOri,start);
FVecIVec(vicOri,end);
new players,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++;
new vName;
get_user_name(victim,vName,31);
new str;
format(str,511,"^x04【征战检测】^x03%s^x04使用^x03%s^x04穿牆殺死了^x03%s^x04(警告:^x03%d^x04次)",kName,weapon,vName,g_playerThWallWarn)
client_color(0, killer, str);
if( get_cvar_num("fc_record") )
recordEvent(str);
//client_print(0,print_chat,"%s",str);
//client_print(0,print_chat,"--->> [ Player %s killed %s with %s through the wall. (Warning: %d) ] ",kName,vName,weapon,g_playerThWallWarn);
if( g_playerThWallWarn>=get_cvar_num("fc_thwallwarntime") ){
g_startVoteType=1;
InitVote(killer);
g_playerThWallWarn=0;
}
return PLUGIN_HANDLED;
}
/*make 6 traces at the victim to check can the killer see the victim*/
public checkPoint(killer,victim,Float:kilOri,Float:vicOri)
{
new isDuck=0,Float:hitVec;
if( get_user_button (victim)IN_DUCK )
isDuck=1;
//------get head pos
//new Float:H_reV;
VelocityByAim (victim, 7 ,hitVec);
hitVec+=24;
hitVec += vicOri;
hitVec += vicOri;
hitVec += vicOri;
if(isDuck)
hitVec+=5;//higher
if( checkVisible(killer,victim,kilOri,hitVec) )
return 1;
//------get gun pos
//new Float:G_reV
VelocityByAim (victim, 38 ,hitVec);
hitVec +=vicOri;
hitVec +=vicOri;
hitVec +=vicOri;
hitVec+=10;//higher
if( checkVisible(killer,victim,kilOri,hitVec) )
return 2; 接楼上
//change the angle to get the origin of another check points
new Float:ang
entity_get_vector(victim,EV_VEC_v_angle,ang)
//turn left--to get left pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13 ,hitVec);
hitVec += vicOri;
hitVec += vicOri;
hitVec += vicOri+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 4;
//turn back--to get back pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
new backpos=10;
if(isDuck)
backpos+=10
VelocityByAim (victim,backpos,hitVec);
hitVec +=vicOri;
hitVec +=vicOri;
hitVec +=vicOri;
if(isDuck)
hitVec+=7;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 3;
//turn right--to get right pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13+4 ,hitVec);
hitVec += vicOri;
hitVec += vicOri;
hitVec += vicOri+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 5;
//------get foot pos
//new Float:F_reV;
new footpos=34
if(isDuck)
footpos-=18;
hitVec=vicOri;
hitVec=vicOri;
hitVec=vicOri-footpos;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 6;
return 0;
}
checkVisible(killer,victim,Float:startOri,Float:endOri)
{
new Float:hitOri;
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);
write_coord(staPos);
write_coord(staPos);
write_coord(endPos);
write_coord(endPos);
write_coord(endPos);
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 ) //startPos
write_coord( endPos )
write_coord( endPos-size )
write_coord( endPos ) //endPos
write_coord( endPos )
write_coord( endPos+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-size ) //startPos
write_coord( endPos )
write_coord( endPos )
write_coord( endPos+size ) //endPos
write_coord( endPos )
write_coord( endPos )
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 ) //startPos
write_coord( endPos-size )
write_coord( endPos )
write_coord( endPos ) //endPos
write_coord( endPos+size )
write_coord( endPos )
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,useridStr;
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;
format(data,255,"%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() )
{
new str;
format(str,511,"^x04【征战提示】投票將延遲 ^x03%d ^x04秒",MAXHODESEC)
client_color(0, 0, str);
//client_print(0,print_chat,"投票將延遲 %d 秒",MAXHODESEC);
set_task(MAXHODESEC*1.0,"InitVote",target)
return PLUGIN_HANDLED;
}*/
new str;
switch( g_startVoteType ){
case 0: format(str,127," %d times surpassed the Speed limit",g_playerSpeedWarn);
case 1: format(str,127," %d times killed player through the wall",g_playerThWallWarn);
case 2: format(str,127," %d times killed player when he is blinding",g_playerFlashWarn);
}
new menuBody,pname;
get_user_name(target,pname,31);
new len=format(menuBody,511,"\r 請問你 %s 是否作弊者 ? ^n",pname);
len+=format(menuBody,511-len,"\d( %s )^n^n",str);
len+=format(menuBody,511-len,"\w8. 是.他是作弊者 ! ^n");
len+=format(menuBody,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;
g_voteCount=0;
set_task(MAXHODESEC*1.0,"showResult",target);
return PLUGIN_HANDLED
}
public actionMenu(id,key)
{
g_voteCount++;
new pname;
get_user_name(id,pname,31);
new str;
format(str,511,"^x04【征战提示】^x03%s ^x04選擇了 ^x03%s",pname,g_voteResStr)
client_color(0, id, str);
//client_print(0,print_chat,"%s 選擇 %s",pname,g_voteResStr);
return PLUGIN_HANDLED
}
public showResult(target)
{
new str;
new Float:result=0.0;
result = ( g_voteCount+g_voteCount ) ? (float(g_voteCount) / float( get_playersnum(0) ) ) : 0.0
if( result>=get_cvar_float("fc_voterate") & is_user_connected(target) ){
format(str,511,"^x04【征战提示】結果 ^x03%0.1f . ^x04是 ^x03%d . ^x04不是 ^x03%d .作弊者將會被懲罰!",result,g_voteCount,g_voteCount)
client_color(0, id, str);
//client_print(0,print_chat,"結果 %0.1f . 是 %d . 不是 %d .作弊者將會被懲罰!",result,g_voteCount,g_voteCount);
excutePunish(target);
}
else //client_print(0,print_chat,"結果 %0.1f . 是 %d . 不是 %d !",result,g_voteCount,g_voteCount);
format(str,511,"^x04【征战提示】結果 ^x03%0.1f . ^x04是 ^x03%d . ^x04不是 ^x03%d !",result,g_voteCount,g_voteCount)
client_color(0, id, str);
return PLUGIN_HANDLED;
}
/* ------------------ Info --------------------*/
public disInfo(id)
{
const SIZE=1536
new msg,len=0,players,num,pname,t;
get_players(players,num);
//CS1.5
/* if( get_cvar_num("fc_startvote") )
len += format(msg, SIZE - len, "如果你的警告到了上限?!系統將自動投票!^n^n")
else len += format(msg, SIZE - len, "如果你的警告到了上限?!您將被懲罰!^n^n")
for(new i=0;i<num;i++){
t=players;
if( !g_playerThWallWarn & !g_playerSpeedWarn && !g_playerFlashWarn)
continue;
else {
get_user_name(t,pname,31);
len += format(msg, SIZE - len, "%s---->穿牆警告( %d )---->速度警告( %d )---->閃光警告( %d )^n^n",pname,g_playerThWallWarn,g_playerSpeedWarn,g_playerFlashWarn);
}
}
len += format(msg, SIZE - len, "^n穿牆警告到達極限 (穿牆警告) : %d^n",get_cvar_num("fc_thwallwarntime"));
len += format(msg, SIZE - len, "速度警告到達極限 (速度警告) : %d^n",get_cvar_num("fc_speedwarntime"));
len += format(msg, SIZE - len, "閃光警告到達極限 (閃光警告) : %d",get_cvar_num("fc_flashwarntime"));
*/
//CS1.6
len += format(msg, SIZE - len, "<html><body>");
len += format(msg, SIZE - len, "<center>");
len += format(msg, SIZE - len, "<table width=^"25%^" border=^"1^">");
len += format(msg, SIZE - len, "<tr><td><b>玩家名稱</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 & !g_playerSpeedWarn && !g_playerFlashWarn)
continue;
else {
get_user_name(t,pname,31);
len += format(msg, SIZE - len, "<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td>",pname,g_playerThWallWarn,g_playerSpeedWarn,g_playerFlashWarn);
}
}
len += format(msg, SIZE - len, "</table>");
len += format(msg, SIZE - len, "<p></p>");
if( get_cvar_num("fc_startvote") )
len += format(msg, SIZE - len, "<p><b>如果你的警告到達極限?!系統將會投票 !</b></p>");
else len += format(msg, SIZE - len, "<p><b>如果你的警告到達極限?!您將會被懲罰 !</b></p>");
len += format(msg, SIZE - len, "<p align=left><b>現在設置:</b></p>");
len += format(msg, SIZE - len, "<p></p>");
len += format(msg, SIZE - len, "<p align=left>穿牆警告極限(<b>穿牆警告</b>): %d</p>",get_cvar_num("fc_thwallwarntime"));
len += format(msg, SIZE - len, "<p align=left>速度警告極限(<b>速度警告</b>): %d</p>",get_cvar_num("fc_speedwarntime"));
len += format(msg, SIZE - len, "<p align=left>閃光警告極限(<b>閃光警告</b>): %d</p>",get_cvar_num("fc_flashwarntime"));
show_motd ( id, msg, "FC Stat");
return PLUGIN_CONTINUE;
} 接楼上
//change the angle to get the origin of another check points
new Float:ang
entity_get_vector(victim,EV_VEC_v_angle,ang)
//turn left--to get left pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13 ,hitVec);
hitVec += vicOri;
hitVec += vicOri;
hitVec += vicOri+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 4;
//turn back--to get back pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
new backpos=10;
if(isDuck)
backpos+=10
VelocityByAim (victim,backpos,hitVec);
hitVec +=vicOri;
hitVec +=vicOri;
hitVec +=vicOri;
if(isDuck)
hitVec+=7;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 3;
//turn right--to get right pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13+4 ,hitVec);
hitVec += vicOri;
hitVec += vicOri;
hitVec += vicOri+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 5;
//------get foot pos
//new Float:F_reV;
new footpos=34
if(isDuck)
footpos-=18;
hitVec=vicOri;
hitVec=vicOri;
hitVec=vicOri-footpos;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 6;
return 0;
}
checkVisible(killer,victim,Float:startOri,Float:endOri)
{
new Float:hitOri;
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);
write_coord(staPos);
write_coord(staPos);
write_coord(endPos);
write_coord(endPos);
write_coord(endPos);
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 ) //startPos
write_coord( endPos )
write_coord( endPos-size )
write_coord( endPos ) //endPos
write_coord( endPos )
write_coord( endPos+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-size ) //startPos
write_coord( endPos )
write_coord( endPos )
write_coord( endPos+size ) //endPos
write_coord( endPos )
write_coord( endPos )
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 ) //startPos
write_coord( endPos-size )
write_coord( endPos )
write_coord( endPos ) //endPos
write_coord( endPos+size )
write_coord( endPos )
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,useridStr;
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;
format(data,255,"%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() )
{
new str;
format(str,511,"^x04【征战提示】投票將延遲 ^x03%d ^x04秒",MAXHODESEC)
client_color(0, 0, str);
//client_print(0,print_chat,"投票將延遲 %d 秒",MAXHODESEC);
set_task(MAXHODESEC*1.0,"InitVote",target)
return PLUGIN_HANDLED;
}*/
new str;
switch( g_startVoteType ){
case 0: format(str,127," %d times surpassed the Speed limit",g_playerSpeedWarn);
case 1: format(str,127," %d times killed player through the wall",g_playerThWallWarn);
case 2: format(str,127," %d times killed player when he is blinding",g_playerFlashWarn);
}
new menuBody,pname;
get_user_name(target,pname,31);
new len=format(menuBody,511,"\r 請問你 %s 是否作弊者 ? ^n",pname);
len+=format(menuBody,511-len,"\d( %s )^n^n",str);
len+=format(menuBody,511-len,"\w8. 是.他是作弊者 ! ^n");
len+=format(menuBody,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;
g_voteCount=0;
set_task(MAXHODESEC*1.0,"showResult",target);
return PLUGIN_HANDLED
}
public actionMenu(id,key)
{
g_voteCount++;
new pname;
get_user_name(id,pname,31);
new str;
format(str,511,"^x04【征战提示】^x03%s ^x04選擇了 ^x03%s",pname,g_voteResStr)
client_color(0, id, str);
//client_print(0,print_chat,"%s 選擇 %s",pname,g_voteResStr);
return PLUGIN_HANDLED
}
public showResult(target)
{
new str;
new Float:result=0.0;
result = ( g_voteCount+g_voteCount ) ? (float(g_voteCount) / float( get_playersnum(0) ) ) : 0.0
if( result>=get_cvar_float("fc_voterate") & is_user_connected(target) ){
format(str,511,"^x04【征战提示】結果 ^x03%0.1f . ^x04是 ^x03%d . ^x04不是 ^x03%d .作弊者將會被懲罰!",result,g_voteCount,g_voteCount)
client_color(0, id, str);
//client_print(0,print_chat,"結果 %0.1f . 是 %d . 不是 %d .作弊者將會被懲罰!",result,g_voteCount,g_voteCount);
excutePunish(target);
}
else //client_print(0,print_chat,"結果 %0.1f . 是 %d . 不是 %d !",result,g_voteCount,g_voteCount);
format(str,511,"^x04【征战提示】結果 ^x03%0.1f . ^x04是 ^x03%d . ^x04不是 ^x03%d !",result,g_voteCount,g_voteCount)
client_color(0, id, str);
return PLUGIN_HANDLED;
}
/* ------------------ Info --------------------*/
public disInfo(id)
{
const SIZE=1536
new msg,len=0,players,num,pname,t;
get_players(players,num);
//CS1.5
/* if( get_cvar_num("fc_startvote") )
len += format(msg, SIZE - len, "如果你的警告到了上限?!系統將自動投票!^n^n")
else len += format(msg, SIZE - len, "如果你的警告到了上限?!您將被懲罰!^n^n")
for(new i=0;i<num;i++){
t=players;
if( !g_playerThWallWarn & !g_playerSpeedWarn && !g_playerFlashWarn)
continue;
else {
get_user_name(t,pname,31);
len += format(msg, SIZE - len, "%s---->穿牆警告( %d )---->速度警告( %d )---->閃光警告( %d )^n^n",pname,g_playerThWallWarn,g_playerSpeedWarn,g_playerFlashWarn);
}
}
len += format(msg, SIZE - len, "^n穿牆警告到達極限 (穿牆警告) : %d^n",get_cvar_num("fc_thwallwarntime"));
len += format(msg, SIZE - len, "速度警告到達極限 (速度警告) : %d^n",get_cvar_num("fc_speedwarntime"));
len += format(msg, SIZE - len, "閃光警告到達極限 (閃光警告) : %d",get_cvar_num("fc_flashwarntime"));
*/
//CS1.6
len += format(msg, SIZE - len, "<html><body>");
len += format(msg, SIZE - len, "<center>");
len += format(msg, SIZE - len, "<table width=^"25%^" border=^"1^">");
len += format(msg, SIZE - len, "<tr><td><b>玩家名稱</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 & !g_playerSpeedWarn && !g_playerFlashWarn)
continue;
else {
get_user_name(t,pname,31);
len += format(msg, SIZE - len, "<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td>",pname,g_playerThWallWarn,g_playerSpeedWarn,g_playerFlashWarn);
}
}
len += format(msg, SIZE - len, "</table>");
len += format(msg, SIZE - len, "<p></p>");
if( get_cvar_num("fc_startvote") )
len += format(msg, SIZE - len, "<p><b>如果你的警告到達極限?!系統將會投票 !</b></p>");
else len += format(msg, SIZE - len, "<p><b>如果你的警告到達極限?!您將會被懲罰 !</b></p>");
len += format(msg, SIZE - len, "<p align=left><b>現在設置:</b></p>");
len += format(msg, SIZE - len, "<p></p>");
len += format(msg, SIZE - len, "<p align=left>穿牆警告極限(<b>穿牆警告</b>): %d</p>",get_cvar_num("fc_thwallwarntime"));
len += format(msg, SIZE - len, "<p align=left>速度警告極限(<b>速度警告</b>): %d</p>",get_cvar_num("fc_speedwarntime"));
len += format(msg, SIZE - len, "<p align=left>閃光警告極限(<b>閃光警告</b>): %d</p>",get_cvar_num("fc_flashwarntime"));
show_motd ( id, msg, "FC Stat");
return PLUGIN_CONTINUE;
} 接楼上
//change the angle to get the origin of another check points
new Float:ang
entity_get_vector(victim,EV_VEC_v_angle,ang)
//turn left--to get left pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13 ,hitVec);
hitVec += vicOri;
hitVec += vicOri;
hitVec += vicOri+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 4;
//turn back--to get back pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
new backpos=10;
if(isDuck)
backpos+=10
VelocityByAim (victim,backpos,hitVec);
hitVec +=vicOri;
hitVec +=vicOri;
hitVec +=vicOri;
if(isDuck)
hitVec+=7;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 3;
//turn right--to get right pos
ang+=90
entity_set_vector(victim,EV_VEC_v_angle,ang)
VelocityByAim (victim, 13+4 ,hitVec);
hitVec += vicOri;
hitVec += vicOri;
hitVec += vicOri+6;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 5;
//------get foot pos
//new Float:F_reV;
new footpos=34
if(isDuck)
footpos-=18;
hitVec=vicOri;
hitVec=vicOri;
hitVec=vicOri-footpos;
if( checkVisible(killer,victim,kilOri,hitVec) )
return 6;
return 0;
}
checkVisible(killer,victim,Float:startOri,Float:endOri)
{
new Float:hitOri;
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);
write_coord(staPos);
write_coord(staPos);
write_coord(endPos);
write_coord(endPos);
write_coord(endPos);
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 ) //startPos
write_coord( endPos )
write_coord( endPos-size )
write_coord( endPos ) //endPos
write_coord( endPos )
write_coord( endPos+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-size ) //startPos
write_coord( endPos )
write_coord( endPos )
write_coord( endPos+size ) //endPos
write_coord( endPos )
write_coord( endPos )
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 ) //startPos
write_coord( endPos-size )
write_coord( endPos )
write_coord( endPos ) //endPos
write_coord( endPos+size )
write_coord( endPos )
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,useridStr;
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;
format(data,255,"%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() )
{
new str;
format(str,511,"^x04【征战提示】投票將延遲 ^x03%d ^x04秒",MAXHODESEC)
client_color(0, 0, str);
//client_print(0,print_chat,"投票將延遲 %d 秒",MAXHODESEC);
set_task(MAXHODESEC*1.0,"InitVote",target)
return PLUGIN_HANDLED;
}*/
new str;
switch( g_startVoteType ){
case 0: format(str,127," %d times surpassed the Speed limit",g_playerSpeedWarn);
case 1: format(str,127," %d times killed player through the wall",g_playerThWallWarn);
case 2: format(str,127," %d times killed player when he is blinding",g_playerFlashWarn);
}
new menuBody,pname;
get_user_name(target,pname,31);
new len=format(menuBody,511,"\r 請問你 %s 是否作弊者 ? ^n",pname);
len+=format(menuBody,511-len,"\d( %s )^n^n",str);
len+=format(menuBody,511-len,"\w8. 是.他是作弊者 ! ^n");
len+=format(menuBody,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;
g_voteCount=0;
set_task(MAXHODESEC*1.0,"showResult",target);
return PLUGIN_HANDLED
}
public actionMenu(id,key)
{
g_voteCount++;
new pname;
get_user_name(id,pname,31);
new str;
format(str,511,"^x04【征战提示】^x03%s ^x04選擇了 ^x03%s",pname,g_voteResStr)
client_color(0, id, str);
//client_print(0,print_chat,"%s 選擇 %s",pname,g_voteResStr);
return PLUGIN_HANDLED
}
public showResult(target)
{
new str;
new Float:result=0.0;
result = ( g_voteCount+g_voteCount ) ? (float(g_voteCount) / float( get_playersnum(0) ) ) : 0.0
if( result>=get_cvar_float("fc_voterate") & is_user_connected(target) ){
format(str,511,"^x04【征战提示】結果 ^x03%0.1f . ^x04是 ^x03%d . ^x04不是 ^x03%d .作弊者將會被懲罰!",result,g_voteCount,g_voteCount)
client_color(0, id, str);
//client_print(0,print_chat,"結果 %0.1f . 是 %d . 不是 %d .作弊者將會被懲罰!",result,g_voteCount,g_voteCount);
excutePunish(target);
}
else //client_print(0,print_chat,"結果 %0.1f . 是 %d . 不是 %d !",result,g_voteCount,g_voteCount);
format(str,511,"^x04【征战提示】結果 ^x03%0.1f . ^x04是 ^x03%d . ^x04不是 ^x03%d !",result,g_voteCount,g_voteCount)
client_color(0, id, str);
return PLUGIN_HANDLED;
}
/* ------------------ Info --------------------*/
public disInfo(id)
{
const SIZE=1536
new msg,len=0,players,num,pname,t;
get_players(players,num);
//CS1.5
/* if( get_cvar_num("fc_startvote") )
len += format(msg, SIZE - len, "如果你的警告到了上限?!系統將自動投票!^n^n")
else len += format(msg, SIZE - len, "如果你的警告到了上限?!您將被懲罰!^n^n")
for(new i=0;i<num;i++){
t=players;
if( !g_playerThWallWarn & !g_playerSpeedWarn && !g_playerFlashWarn)
continue;
else {
get_user_name(t,pname,31);
len += format(msg, SIZE - len, "%s---->穿牆警告( %d )---->速度警告( %d )---->閃光警告( %d )^n^n",pname,g_playerThWallWarn,g_playerSpeedWarn,g_playerFlashWarn);
}
}
len += format(msg, SIZE - len, "^n穿牆警告到達極限 (穿牆警告) : %d^n",get_cvar_num("fc_thwallwarntime"));
len += format(msg, SIZE - len, "速度警告到達極限 (速度警告) : %d^n",get_cvar_num("fc_speedwarntime"));
len += format(msg, SIZE - len, "閃光警告到達極限 (閃光警告) : %d",get_cvar_num("fc_flashwarntime"));
*/
//CS1.6
len += format(msg, SIZE - len, "<html><body>");
len += format(msg, SIZE - len, "<center>");
len += format(msg, SIZE - len, "<table width=^"25%^" border=^"1^">");
len += format(msg, SIZE - len, "<tr><td><b>玩家名稱</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 & !g_playerSpeedWarn && !g_playerFlashWarn)
continue;
else {
get_user_name(t,pname,31);
len += format(msg, SIZE - len, "<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td>",pname,g_playerThWallWarn,g_playerSpeedWarn,g_playerFlashWarn);
}
}
len += format(msg, SIZE - len, "</table>");
len += format(msg, SIZE - len, "<p></p>");
if( get_cvar_num("fc_startvote") )
len += format(msg, SIZE - len, "<p><b>如果你的警告到達極限?!系統將會投票 !</b></p>");
else len += format(msg, SIZE - len, "<p><b>如果你的警告到達極限?!您將會被懲罰 !</b></p>");
len += format(msg, SIZE - len, "<p align=left><b>現在設置:</b></p>");
len += format(msg, SIZE - len, "<p></p>");
len += format(msg, SIZE - len, "<p align=left>穿牆警告極限(<b>穿牆警告</b>): %d</p>",get_cvar_num("fc_thwallwarntime"));
len += format(msg, SIZE - len, "<p align=left>速度警告極限(<b>速度警告</b>): %d</p>",get_cvar_num("fc_speedwarntime"));
len += format(msg, SIZE - len, "<p align=left>閃光警告極限(<b>閃光警告</b>): %d</p>",get_cvar_num("fc_flashwarntime"));
show_motd ( id, msg, "FC Stat");
return PLUGIN_CONTINUE;
} 编译错误如下://AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// findCheater.sma
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(131) :
error 001: expected token: ";", but found "("
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(131 --
132) : warning 215: expression has no effect
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(132) :
warning 209: function "entity_is_on_ground" should return a value
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(224) :
error 035: argument type mismatch (argument 1)
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(225) :
error 035: argument type mismatch (argument 1)
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(233) :
error 021: symbol already defined: "str"
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(256) :
error 001: expected token: ")", but found "("
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(256) :
warning 215: expression has no effect
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(256) :
error 001: expected token: ";", but found ")"
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(256) :
error 029: invalid expression, assumed zero
// C:\Documents and Settings\Administrator\桌面\scripting\findCheater.sma(256) :
fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 8 Errors.
// Could not locate output file C:\Documents and Settings\Administrator\桌面\scr
ipting\compiled\findCheater.amx (compile failed).
//
// Compilation Time: 0.66 sec
// ----------------------------------------
Press enter to exit ...
编译环境:AMXX 1.8.1 .inc齐全 你发代码也不是这样发的吧。。。。既然太长就直接打包上来有那么难吗 你发得舒服人家看得蛋疼 你发得舒服人家看得蛋疼
rsdtt 发表于 2011-8-28 15:44 http://www.dt-club.net/forum/images/common/back.gif
r版,源码在一楼附件,谢谢。下次不在还样发了,也是想为大家节约DTB啊 return entity_get_int(entity, EV_INT_flags) & FL_ONGROUND
131行尝试这样改一下 这么大的一个插件得消耗多少内存资源啊
页:
[1]
2