Raised This Month: $344 Target: $400
 86%   Almost there!

how to make bot aim miss target?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
loki_himself
Member
Join Date: Nov 2021
Old 08-14-2022 , 16:09   how to make bot aim miss target?
Reply With Quote #1

i use yapb bots, and they almost always do headshots altough i set headshot chance to 1%. i already set the damage a bot does to 1%, therefore bots shooting your head like 10 times in a row with obvious aimbot.

how can i either stop a bot from shooting, or make a bullet miss his target? i would basically hook Ham_TraceAttack or something and let a random decide which bullet should pass and which one to supercede. is that possible?
loki_himself is offline
Old 08-15-2022, 10:12
kww
This message has been deleted by kww. Reason: nevermind
bibu
Veteran Member
Join Date: Sep 2010
Old 08-16-2022 , 04:01   Re: how to make bot aim miss target?
Reply With Quote #2

Yes, that should work. I have edited the plugin based upon following code: https://forums.alliedmods.net/showthread.php?t=163585

Try this:

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >

#define IsPlayer(%1) (1<= %1 <= g_iMaxPlayers)
#define MAX_WEAPONS CSW_P90

#define MAX_PLAYERS 32

const bitsNotAllowedWeapons << CSW_SMOKEGRENADE << CSW_HEGRENADE << CSW_FLASHBANG << CSW_C4

new g_iMaxPlayersboolg_bHamRegisteredbool:bIsUserBotMAX_PLAYERS ]

new 
bool:g_weaponMortalHeadshotMAX_WEAPONS ]

public 
plugin_init()
{
    
register_plugin"Bot Headshot Chance""0.1""eXtrem / AMXX Community" )
    
    
register_concmd"bhc_chance""ConsoleCommand_MortalHeadshot"ADMIN_KICK )
    
    
g_iMaxPlayers get_maxplayers()
}

public 
client_putinserver(id)
{
    if(
is_user_bot(id))
        
bIsUserBot[id] = true

    
if(!g_bHamRegistered)
    {
       
g_bHamRegistered true
       RegisterHamFromEntity
Ham_TraceAttackid"HamTraceAttack" )
     }
}

public 
client_disconnected(id)
{
    
bIsUserBot[id] = false
}

public 
HamTraceAttackvictimattackerFloat:damageFloat:tr[3], traceresult/*, dmgbits*/ )
{
    if( !
IsPlayerattacker ) || victim == attacker || !bIsUserBot[attacker] )
        return 
HAM_IGNORED
    
    
if( g_weaponMortalHeadshotget_user_weaponattacker ) ] && get_tr2traceresult TR_iHitgroup ) == HIT_HEAD )
    {
        
set_tr2(traceresultTR_iHitgroupHIT_CHEST)
    }
    
    return 
HAM_IGNORED
}

public 
ConsoleCommand_MortalHeadshotidlevelcid )
{
    if( !
cmd_accessidlevelcid)  ) 
    { 
        return 
PLUGIN_HANDLED
    

    
    new 
szWeapon32 ] = "weapon_"
        
    
read_argv1szWeapon], charsmaxszWeapon ) -)
    
    new 
weaponid get_weaponidszWeapon )
        
    if( 
weaponid && ~( << weaponid ) & bitsNotAllowedWeapons )
    {
        new 
szValue]
        
read_argv2szValuecharsmaxszValue ) )
        
        
g_weaponMortalHeadshotweaponid ] = szValue] == '0' false true            
                
        console_print
id"%s reduced headshot chance: %s"szWeaponszValue] == '0' "disabled" "enabled" )
    }
    
    return 
PLUGIN_HANDLED

You can customize the weapons, which should have the effect. I have renamed the cvar name as you can see. The damage gets divided by 3, you may want to adjust that.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.

Last edited by bibu; 08-17-2022 at 08:16.
bibu is offline
loki_himself
Member
Join Date: Nov 2021
Old 08-17-2022 , 06:49   Re: how to make bot aim miss target?
Reply With Quote #3

thanks. what exactly does this do? because i already lower the damage myself. thats not the problem. i want to REMOVE shots/bullets totally. i want to remove the impact on you the victim when a bot shoots, cause even if you put the damage to 1%, the sound of a hit and the wobble of the hit effects you
loki_himself is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 08-17-2022 , 07:55   Re: how to make bot aim miss target?
Reply With Quote #4

Ok, I have edited the code. It should now redirect a bot's headshot to the chest. You should never receive headshots by this now (not even the sound, since the actual hit gets redirected).
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
loki_himself
Member
Join Date: Nov 2021
Old 08-17-2022 , 11:54   Re: how to make bot aim miss target?
Reply With Quote #5

thanks, will try now. just to understand

Quote:
RegisterHamFromEntity( Ham_TraceAttack, id, "HamTraceAttack" )
this must be called ONCE per map, on any player or does id have to be a bot? and i see g_bHamRegistered is a global singleton, it does not have to be registered per player?

FIRST try gives error: and id 4 is a bot
Quote:
[HAMSANDWICH] Failed to retrieve classtype for entity id "4", hook for "HamTraceAttack" not active.

Last edited by loki_himself; 08-17-2022 at 12:07.
loki_himself is offline
loki_himself
Member
Join Date: Nov 2021
Old 08-17-2022 , 12:33   Re: how to make bot aim miss target?
Reply With Quote #6

ok it works now after registering with a delay set_task(0.1, ...) i copied that from another plugin. if i register on a bot id, will it only work for class bots? or can i also use it for human players?

Quote:
if( !IsPlayer( attacker ) || victim == attacker || !bIsUserBot[attacker] )
->
Quote:
if( !IsPlayer( attacker ) || victim == attacker )
will this work too?
loki_himself is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 08-18-2022 , 03:11   Re: how to make bot aim miss target?
Reply With Quote #7

Good that you could figure it out with the task. I guess it will only work for bots. You should do the following:

1) Make the change you have written
2) Add in plugin_init() following:
RegisterHam(Ham_TraceAttack, "player", "HamTraceAttack")

This way noone will be able to make any headshots.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
loki_himself
Member
Join Date: Nov 2021
Old 08-18-2022 , 04:43   Re: how to make bot aim miss target?
Reply With Quote #8

thank you so much for the help. how about cpu performance? does hooking does stress the server a lot?
loki_himself is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 08-18-2022 , 04:58   Re: how to make bot aim miss target?
Reply With Quote #9

Glad I could be helpful. Shouldn't effect the performance much. It's safe to use.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Reply


Thread Tools
Display Modes

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 01:36.


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