AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stop defusing instantly? (https://forums.alliedmods.net/showthread.php?t=307474)

sekac 05-11-2018 17:49

Stop defusing instantly?
 
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 05-16-2018 13:57

Re: Stop defusing instantly?
 
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?

666 05-18-2018 09:50

Re: Stop defusing instantly?
 
Quote:

Originally Posted by sekac (Post 2592456)
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

HamletEagle 05-19-2018 05:29

Re: Stop defusing instantly?
 
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

sekac 05-19-2018 08:16

Re: Stop defusing instantly?
 
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 05-19-2018 08:24

Re: Stop defusing instantly?
 
Quote:

Originally Posted by 666 (Post 2592667)

Hmm.... That actually removes that weird delay after stopping the defuse. I also like the other changes.

HamletEagle 05-19-2018 12:47

Re: Stop defusing instantly?
 
Quote:

Originally Posted by sekac (Post 2592762)
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?

sekac 05-19-2018 12:57

Re: Stop defusing instantly?
 
Quote:

Originally Posted by HamletEagle (Post 2592784)
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.


All times are GMT -4. The time now is 04:39.

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