全菜单的专杀设置
没权限上传文件和图片,只好提供部分代码供大家参考
-------------------------------------------------------
player.cpp
OgcCommandPlayer ogcPlayer;
typedef OgcCommandPlayer::Player Player;
typedef OgcCommandPlayer::PlayerEntry PlayerEntry;
void listPlayer(Player* pPlayer)
{
PlayerEntry newEntry;
sprintf(newEntry.name," relist all enemies ");
sprintf(newEntry.content,"relistplayer");
newEntry.player = 0;
pPlayer->items.push_back(newEntry);
sprintf(newEntry.name," change first kill mode (%d)",cvar.firstkill);
sprintf(newEntry.content,"first_kill_mode");
newEntry.player = 0;
pPlayer->items.push_back(newEntry);
sprintf(newEntry.name," change rush killed mode (%d)",cvar.waykilledmode);
sprintf(newEntry.content,"way_killed_mode");
newEntry.player = 0;
pPlayer->items.push_back(newEntry);
char *teamname;
for (int ax=0;ax<vPlayers.size();ax++)
{
if(strcmp(vPlayers[ax].entinfo.name,"\\missing-name\\") && vPlayers[ax].entinfo.name[0]!='\0' && vPlayers[ax].team>0 && (me.team != vPlayers[ax].team && cvar.team==0 || cvar.team==1 || me.team == vPlayers[ax].team && cvar.team>1))
{
if(vPlayers[ax].team==1)teamname="T";
if(vPlayers[ax].team==2)teamname="CT";
if(ogcPlayer.FirstKillPlayer[ax]==0)
sprintf(newEntry.name," (%d)(%s) %s",ax,teamname,vPlayers[ax].entinfo.name); //普通玩家
else if(ogcPlayer.FirstKillPlayer[ax]==1)
sprintf(newEntry.name," ** (%d)(%s) %s",ax,teamname,vPlayers[ax].entinfo.name); //优先专杀
else
sprintf(newEntry.name," -- (%d)(%s) %s",ax,teamname,vPlayers[ax].entinfo.name); //专不杀
sprintf(newEntry.content,"addplayer %d",ax); //菜单选则切换
newEntry.player = 0;
pPlayer->items.push_back(newEntry);
}
}
sprintf(newEntry.name," select all ");
sprintf(newEntry.content,"selectallplayer");
newEntry.player = 0;
pPlayer->items.push_back(newEntry);
sprintf(newEntry.name," clear all ");
sprintf(newEntry.content,"clearallplayer");
newEntry.player = 0;
pPlayer->items.push_back(newEntry);
}
void OgcCommandPlayer::init()
{
if(basePlayer) delete basePlayer;
basePlayer = new Player;
basePlayer->name = "GYJ Hack - Enemies list";
listPlayer(basePlayer);
}
void OgcCommandPlayer::AddPlayer(int ax)
{
if(FirstKillPlayer[ax]==0)
FirstKillPlayer[ax]=1;
else if(FirstKillPlayer[ax]==1)
FirstKillPlayer[ax]=2;
else
FirstKillPlayer[ax]=0;
}
void OgcCommandPlayer::ClearPlayer()
{
for(int i=0;i<MAX_VPLAYERS;i++)
{
FirstKillPlayer=0;
}
}
void OgcCommandPlayer::SelectAllPlayer()
{
for(int i=0;i<MAX_VPLAYERS;i++)
{
FirstKillPlayer=1;
}
}
void OgcCommandPlayer::RelistPlayer()
{
for(int i=0;i<MAX_VPLAYERS;i++)
{
if(i>=vPlayers.size())
return;
if(vPlayers.entinfo.name[0]=='\0')
FirstKillPlayer=0;
}
}
----------------------------------------------------------------------------------------------------
client.cpp
static OgcCommandPlayer::Player* curPlayer = ogcPlayer.basePlayer;
bool player_active = false;
bool gPlayerActive(){ return player_active; }
void drawPlayer( )
{
int x, y, w;
if (!player_active)
return;
if (!curPlayer)
curPlayer = ogcPlayer.basePlayer;
vector<OgcCommandPlayer::PlayerEntry>& items = curPlayer->items;
x = cvar.player_x;
y = cvar.player_y;
w = cvar.player_w;
enum{ TEXT_H = 16 };
int title_h = TEXT_H+2;
int frame_y = cvar.player_y - title_h;
int frame_h = items.size()*TEXT_H + title_h;
ColorEntry* c1 = colorList.get(42);
ColorEntry* c2 = colorList.get(43);
tintArea2(x,frame_y,w,title_h,c1,c2);
int h1 = curPlayer->selection*TEXT_H;
if(h1)
{
tintArea(x,y,w,h1,colorList.get(21));
y+=h1;
}
tintArea(x,y,w,TEXT_H,colorList.get(22));
y+=TEXT_H;
int numItemsLeft = items.size() - curPlayer->selection - 1;
if(numItemsLeft>0)
{
tintArea(x,y,w,numItemsLeft*TEXT_H,colorList.get(21));
}
register int c = 200;
gEngfuncs.pfnFillRGBA(x,frame_y,w,1 ,c,c,c,c);
gEngfuncs.pfnFillRGBA(x,frame_y,1,frame_h ,c,c,c,c);
gEngfuncs.pfnFillRGBA(x+w,frame_y,1,frame_h,c,c,c,c);
gEngfuncs.pfnFillRGBA(x,frame_y+frame_h,w,1,c,c,c,c);
gEngfuncs.pfnFillRGBA(x,cvar.player_y,w+1,1 ,c,c,c,c);
ColorEntry* c4 = colorList.get(45); // 34
// draw frame
Border(x,frame_y,w-4,frame_h,c4);
Menuline(x,cvar.player_y,w-3,1,c4);
DrawHudString(cvar.player_x+10,frame_y+1,255,0,255,const_cast<char*>(curPlayer->name.c_str()));
y=cvar.player_y;
x+=4;
for(int i=0;i<items.size();i++)
{
OgcCommandPlayer::PlayerEntry& item = items;
ColorEntry* clr = colorList.get(23); // "player_text"
gEngfuncs.pfnDrawSetTextColor(clr->onebased_r,clr->onebased_g,clr->onebased_b);
gEngfuncs.pfnDrawConsoleString(x,y,const_cast<char*>(item.name));
y+=TEXT_H;
}
}
void func_first_kill_mode()
{
if(cvar.firstkill==0)
cvar.firstkill=1; //先杀视野中的专杀对象
else if(cvar.firstkill==1)
cvar.firstkill=2; //只杀专杀对象,其他不杀
else if(cvar.firstkill==2)
cvar.firstkill=3; //杀光所有专杀对象后,再杀其他
else if(cvar.firstkill==3)
cvar.firstkill=4; //先杀视野中危险武器持有者
else
cvar.firstkill=0; //普通模式
sprintf(gHudMessage,"first kill mode: %d",cvar.firstkill);
gHudTimer.countdown(3);
}
void func_way_killed_mode()
{
if(cvar.waykilledmode==0)
cvar.waykilledmode=1; //杀掉一个专杀对象就逃跑
else if(cvar.waykilledmode==1)
cvar.waykilledmode=2; //杀掉任何一个目标就逃跑
else
cvar.waykilledmode=0; //普通模式
sprintf(gHudMessage,"way killed mode: %d",cvar.waykilledmode);
gHudTimer.countdown(3);
}
void func_relistplayer()
{
ogcPlayer.RelistPlayer();
}
void func_clearallplayer()
{
ogcPlayer.ClearPlayer();
}
void func_selectallplayer()
{
ogcPlayer.SelectAllPlayer();
}
void func_addplayer()
{
if(!cmd.argS(1).empty())
ogcPlayer.AddPlayer(cmd.argI(1));
}
void player_describe_current()
{
if(!player_active||!curPlayer) return;
OgcCommandPlayer::PlayerEntry& entry = curPlayer->items[curPlayer->selection];
}
void func_player_list()
{
if(!player_active)
{
cmd.exec("player_select");
}
else
player_active=false;
}
void func_player_select()
{
if(!player_active)
ogcPlayer.init();
if(!curPlayer)
{
curPlayer = ogcPlayer.basePlayer;
player_active = true;
player_describe_current();
return;
}
if(player_active)
{
OgcCommandPlayer::PlayerEntry& entry = curPlayer->items[curPlayer->selection];
if(entry.player)
{
curPlayer = entry.player;
curPlayer->boundSelection();
player_describe_current();
}
else
{
cmd.exec(const_cast<char*>(entry.content));
player_active=false;
func_player_select();
}
}
player_active=true;
}
void func_player_back()
{
if(!player_active || !curPlayer) return;
curPlayer = curPlayer->parent;
if(!curPlayer)
{
curPlayer = ogcPlayer.basePlayer;
player_active=false;
}
curPlayer->boundSelection();
player_describe_current();
}
void func_player_up()
{
if(!player_active || !curPlayer) return;
--curPlayer->selection;
curPlayer->boundSelection();
player_describe_current();
}
void func_player_off()
{
player_active=false;
}
void func_player_down()
{
if(!player_active || !curPlayer) return;
++curPlayer->selection;
curPlayer->boundSelection();
player_describe_current();
}
--------------------------------------------
aimbot.cpp
void OriginAimbot::FindTarget()
{
if(target!=-1 && (ogcPlayer.FirstKillPlayer[target]==2 || SameCheat[target]==1) && (cvar.opencheat || cvar.smallcheat)) //暴力模式下专不杀
target=-1;
if(cvar.firstkill>0 || (cvar.firstkill==0 && !cvar.opencheat && !cvar.smallcheat) )
{
if(cvar.lock && target!=-1 && vPlayers[target].getPVS() && GetPlayerVisX(target) && ( cvar.firstkill<=3 && ogcPlayer.FirstKillPlayer[target]==1 || cvar.firstkill==4 && TargeHaveDangeWeapon(target) ) )
return;
}
else
{
if (cvar.lock && target!=-1 && vPlayers[target].getPVS() && GetPlayerVisX(target))
return;
}
target=-1;
float fov=999.0;
if(!cvar.opencheat && !cvar.smallcheat)
fov=cvar.findcheaterfov; //温柔模式下搜索作弊者角度
else
fov=cvar.fov;
if(cvar.firstkill>0 || (cvar.firstkill==0 && !cvar.opencheat) )
{
for (int ax=0;ax<vPlayers.size();ax++)
{
if (vPlayers[ax].getPVS() && GetPlayerVisX(ax) && GetAimingTeam(ax) && vPlayers[ax].fovangle<fov && ( cvar.firstkill<=3 && ogcPlayer.FirstKillPlayer[ax]==1 || cvar.firstkill==4 && TargeHaveDangeWeapon(ax) && ogcPlayer.FirstKillPlayer[ax]<2 ) && SameCheat[ax]==0 && (cvar.rush || !cvar.rush && vPlayers[ax].distance<=cvar.aimdist))
{
if (target == -1)
{
target = ax;
continue;
}
switch(cvar.mode)
{
default:
case 0:
if (vPlayers[ax].visible == 2)
{
if (vPlayers[ax].distance < vPlayers[target].distance || vPlayers[target].visible == 1)
target = ax;
}
else if (vPlayers[ax].visible == 1 && vPlayers[target].visible == 1)
{
if (vPlayers[ax].distance < vPlayers[target].distance)
target = ax;
}
else if (!vPlayers[target].visible)
{
if (vPlayers[ax].distance < vPlayers[target].distance)
target = ax;
}
break;
case 1:
if (vPlayers[ax].visible == 2)
{
if (GetAimingFov(ax) > GetAimingFov(target) || vPlayers[target].visible == 1)
target = ax;
}
else if (vPlayers[ax].visible == 1 && vPlayers[target].visible == 1)
{
if (GetAimingFov(ax) > GetAimingFov(target))
target = ax;
}
else if (!vPlayers[target].visible)
{
if (GetAimingFov(ax) > GetAimingFov(target))
target = ax;
}
break;
}
}
}
}
if(target != -1)return;
if(cvar.firstkill==2 && cvar.opencheat)return; //狂暴力模式不杀普通玩家
if(cvar.firstkill==3 && cvar.opencheat) //狂暴力模式先追杀专杀对象
{
int firstkillstate=0;
if(!bFirstKilled)
{
for (int i=0;i<MAX_VPLAYERS;i++)
{
if(ogcPlayer.FirstKillPlayer==1 && SameCheat==0 && PlayerAlive(i) && vPlayers.team>0 && (cvar.team==1 || cvar.team==0 && me.team != vPlayers.team || cvar.team>1 && me.team == vPlayers.team))
firstkillstate=1;
}
}
if(firstkillstate==1) return;
}
if(!cvar.opencheat && !cvar.smallcheat)
fov=cvar.findplayerfov; //温柔模式下搜索普通玩家角度
else
fov=cvar.fov;
if( (cvar.firstkill==0 && target == -1) || (cvar.firstkill==1 && target == -1) || (cvar.firstkill==2 && target == -1 && !cvar.opencheat && !cvar.smallcheat) || (cvar.firstkill==3 && target == -1) || (cvar.firstkill==4 && target == -1))
{
for (int ax=0;ax<vPlayers.size();ax++)
{
if (vPlayers[ax].getPVS() && GetPlayerVisX(ax) && GetAimingTeam(ax) && vPlayers[ax].fovangle<fov && ogcPlayer.FirstKillPlayer[ax]<2 && SameCheat[ax]==0 && (cvar.rush || !cvar.rush && vPlayers[ax].distance<=cvar.aimdist))
{
if (target == -1)
{
target = ax;
continue;
}
switch(cvar.mode)
{
default:
case 0:
if (vPlayers[ax].visible == 2)
{
if (vPlayers[ax].distance < vPlayers[target].distance || vPlayers[target].visible == 1)
target = ax;
}
else if (vPlayers[ax].visible == 1 && vPlayers[target].visible == 1)
{
if (vPlayers[ax].distance < vPlayers[target].distance)
target = ax;
}
else if (!vPlayers[target].visible)
{
if (vPlayers[ax].distance < vPlayers[target].distance)
target = ax;
}
break;
case 1:
if (vPlayers[ax].visible == 2)
{
if (GetAimingFov(ax) > GetAimingFov(target) || vPlayers[target].visible == 1)
target = ax;
}
else if (vPlayers[ax].visible == 1 && vPlayers[target].visible == 1)
{
if (GetAimingFov(ax) > GetAimingFov(target))
target = ax;
}
else if (!vPlayers[target].visible)
{
if (GetAimingFov(ax) > GetAimingFov(target))
target = ax;
}
break;
}
}
}
}
if(target!=-1 && (ogcPlayer.FirstKillPlayer[target]==2 || SameCheat[target]==1) && (cvar.opencheat || cvar.smallcheat)) //暴力模式下专不杀
target=-1;
}
============================================================================
全部代码很复杂,这里只是提供参考。