Raised This Month: $ Target: $400
 0% 

Stop defusing instantly?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-19-2018 , 05:29   Re: Stop defusing instantly?
Reply With Quote #5

Here is a stock that does what you want:
PHP Code:
StopDefuser()
{
    const 
m_pBombDefuser 388
    
const m_bIsC4        385
    
const m_bJustBlew    432
    
const m_bStartDefuse 384                                                    
    
const m_bIsDefusing  929
    
const m_flDefuseCountDown 99

    
static gmsgBarTime
    
if(!gmsgBarTime)
    {
        
gmsgBarTime get_user_msgid("BarTime")
    }
    
    new 
GrenadeEntity FM_NULLENT
    
while((GrenadeEntity engfunc(EngFunc_FindEntityByStringGrenadeEntity"classname""grenade")))
    {
        if(
pev_valid(GrenadeEntity) && get_pdata_bool(GrenadeEntitym_bIsC4))
        {
            if(!
get_pdata_bool(GrenadeEntitym_bJustBlew))
            {
                new 
DefuserIndex
                
if(is_user_connected((DefuserIndex get_pdata_ent(GrenadeEntitym_pBombDefuser))))
                {
                    
set_pdata_bool(DefuserIndexm_bIsDefusingfalse)
                    
set_pdata_bool(DefuserIndexm_bStartDefusefalse)
                    
                    
message_begin(MSG_ONEgmsgBarTime_DefuserIndex)
                    {
                        
write_short(0)
                        
message_end()
                    }
                    
                    
engclient_cmd(DefuserIndex"lastinv")
                    
engclient_cmd(DefuserIndex"lastinv")
                }
            }
        }
    }

For amxx < 183 you also need this function in order to get it working:
PHP Code:
#if AMXX_VERSION_NUM < 183
    
const INT_BYTES 
    
const BYTE_BITS 

    stock bool
:get_pdata_bool(entcharbased_offsetintbase_linuxdiff 5
    { 
        return !!(
get_pdata_int(entcharbased_offset INT_BYTESintbase_linuxdiff) & (0xFF<<((charbased_offset INT_BYTES) * BYTE_BITS))) 
    } 

    
stock set_pdata_bool(entcharbased_offset_:valueintbase_linuxdiff 5)
    {
        
value &= 0xFF 
        
new int_offset_value get_pdata_int(entcharbased_offset INT_BYTESintbase_linuxdiff
        new 
bit_decal = (charbased_offset INT_BYTES) * BYTE_BITS 
        int_offset_value 
&= ~(0xFF<<bit_decal// clear byte 
        
int_offset_value |= value<<bit_decal 
        set_pdata_int
(entcharbased_offset INT_BYTESint_offset_valueintbase_linuxdiff
    }
#endif 
Just call StopDefuser() and it will automatically check if there's a player defusing and stop him.

Spoiler
__________________

Last edited by HamletEagle; 05-19-2018 at 05:30.
HamletEagle is offline
 



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 04:39.


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