Raised This Month: $ Target: $400
 0% 

Get cz bots to stop when shooting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-16-2011 , 13:59   Re: Get cz bots to stop when shooting
Reply With Quote #1

set_pev( index , pev_velocity , value )
__________________
You can do anything you set your mind to, man.

Devil259 is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-16-2011 , 15:25   Re: Get cz bots to stop when shooting
Reply With Quote #2

This seems to almost work. They don't stop completely before shooting so they still shoot as if they were moving and it's innacurrate. Any ideas? Here is what I am using:

PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < fun >
#include < fakemeta >
const m_pPlayer 41;
public 
plugin_init( )
{
    new 
WeaponName32 ];
    
// no knifes, nades or c4
    
new NoPrimaryAttack = ( ( << CSW_KNIFE ) | ( << CSW_HEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_C4 ) ); 
    for( new 
CSWConstant CSW_P228CSWConstant <= CSW_P90CSWConstant++ ) 
    {
        if( ~
NoPrimaryAttack & ( << CSWConstant // check for invalid CSW_* constants
        
&& get_weaponnameCSWConstantWeaponNamecharsmaxWeaponName ) ) ) // get weaponname
        
{
            
RegisterHamHam_Weapon_PrimaryAttackWeaponName"Ham_Weapon_PrimaryAttack_Pre"); // hook pre
            
RegisterHamHam_Weapon_PrimaryAttackWeaponName"Ham_Weapon_PrimaryAttack_Post"); // hook post
        
}
    }
}
public 
Ham_Weapon_PrimaryAttack_PreWeapon 
{
    new 
id get_pdata_cbaseWeaponm_pPlayer); 
    
    if( 
is_user_botid ) )
        
set_pevid pev_velocity // set low speed
}
public 
Ham_Weapon_PrimaryAttack_PostWeapon 
{
    new 
id get_pdata_cbaseWeaponm_pPlayer); 
    
    if( 
is_user_botid ) )
        
set_pevid pev_velocity 3500 )  // reset speed

LukeyB is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-16-2011 , 16:06   Re: Get cz bots to stop when shooting
Reply With Quote #3

velocity is a float.

edit : default speed is 250.
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 12-16-2011 at 16:06.
Devil259 is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-16-2011 , 16:25   Re: Get cz bots to stop when shooting
Reply With Quote #4

Thanks. This has been corrected. They still can move when shooting. I would like their first bullet to be 100% accurate as if they were standing still so they would need to stop just before they shoot, then would be completely stopped and wouldn't move again until they stop shooting. Also, if they are in the air when they shoot, they freeze in the air briefly.
LukeyB is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-22-2011 , 01:36   Re: Get cz bots to stop when shooting
Reply With Quote #5

How do you get the bots to not freeze in mid air if they fire when they are falling or jumping? I tried using IN_JUMP and FL_ONGROUND and was unsuccessful. Please help.
LukeyB is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-22-2011 , 18:14   Re: Get cz bots to stop when shooting
Reply With Quote #6

What is wrong with this?

PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < engine >
#include < fun >
#include < fakemeta >
const m_pPlayer 41;
#define FL_ONGROUND  (1<<9)
public plugin_init( )
{
    new 
WeaponName32 ];
    
// no knifes, deagle, nades or c4
    
new NoPrimaryAttack = ( ( << CSW_KNIFE ) | ( << CSW_DEAGLE ) | ( << CSW_HEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_C4 ) ); 
    for( new 
CSWConstant CSW_P228CSWConstant <= CSW_P90CSWConstant++ ) 
    {
        if( ~
NoPrimaryAttack & ( << CSWConstant // check for invalid CSW_* constants
        
&& get_weaponnameCSWConstantWeaponNamecharsmaxWeaponName ))) // get weaponname
        
{
            
RegisterHamHam_Weapon_PrimaryAttackWeaponName"Ham_Weapon_PrimaryAttack_Pre"); // hook pre
            
RegisterHamHam_Weapon_PrimaryAttackWeaponName"Ham_Weapon_PrimaryAttack_Post"); // hook post
        
}
    }
}
public 
Ham_Weapon_PrimaryAttack_PreWeapon 
{
    new 
id get_pdata_cbaseWeaponm_pPlayer);
    if( 
is_user_botid ) && pev(idpev_flags) & FL_ONGROUND)
        
set_pevid pev_velocity // set low speed
}
public 
Ham_Weapon_PrimaryAttack_PostWeapon 
{
    new 
id get_pdata_cbaseWeaponm_pPlayer); 
    
    if( 
is_user_botid ) && ~pev(idpev_flags) & FL_ONGROUND)
        
set_pevid pev_velocity 250 )  // reset speed

LukeyB is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-22-2011 , 23:20   Re: Get cz bots to stop when shooting
Reply With Quote #7

Took me long enough, but I figured it out. Let me know if there is a better way...

PHP Code:
#include < amxmodx >
#include < hamsandwich >
#include < fun >
#include < fakemeta >
const m_pPlayer 41;
public 
plugin_init( )
{
    new 
WeaponName32 ];
    
// no knifes, deagle, nades or c4
    
new NoPrimaryAttack = ( ( << CSW_GLOCK18 ) | ( << CSW_KNIFE ) | ( << CSW_DEAGLE ) | ( << CSW_HEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_C4 ) ); 
    for( new 
CSWConstant CSW_P228CSWConstant <= CSW_P90CSWConstant++ ) 
    {
        if( ~
NoPrimaryAttack & ( << CSWConstant // check for invalid CSW_* constants
        
&& get_weaponnameCSWConstantWeaponNamecharsmaxWeaponName ))) // get weaponname
        
{
            
RegisterHamHam_Weapon_PrimaryAttackWeaponName"Ham_Weapon_PrimaryAttack_Pre"); // hook pre
            
RegisterHamHam_Weapon_PrimaryAttackWeaponName"Ham_Weapon_PrimaryAttack_Post"); // hook post
        
}
    }
}
public 
Ham_Weapon_PrimaryAttack_PreWeapon 
{
    new 
id get_pdata_cbaseWeaponm_pPlayer);
    if( 
is_user_botid ) && pev(idpev_flags) & ~IN_JUMP FL_ONGROUND)
        
set_pevid pev_velocity // set low speed
}
public 
Ham_Weapon_PrimaryAttack_PostWeapon 
{
    new 
id get_pdata_cbaseWeaponm_pPlayer); 
    
    if( 
is_user_botid ) && ~pev(idpev_flags) & IN_JUMP FL_ONGROUND)
        
set_pevid pev_velocity 250 )  // reset speed

LukeyB 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 12:04.


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