本文整理汇总了C++中Entity::GetActiveWeapon方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetActiveWeapon方法的具体用法?C++ Entity::GetActiveWeapon怎么用?C++ Entity::GetActiveWeapon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GetActiveWeapon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsActiveWeaponPistol
bool Entity::IsActiveWeaponPistol()
{
int WeaponId = LocalEntity.GetActiveWeapon();
return( WeaponId == WEAPON_DEAGLE || WeaponId == WEAPON_ELITE || WeaponId == WEAPON_FIVESEVEN || WeaponId == WEAPON_GLOCK
|| WeaponId == WEAPON_P228 || WeaponId == WEAPON_USP || WeaponId == WEAPON_TEC9 || WeaponId == WEAPON_TASER || WeaponId == WEAPON_HKP2000 );
}
示例2: IsActiveWeaponNotVaild
bool Entity::IsActiveWeaponNotVaild()
{
int WeaponId = LocalEntity.GetActiveWeapon();
return( WeaponId == WEAPON_KNIFEGG || WeaponId == WEAPON_KNIFE || WeaponId == WEAPON_FLASHBANG || WeaponId == WEAPON_HEGRENADE || WeaponId == WEAPON_SMOKEGRENADE
|| WeaponId == WEAPON_MOLOTOV || WeaponId == WEAPON_DECOY || WeaponId == WEAPON_INCGRENADE || WeaponId == WEAPON_C4 );
}
示例3: DrawESP
void hud::DrawESP()
{
surface->SetFont(ui::font_hud);
surface->SetTextColor(0xff, 0xff, 0xff, 0xff);
Entity *lp = LocalPlayer();
int maxent = globals->maxclients();
for (int i = 1; i <= ents->GetMaxEntities(); ++i)
{
Entity *ent = ents->GetEntity(i);
if (ent == nullptr || ent == lp)
continue;
if (ent->IsDormant())
continue;
if (1 && i <= maxent)
{
if (!ent->IsAlive())
continue;
int x0, y0, x1, y1;
if (!MakeBox(ent, x0, y0, x1, y1))
continue;
surface->SetColor(0x00, 0x00, 0x00, 0x7f);
surface->DrawOutlinedRect(x0 - 1, y0 - 1, x1 + 1, y1 + 1);
surface->DrawOutlinedRect(x0 + 1, y0 + 1, x1 - 1, y1 - 1);
if (1) // menu.ESP.health
surface->DrawFilledRect(x0 - 4, y0 - 1, x0 - 1, y1 + 1);
#if defined(L4D) || defined(L4D2)
switch (ent->GetTeam())
{
case 2:
case 4:
surface->SetColor(0x46, 0x78, 0xff, 0xff);
break;
case 3:
surface->SetColor(0x96, 0x00, 0xe1, 0xff);
break;
}
#else
switch (ent->GetTeam())
{
case TEAM_RED:
surface->SetColor(0xff, 0x64, 0x64, 0xff);
break;
case TEAM_BLU:
surface->SetColor(0x46, 0x78, 0xff, 0xff);
break;
}
#endif
surface->DrawOutlinedRect(x0, y0, x1, y1);
if (1) // menu.ESP.health
{
if (ent->GetHealth() <= ent->GetMaxHealth())
{
if (ent->GetHealth() <= (ent->GetMaxHealth() / 4))
surface->SetColor(0xff, 0x00, 0x00, 0xff);
else
surface->SetColor(0x00, 0xff, 0x00, 0xff);
}
surface->DrawFilledRect(x0 - 3, y1 - Min<int>(y1 - y0, (float)(y1 - y0) * ((float)ent->GetHealth() / (float)ent->GetMaxHealth()) + 0.5f), x0 - 1, y1);
}
if (1) // menu.ESP.name
{
player_info info;
engine->GetPlayerInfo(i, info);
int length = 0;
const wchar_t *text = tounicode(info.name, length);
int tw, th;
surface->GetTextSize(ui::font_hud, text, tw, th);
surface->SetTextPos((x0 + x1 - tw) / 2, y0 - th);
surface->DrawText(text, length, 0);
}
if (1) // menu.ESP.weapon
{
Entity *weapon = ent->GetActiveWeapon();
if (weapon)
{
const char *classname = weapon->GetClass();
#ifndef GMOD
if (qstrlen(classname) > 6)
{
//.........这里部分代码省略.........
示例4: hooked_SetViewAngles
void __thiscall hooked_SetViewAngles(void *t, Angle &angles)
{
bpaware();
register UserCmd *ucmd asm("esi");
#ifdef GMOD
if (ucmd && ucmd->tick_count == 0 && ucmd->predicted)
return;
#endif
org_SetViewAngles(t, angles);
if (ucmd && ucmd->command_number == bp->next->arg<int>(1))
{
Entity *lp = LocalPlayer();
Entity *weapon = lp->GetActiveWeapon();
float curtime = (float)lp->GetTickCount() * globals->interval();
if (!lp->IsAlive())
return;
// static int speedcmd = 0;
// if (speedfix[(ucmd->command_number+1) % sizeof(speedfix)] = (GetAsyncKeyState(VK_LSHIFT) && --speedcmd > 0))
// {
// bp->next->next->next->next->ret -= 5;
// }
// else
// {
// speedcmd = 5;
// }
aimbot::RunCommand(ucmd);
Angle viewang = ucmd->viewangles;
bool canshoot = weapon && weapon->Clip1() > 0;
#ifdef VORANGEBOX
bool &sendpacket = *((bool *)bp->next->next->next - 1);
#endif
#ifdef VL4D
bool &sendpacket = *((bool *)bp->next->next->next - 0x21);
#endif
#ifdef CSGO
bool &sendpacket = *((bool *)bp->next - 0x1c);
#endif
if (1 && !lp->HasFlag(FL_ONGROUND)) // menu/bhop
ucmd->buttons.del(IN_JUMP);
if (1 && canshoot) // menu.aimbot
{
if (aimbot::Think(ucmd) && 0)
{
// org_SetViewAngles(t, ucmd->viewangles);
}
}
if (1) // menu.norecoil
{
nospread::ApplyRecoil(lp, ucmd->viewangles, -1.0f);
}
if (canshoot && ucmd->buttons.test(IN_ATTACK))
{
//if (1) // menu/nospread
// nospread::ApplySpread(ucmd->command_number, lp, ucmd->viewangles, -1.0f);
if (1 && weapon->GetNextPrimaryFire() > curtime) // menu/autopistol
ucmd->buttons.del(IN_ATTACK);
if (1)
{
if (weapon->GetNextPrimaryFire() > curtime)
{
ucmd->viewangles = viewang;
}
else
{
sendpacket = false;
}
}
if (weapon->GetNextPrimaryFire() <= curtime)
aimbot::Next();
}
Angle move;
VectorAngles(ucmd->move, move);
float velocity = ucmd->move.Length2D();
float sin, cos;
SinCos(Deg2Rad(ucmd->viewangles.y - viewang.y + move.y), sin, cos);
//.........这里部分代码省略.........
示例5: Think
bool aimbot::Think(UserCmd *ucmd)
{
Entity *lp = LocalPlayer();
Entity *t = nullptr;
float best = 3.40282347e+38f;
weaponinfo = lp->GetActiveWeapon()->GetWeaponInfo();
Vector aim, tp, sp = lp->GetShootPos();
AngleVectors(ucmd->viewangles, aim);
BulletFilter bf(lp);
for (int i = 1, ignore = engine->GetLocalPlayer(), players = globals->maxclients();
#ifdef NPCS
i <= ents->GetMaxEntities();
#else
i <= globals->maxclients();
#endif
i++)
{
if (i == ignore)
continue;
if (Entity *pl = ents->GetEntity(i))
{
if (pl->IsDormant())
continue;
if (i > players)
continue;
if (!CheckTarget(lp, pl))
continue;
if (!pl->GetModel())
continue;
if (!pl->SetupBones())
continue;
float rate = RateOf(ucmd, lp, pl, i);
if (rate >= best)
continue;
bf.against(pl);
bool next = false;
int index = 0;
for (int j = pl->Hitboxes() - 1; j >= 0; j--)
{
hitbox *box = pl->GetHitbox(j);
if (box->group == HITGROUP_HEAD)
{
Vector pos = pl->GetBoxPos(box);
if (BulletTrace(sp, pos, &bf))
{
t = pl;
tp = pos;
best = rate;
shot = i;
next = true;
}
index = j;
break;
}
}
if (!next && 1) // menu.aimbot.hitscan
{
for (int j = 0; j < pl->Hitboxes(); j++)
{
if (j == index)
continue;
hitbox *box = pl->GetHitbox(j);
if (box->group && box->group != HITGROUP_HEAD)
{
Vector pos = pl->GetBoxPos(box);
if (BulletTrace(sp, pos, &bf))
{
t = pl;
tp = pos;
best = rate;
shot = i;
break;
}
}
//.........这里部分代码省略.........