.::: 一路问情 :::.
  • 注册
  • 登录
  • 会员
  • 生存游戏
  • FTP资源中心
  • 七海争霸
  • 社区设施
  • 帮助
.::: 一路问情 :::. » 『CS交流区』 » 暴力核心编程(1)--穿墙代码
‹‹ 上一主题 | 下一主题 ››
发新话题
  • 发新话题
  • 发布投票
  • 发布商品
  • 发布悬赏
  • 发布活动
  • 发布辩论
  • 发布视频
打印

[CS1.6脚本] 暴力核心编程(1)--穿墙代码

一如从前

SY的斑猪们,激情拿出来


运营组

Rank: 11Rank: 11Rank: 11Rank: 11

帖子
4896 
威望
2165 点 
金钱
6904 元 
好评
661 点 
  • 个人空间
  • 发短消息
  • 加为好友
  • 当前离线
1楼 大 中 小 发表于 2007-6-28 01:57  只看该作者

暴力核心编程(1)--穿墙代码

这段代码是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"




欢迎访问秘密网:http://www.mimiwang.cn
添加 一如从前 为MSN好友 通过MSN和 一如从前 交谈 QQ
UID
15 
精华
11 
积分
2165 
钻石
1 克拉 
宣传
0 点 
来路
误闯进来 
阅读权限
1 
性别
男 
在线时间
2146 小时 
注册时间
2006-8-18 
最后登录
2008-7-19 

查看个人网站

查看详细资料

TOP

qiqi2143214

初级会员

帖子
10 
威望
0 点 
金钱
0 元 
好评
0 点 
  • 个人空间
  • 发短消息
  • 加为好友
  • 当前离线
2楼 大 中 小 发表于 2008-4-10 01:47  只看该作者
啊十大萨斯  撒旦萨阿达上的撒



QQ
UID
91111 
精华
0 
积分
0 
钻石
0 克拉 
宣传
0 点 
来路
搜索引擎 
阅读权限
10 
性别
女 
来自
江苏 
在线时间
0 小时 
注册时间
2008-4-10 
最后登录
2008-4-10 

查看详细资料

TOP

‹‹ 上一主题 | 下一主题 ››
发新话题
 

 

当前时区 GMT+8, 现在时间是 2008-7-19 18:27 蜀ICP备08000616号

清除 Cookies - 联系我们 - Ask Love - Archiver - WAP - TOP - 界面风格

  • YUYU_Emera-x

Powered by Discuz! 6.0.0,

Processed in 0.028464 second(s), 5 queries, Gzip enabled.

  • 控制面板首页
  • 编辑个人资料
  • 积分交易
  • 积分记录
  • 公众用户组
  • 个人空间管理
  • 资源中心
  • 名人堂
  • 社区银行
  • 醒目高亮
  • 勋章中心
  • 空间互踩
  • 便民查询
  • 邮箱图标
如果你喜欢一路问情,请同时向你的5个QQ好友宣传Sy64.Com,多谢支持!
点击查看问情在alexa中的世界排名