I'm trying to make a plugin that improves how bots behave and aim and I've finnally found a way to make them actually spray. The code that I have is mostly code that was done by other people and I'm just trying to adapt it to work with bots.
The problem is when ever there is a smoke the bots will still shoot perfectly through it onto the enemy. How do I check if there is a smoke between the bot and the enemy?
This is the code for the BOT aimbot, if you need anything else I'll provide it.
PHP Code:
if(IsValidClient(client) && IsPlayerAlive(client))
{
char botname[512];
GetClientName(client, botname, sizeof(botname));
for(int i = 0; i <= sizeof(g_BotName) - 1; i++)
{
if(StrEqual(botname, g_BotName[i]))
{
if(index == 9 || index == 40)
{
return Plugin_Continue;
}
float camangle[3], clientEyes[3], targetEyes[3];
GetClientEyePosition(client, clientEyes);
int Ent = Client_GetClosest(clientEyes, client);
float vec[3], angle[3];
if(IsValidClient(Ent))
{
GetClientAbsOrigin(Ent, targetEyes);
GetEntPropVector(Ent, Prop_Data, "m_angRotation", angle);
if(IsWeaponSlotActive(client, CS_SLOT_PRIMARY))
{
if(GetRandomInt(1,5) == 1)
{
targetEyes[2] += 65.5;
}
else
{
targetEyes[2] += 40.5;
}
buttons |= IN_ATTACK;
}
else
{
return Plugin_Continue;
}
MakeVectorFromPoints(targetEyes, clientEyes, vec);
GetVectorAngles(vec, camangle);
camangle[0] *= -1.0;
camangle[1] += 180.0;
ClampAngle(camangle);
float vecPunchAngle[3];
if (GetEngineVersion() == Engine_CSGO || GetEngineVersion() == Engine_CSS)
{
GetEntPropVector(client, Prop_Send, "m_aimPunchAngle", vecPunchAngle);
}
else
{
GetEntPropVector(client, Prop_Send, "m_vecPunchAngle", vecPunchAngle);
}
if(g_cvPredictionConVars[0] != null)
{
camangle[0] -= vecPunchAngle[0] * GetConVarFloat(g_cvPredictionConVars[0]);
camangle[1] -= vecPunchAngle[1] * GetConVarFloat(g_cvPredictionConVars[0]);
}
TeleportEntity(client, NULL_VECTOR, camangle, NULL_VECTOR);
}
if (buttons & IN_ATTACK)
{
if(index == 7 || index == 8 || index == 10 || index == 13 || index == 14 || index == 16 || index == 39 || index == 60 || index == 28)
{
buttons |= IN_DUCK;
return Plugin_Changed;
}
}
}
}
}