Raised This Month: $ Target: $400
 0% 

How to Block cz bot from putting silencer on?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 12-12-2011 , 08:34   Re: How to Block cz bot from putting silencer on?
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
const m_flNextSecondaryAttack 47
public plugin_init() 
{
register_plugin"Block USP Secondary Attack""1.0""Amxx Community" )
RegisterHamHam_Weapon_PrimaryAttack"weapon_usp" "Event_BlockSecondaryAttack" )
RegisterHamHam_Item_Deploy "weapon_usp" "Event_BlockSecondaryAttack")
}
public 
Event_BlockSecondaryAttack ( const Entity )
{
set_pdata_floatEntity m_flNextSecondaryAttack 9999.0)
}
public 
cz_bot_ham_registerableid 


Use
__________________
kramesa is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-12-2011 , 23:09   Re: How to Block cz bot from putting silencer on?
Reply With Quote #2

Sorry. I meant I didn't know how to do the following to get the script to work:

Register the Secondary Attack forward as pre and not post, let the Deploy one post.
In the forwards callback, retrieve player index using get_pdata_cbase + m_pPlayer offset, check if this player is a bot, then set m_flNextSecondaryAttack.

Thanks.
LukeyB is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-13-2011 , 12:15   Re: How to Block cz bot from putting silencer on?
Reply With Quote #3

Try this :

Code involved : https://github.com/Arkshine/CSSDK/bl...ls/wpn_usp.cpp

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

const XO_WEAPON 4

const m_pPlayer 41
const m_flNextSecondaryAttack 47

public plugin_init()
{
    
register_plugin"Block USP Secondary Attack""1.0""Amxx Community" )
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_usp" "CUSP_SecondaryAttack_Pre" ,  0)
    
RegisterHamHam_Item_Deploy "weapon_usp" "CUSP_Deploy_Post"1)
}

public 
CUSP_Deploy_PostiUsp )
{
    new 
id get_pdata_cbase(iUspm_pPlayerXO_WEAPON)
    if( 
id && is_user_alive(id) && is_user_bot(id) && !cs_get_user_shield(id) )
    {
        
cs_set_weapon_silen(iUsp0)
        
set_pdata_float(iUsp m_flNextSecondaryAttack 9999.0XO_WEAPON)
    }
}

public 
CUSP_SecondaryAttack_PreiUsp )
{
    new 
id get_pdata_cbase(iUspm_pPlayerXO_WEAPON)
    if( 
id && is_user_alive(id) && is_user_bot(id) && !cs_get_user_shield(id) )
    {
        
cs_set_weapon_silen(iUsp0)
        
set_pdata_float(iUsp m_flNextSecondaryAttack 9999.0XO_WEAPON)
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-13-2011 , 16:59   Re: How to Block cz bot from putting silencer on?
Reply With Quote #4

This works great. You are amazing! I tried using this code to force the bots to set the famas to burst, but it freezes. Any ideas?

PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <fakemeta> 
#include <hamsandwich> 
const XO_WEAPON 
const m_pPlayer 41 
const m_flNextSecondaryAttack 47 
public plugin_init() 

register_plugin"Force Famas Secondary Burst""1.0""Amxx Community" 
RegisterHamHam_Weapon_SecondaryAttack"weapon_famas" "Cfamas_SecondaryAttack_Pre" 0
RegisterHamHam_Item_Deploy "weapon_famas" "Cfamas_Deploy_Post"1

public 
Cfamas_Deploy_Postifamas 

new 
id get_pdata_cbase(ifamasm_pPlayerXO_WEAPON
if( 
id && is_user_alive(id) && is_user_bot(id) && !cs_get_user_shield(id) ) 

cs_set_weapon_burst(ifamas1
set_pdata_float(ifamas m_flNextSecondaryAttack 9999.0XO_WEAPON


public 
Cfamas_SecondaryAttack_Preifamas 

new 
id get_pdata_cbase(ifamasm_pPlayerXO_WEAPON
if( 
id && is_user_alive(id) && is_user_bot(id) && !cs_get_user_shield(id) ) 

cs_set_weapon_burst(ifamas1
set_pdata_float(ifamas m_flNextSecondaryAttack 9999.0XO_WEAPON
return 
HAM_SUPERCEDE 

return 
HAM_IGNORED 

Thanks again for all your help!
LukeyB is offline
LukeyB
Member
Join Date: Dec 2011
Old 12-13-2011 , 17:26   Re: How to Block cz bot from putting silencer on?
Reply With Quote #5

Also, Not sure if this is possible, but maybe there is a way to force bots to switch to burst when they are a certain distance from the enemy. long distance burst for famas/short distance no burst and short distance burst for glock/long distance no burst?
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 11:58.


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