Raised This Month: $ Target: $400
 0% 

Stop defusing instantly?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sekac
Senior Member
Join Date: Nov 2016
Old 05-11-2018 , 17:49   Stop defusing instantly?
Reply With Quote #1

Is there a way to stop defusing instantly? I don't won't to prevent defusing, just stop it. With -use the defuse continues for one second and then stops... So maybe we can do something like removing the c4 and spawning it again? Any instant methods out there?
sekac is offline
sekac
Senior Member
Join Date: Nov 2016
Old 05-16-2018 , 13:57   Re: Stop defusing instantly?
Reply With Quote #2

Ok so I have found out that if you jump you stop defusing instantly. Is there a specific event that cancels defusing like that? Or is there a way to trick the server that the client jumped?
sekac is offline
666
Senior Member
Join Date: Mar 2015
Old 05-18-2018 , 09:50   Re: Stop defusing instantly?
Reply With Quote #3

Quote:
Originally Posted by sekac View Post
Ok so I have found out that if you jump you stop defusing instantly. Is there a specific event that cancels defusing like that? Or is there a way to trick the server that the client jumped?
Maybe this can help: https://forums.alliedmods.net/showthread.php?t=171831
666 is offline
sekac
Senior Member
Join Date: Nov 2016
Old 05-19-2018 , 08:24   Re: Stop defusing instantly?
Reply With Quote #4

Quote:
Originally Posted by 666 View Post
Hmm.... That actually removes that weird delay after stopping the defuse. I also like the other changes.
sekac is offline
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
sekac
Senior Member
Join Date: Nov 2016
Old 05-19-2018 , 08:16   Re: Stop defusing instantly?
Reply With Quote #6

Thank you so much. I'm trying to stop the defusing bar from showing for an extra second when you release 'E'.

I tried this, but it didn't work:

PHP Code:
register_event("BarTime""event_DefusingCanceled""b""1=0")
.
.
.
public 
event_DefusingCanceled() StopDefuser() 
Also:
PHP Code:
WarningSymbol is never used"m_flDefuseCountDown" 
sekac is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-19-2018 , 12:47   Re: Stop defusing instantly?
Reply With Quote #7

Quote:
Originally Posted by sekac View Post
Thank you so much. I'm trying to stop the defusing bar from showing for an extra second when you release 'E'.

I tried this, but it didn't work:

PHP Code:
register_event("BarTime""event_DefusingCanceled""b""1=0")
.
.
.
public 
event_DefusingCanceled() StopDefuser() 
Also:
PHP Code:
WarningSymbol is never used"m_flDefuseCountDown" 
I do not understand. If someone is defusing and you use the stock I gave you it will instantly stop the defuser(and the bar).
Can you properly explain when you want to stop the defuse?
__________________

Last edited by HamletEagle; 05-19-2018 at 12:48.
HamletEagle is offline
sekac
Senior Member
Join Date: Nov 2016
Old 05-19-2018 , 12:57   Re: Stop defusing instantly?
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
I do not understand. If someone is defusing and you use the stock I gave you it will instantly stop the defuser(and the bar).
Can you properly explain when you want to stop the defuse?
I want to call this function when a player stops defusing so it doesn't leave the bar showing for an extra second after he stops defusing.
sekac 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 04:39.


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