Raised This Month: $32 Target: $400
 8% 

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

...

Last edited by loki_himself; 11-23-2022 at 12:12.
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

...

Last edited by loki_himself; 11-23-2022 at 13:15.
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

...

Last edited by loki_himself; 11-23-2022 at 13:15.
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

...

Last edited by loki_himself; 11-23-2022 at 13:16.
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

...

Last edited by loki_himself; 11-23-2022 at 13:15.
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 20:04.


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