Raised This Month: $51 Target: $400
 12% 

Solved [CS:GO] Check if there is a smoke in the line of sight


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
manicogaming
AlliedModders Donor
Join Date: Aug 2014
Old 12-22-2019 , 10:25   [CS:GO] Check if there is a smoke in the line of sight
Reply With Quote #1

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(clientbotnamesizeof(botname));
    
    for(
int i 0<= sizeof(g_BotName) - 1i++)
    {
        if(
StrEqual(botnameg_BotName[i]))
        {
            if(
index == || index == 40)
            {
                return 
Plugin_Continue;
            }
            
            
float camangle[3], clientEyes[3], targetEyes[3];
            
GetClientEyePosition(clientclientEyes);
            
int Ent Client_GetClosest(clientEyesclient);
            
            
float vec[3], angle[3];
            
            if(
IsValidClient(Ent))
            {
                
GetClientAbsOrigin(EnttargetEyes);
                
GetEntPropVector(EntProp_Data"m_angRotation"angle);
                if(
IsWeaponSlotActive(clientCS_SLOT_PRIMARY))
                {
                    if(
GetRandomInt(1,5) == 1)
                    {
                        
targetEyes[2] += 65.5;
                    }
                    else
                    {
                        
targetEyes[2] += 40.5;
                    }
                    
buttons |= IN_ATTACK;
                }
                else
                {
                    return 
Plugin_Continue;
                }
                
MakeVectorFromPoints(targetEyesclientEyesvec);
                
GetVectorAngles(veccamangle);
                
camangle[0] *= -1.0;
                
camangle[1] += 180.0;
                
ClampAngle(camangle);
                
float vecPunchAngle[3];
    
                if (
GetEngineVersion() == Engine_CSGO || GetEngineVersion() == Engine_CSS)
                {
                    
GetEntPropVector(clientProp_Send"m_aimPunchAngle"vecPunchAngle);
                }
                else
                {
                    
GetEntPropVector(clientProp_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(clientNULL_VECTORcamangleNULL_VECTOR);
            }
            
            if (
buttons IN_ATTACK)
            {
                if(
index == || index == || index == 10 || index == 13 || index == 14 || index == 16 || index == 39 || index == 60 || index == 28)
                {
                    
buttons |= IN_DUCK;
                    return 
Plugin_Changed;
                }
            }
        }
    }


Last edited by manicogaming; 12-24-2019 at 21:40. Reason: I solved it on my own.
manicogaming is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode