引用
引用楼主softwind于2007-03-28 20:41发表的 暴力核心编程(1)--穿墙代码 :
从今天起,鄙人将陆续转贴CS暴力外挂的核心代码,但是看这些东西,首先要懂英文,其次要熟悉C++语言,再深度的还要对空间解析几何和SDK有所了解,我也在不断学习。很多人骂CCA的挂是垃圾,任何软件都有一个发展、成熟的过程,成天不学无术,只会拿别人的作品,在脚本上改来改去,打上自己的标签--“xxx专用”,实质上毫无技术含量,也没资格评点别人!因为你只是个编程技术文盲,有一天你能看懂这些核心的内容,你才能制作出高水平的Hook。这段代码是OGC的标准autowall,它用来判断人物自身位置(me.ent->origin)与目标间是否可以穿透,不同的木仓支其穿透力是不同的,TraceThickness是穿透力计算的主函数,要完全看懂它是很困难的,但至少要了解它是核心代码,对编程感兴趣的可以相互探讨学习。只会骂人,满口脏话的,拜托先去幼儿园补习下文明礼貌!* go to client.cpp and type at the top #include "trace.cpp" #include "trace.h" #include "defs.h" * ok now keep client.cpp open and search for "see attack" * you should see somethin like //see attack.h int currentWeaponID=0; * delete all of that as its going to be defined where the a-wall codin is.. * now go back up to the top of client.cpp and anywhere really u can paste this.. // autowall int penetrate; int currentWeaponID=0; bool CorrectGunX() { if(currentWeaponID==WEAPON_DEAGLE) { penetrate = WALL_PEN1; return true; } else if(currentWeaponID==WEAPON_SCOUT) { penetrate = WALL_PEN2; return true; } else if(currentWeaponID==WEAPON_AWP) { penetrate = WALL_PEN2; return true; } else if(currentWeaponID==WEAPON_SIG) { penetrate = WALL_PEN1; return true; } else if(currentWeaponID==WEAPON_COLT) { penetrate = WALL_PEN1; return true; } else if(currentWeaponID==WEAPON_PARA) { penetrate = WALL_PEN1; return true; } else if(currentWeaponID==WEAPON_AUG) { penetrate = WALL_PEN1; return true; } else if(currentWeaponID==WEAPON_AK) { penetrate = WALL_PEN1; return true; } else if(currentWeaponID==WEAPON_SG550) { penetrate = WALL_PEN1; return true; } else if(currentWeaponID==WEAPON_G3SG1) { penetrate = WALL_PEN1; return true; } else { penetrate = WALL_PEN0; return true; } } int GetCurPenetration(void) { if (CorrectGunX()) return penetrate; return WALL_PEN0; } bool CanPenetrate(float *start, float *end) { int maxhits = 10, count = 0; float damage = 120; strace_t tr; pmtrace_t beam_tr, beam_tr1, *tmptr; float srcorigin[3]; float diff[3], length, viewvec[3], unityview[3], position[3]; viewvec[0] = end[0] - start[0]; viewvec[1] = end[1] - start[1]; viewvec[2] = end[2] - start[2]; length = VectorLength(viewvec); unityview[0] = viewvec[0] / length; unityview[1] = viewvec[1] / length; unityview[2] = viewvec[2] / length; srcorigin[0] = start[0]; srcorigin[1] = start[1]; srcorigin[2] = start[2]; while (damage > 10 && maxhits > 0) { maxhits--; TraceThickness(srcorigin, end, 0, &tr); if (tr.finished) break; if (srcorigin[0] != tr.endpos[0] || srcorigin[1] != tr.endpos[1] || srcorigin[2] != tr.endpos[2]) count++; if (count >= 2 && !tr.finished) { damage = 0; break; } position[0] = tr.endpos[0] + unityview[0] * 8.0; position[1] = tr.endpos[1] + unityview[1] * 8.0; position[2] = tr.endpos[2] + unityview[2] * 8.0; tmptr = gEngfuncs.PM_TraceLine(position, end, PM_TRACELINE_PHYSENTSONLY, 2, -1); memcpy(&beam_tr, tmptr, sizeof(pmtrace_t)); if (!beam_tr.allsolid) { tmptr = gEngfuncs.PM_TraceLine(beam_tr.endpos, tr.endpos, PM_TRACELINE_PHYSENTSONLY, 2, -1); memcpy(&beam_tr1, tmptr, sizeof(pmtrace_t)); diff[0] = beam_tr1.endpos[0] - tr.endpos[0]; diff[1] = beam_tr1.endpos[1] - tr.endpos[1]; diff[2] = beam_tr1.endpos[2] - tr.endpos[2]; length = VectorLength(diff); if (length < damage) { damage -= length; srcorigin[0] = beam_tr1.endpos[0] + unityview[0]; srcorigin[1] = beam_tr1.endpos[1] + unityview[1]; srcorigin[2] = beam_tr1.endpos[2] + unityview[2]; } } else damage = 0; } if (maxhits == 0 && damage) { tr.finished = false; while (!tr.finished) { TraceThickness(srcorigin, end, 0, &tr); if (tr.allsolid) return false; if (!tr.startsolid) { if (tr.finished) return damage > 0.0; return false; } srcorigin[0] = tr.endpos[0] + unityview[0]; srcorigin[1] = tr.endpos[1] + unityview[1]; srcorigin[2] = tr.endpos[2] + unityview[2]; } } return damage > 0.0; } bool pathFree(float *start, float *end) { bool pathtest; strace_t tr; if (cvar.autowall && GetCurPenetration()) { pathtest = CanPenetrate(start, end); } else { TraceThickness(start, end, 0, &tr); if (tr.finished) pathtest = true; else pathtest = false; } return pathtest; } * ok now open up "trace.h" and add these definitions newhere again #define WALL_PEN0 0 #define WALL_PEN1 1 #define WALL_PEN2 2 * open up both cvar.cpp and cvar.h now register the cvar "autowall" * go to ur "common" folder and open up com_model.h * search for "MinMaxS" and then u should see a "short" next to it.. * change the "short" to a "float" and theres 2 so do it to them both * now open up your aimbot.cpp and search for "pathfree" * delete all of that pathfree info as its already in client.cpp P.S u can just take the autowall pathfree coding and replace it with the one in aimbot.cpp but u'd have to do the #includes in autowall too.. * ok now compile if u get NE WARNINGS where the Canpenetrate coding is then change the "bool CanPenetrate" to "static bool CanPenetrate" To any hack but Joolz 1.11 Back to top