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
LukeyB
Member
Join Date: Dec 2011
Old 12-12-2011 , 00:29   How to Block cz bot from putting silencer on?
Reply With Quote #1

Hello,

I am trying to get cz bots to never use a silencer on the USP and possibly sometimes use silencer on m4 and sometimes use burst on glock and famas. Disabling USP silencer on bots is the most importance issue however.

I used ConnorMcLeod's ham_register_cz_bots in thinking that the following script would work for bots, but it doesn't. It only works for humans. If it were possible to only block usp silencer on bots that would be even better.

Here is the script:

#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" )
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_usp" , "Event_BlockSecondaryAttack" , 1 )
RegisterHam( Ham_Item_Deploy , "weapon_usp" , "Event_BlockSecondaryAttack", 1 )
}
public Event_BlockSecondaryAttack ( const Entity )
{
set_pdata_float( Entity , m_flNextSecondaryAttack , 9999.0, 4 )
}
public cz_bot_ham_registerable( id )
{
}

Thanks so much for any assistance.
LukeyB is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-12-2011 , 01:16   Re: How to Block cz bot from putting silencer on?
Reply With Quote #2

Please use php tags to post code (or pawn), it will be kept indented and be more readable.
You don't need the cs_bot_ forward because what you use is called from usp and not bot.

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.
__________________
- tired and retired -

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

I apologize for my ignorance. I am a beginner at this and not quite sure how to put into the script what you are telling me to.
LukeyB is offline
Old 12-12-2011, 07:07
JoKeR LauGh
This message has been deleted by JoKeR LauGh.
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 #5

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 #6

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 #7

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 #8

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 #9

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
pandagurl227
New Member
Join Date: Nov 2011
Old 12-14-2011 , 16:11   Re: How to Block cz bot from putting silencer on?
Reply With Quote #10

hey.. my name is tabitha.. i've been bored lately looking for advice and i didn't realize that the classic chats and forums still existed! i spend a lot of time now on aim chat rooms rambling on about php python n other random stuff :p
pandagurl227 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