-
Автор темы
- #1
Да тебя взята из всем известного форума)
C++:
for (int i = 1; i <= g_pEngine->GetMaxClients(); ++i)
{
// Bla bla bla validity checks.
C_BaseEntity* pEntity = g_pEntityList->GetClientEntity(i);
if (!pEntity
|| !pEntity->IsAlive()
|| pEntity->IsDormant())
continue;
if (pEntity == g::pLocalEntity)
continue;
C_BaseEntity* GroundEntity = (C_BaseEntity*)g_pEntityList->GetClientEntityFromHandle(g::pLocalEntity->m_hGroundEntity());
// Check if there's a player under us.
if (GroundEntity && GroundEntity == pEntity)
{
// Get the target's speed.
const Vector Velocity = pEntity->m_vecVelocity();
const auto Speed = Velocity.Length2D();
if (Speed > 0.0f)
{
// Get the angles direction based on the target's speed.
Vector Direction;
g_Math.VectorAngles(Velocity, Direction);
Vector ViewAngles;
g_pEngine->GetViewAngles(ViewAngles);
// Cut down on our viewangles.
Direction.y = ViewAngles.y - Direction.y;
// Transform into vector again.
Vector Forward;
g_Math.AngleVectors(Direction, &Forward);
// Calculate the new direction based on the target's speed.
Vector NewDirection = Forward * Speed;
// Move accordingly.
g::pCmd->forwardmove = NewDirection.x;
g::pCmd->sidemove = NewDirection.y;
}
}
}
Код:
[DT_BasePlayer]
m_hGroundEntity = 0x150