Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace triggerbot {
- void Triggerbot(CUserCmd* pCmd) {
- long currentTime_ms = Utils::getEpochTime();
- static long timeStamp = currentTime_ms;
- long oldTimeStamp;
- if (g_LocalPlayer->IsAlive() && g_LocalPlayer->IsAlive() && !(g_LocalPlayer->m_lifeState() & LIFE_DYING))
- {
- Vector src, dst, forward;
- trace_t tr;
- Ray_t ray;
- CTraceFilter filter;
- QAngle viewangle = pCmd->viewangles;
- viewangle += g_LocalPlayer->m_aimPunchAngle() * 2.f;
- Math::AngleVectors2(viewangle, forward);
- forward *= g_LocalPlayer->m_hActiveWeapon()->GetCSWeaponData()->flRange;
- filter.pSkip = g_LocalPlayer;
- src = g_LocalPlayer->GetEyePos();
- dst = src + forward;
- ray.Init(src, dst);
- g_EngineTrace->TraceRay(ray, 0x46004003, &filter, &tr);
- if (!tr.hit_entity)
- return;
- int hitgroup = tr.hitgroup;
- bool didHit = false;
- if ((g_Options.triggerbot_spot == tbHead) && hitgroup == HITGROUP_HEAD)
- didHit = true;
- if ((g_Options.triggerbot_spot == tbChest) && hitgroup == HITGROUP_CHEST)
- didHit = true;
- if ((g_Options.triggerbot_spot == tbStomach) && hitgroup == HITGROUP_STOMACH)
- didHit = true;
- if ((g_Options.triggerbot_spot == tbAll) && hitgroup == HITGROUP_HEAD || hitgroup == HITGROUP_CHEST || hitgroup == HITGROUP_STOMACH || hitgroup == HITGROUP_LEFTARM || hitgroup == HITGROUP_LEFTLEG || hitgroup == HITGROUP_RIGHTARM || hitgroup == HITGROUP_LEFTLEG)
- didHit = true;
- oldTimeStamp = timeStamp;
- timeStamp = currentTime_ms;
- if (didHit && (tr.hit_entity->GetBaseEntity()->m_iTeamNum() != g_LocalPlayer->m_iTeamNum()))
- {
- auto pWeapon = g_LocalPlayer->m_hActiveWeapon();
- if (pWeapon->IsSniper() && !g_LocalPlayer->m_bIsScoped())
- {
- return;
- }
- if (!pWeapon->IsRifle() && !pWeapon->IsPistol() && !pWeapon->IsSniper())
- {
- return;
- }
- if (g_Options.triggerbotkey)
- {
- if (GetAsyncKeyState(g_Options.triggerbotkey) & 0x8000 && g_Options.triggerbotactive && currentTime_ms - oldTimeStamp < g_Options.tbDelay)
- {
- timeStamp = oldTimeStamp;
- pCmd->buttons |= IN_ATTACK;
- }
- }
- else
- {
- pCmd->buttons |= IN_ATTACK;
- }
- timeStamp = currentTime_ms;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement