AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cancel defuse event? (https://forums.alliedmods.net/showthread.php?t=309180)

sekac 07-16-2018 11:44

Cancel defuse event?
 
I tried this: register_event("BarTime", "event_function", "b", "1=0"), but it's only triggered when you stop planting the bomb.

HamletEagle 07-16-2018 13:17

Re: Cancel defuse event?
 
You want to cancel defuse or hook when that happens?

sekac 07-17-2018 05:22

Re: Cancel defuse event?
 
Hook when it happens.

HamletEagle 07-17-2018 09:19

Re: Cancel defuse event?
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const m_bIsC4             385
const m_bStartDefuse      384
const m_pBombDefuser      388
const m_fNextDefuse       107
const m_flDefuseCountDown 99

#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))) 
    } 
#endif

public plugin_init()
{
    
RegisterHam(Ham_Think"grenade""CGrenade_Think"false)
}

public 
CGrenade_Think(const GrenadeEntity)
{
    if(
pev_valid(GrenadeEntity) && get_pdata_bool(GrenadeEntitym_bIsC4))
    {
        if(
get_pdata_bool(GrenadeEntitym_bStartDefuse))
        {
            new 
DefuserIndex get_pdata_ent(GrenadeEntitym_pBombDefuser)
            if(
is_user_connected(DefuserIndex))
            {
                new 
Float:GameTime get_gametime()
                if(
GameTime get_pdata_float(GrenadeEntitym_flDefuseCountDown))
                {
                    new 
OnGround pev(DefuserIndexpev_flags) & FL_ONGROUND
                    
if(GameTime >  get_pdata_float(GrenadeEntitym_fNextDefuse) || !OnGrounde)
                    {
                        
client_print(0print_chat"%d stopped defusing"DefuserIndex)
                                                
//add your code here
                    
}
                }
            }
        }
    }



sekac 07-17-2018 09:42

Re: Cancel defuse event?
 
Thank you!

Natsheh 07-17-2018 10:13

Re: Cancel defuse event?
 
Ham can you demonstrate how the stock get_pdata_bool with numbers.

HamletEagle 07-17-2018 10:17

Re: Cancel defuse event?
 
Quote:

Originally Posted by Natsheh (Post 2604252)
Ham can you demonstrate how the stock get_pdata_bool with numbers.

What do you mean?


All times are GMT -4. The time now is 12:14.

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