View Single Post
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 11-27-2022 , 13:03   Re: Cancel Defuse on hit
Reply With Quote #3

Quote:
Originally Posted by deprale View Post
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
new bool:isDefusing
new defuser

//const m_bIsDefusing    = 929 // (1.8.3+ only) 949 if linux (didn't work in my tests, default hlds with amxx 1.10)

public plugin_init( )
{
    
register_plugin"Stop Def on Dmg""alliedmods""1.0" )
    
RegisterHamHam_TakeDamage"player""fw_TakeDamage" )
    
register_event("BarTime""bomb_defuse_start""be""1=5""1=10")
    
register_event("BarTime""bomb_defuse_stop""b""1=0")
}

public 
bomb_defuse_start(id)
{
    
isDefusing true
    defuser 
id
}

public 
bomb_defuse_stop(id)
{
    
isDefusing false
}

public 
fw_TakeDamagevictiminflictorattackerFloat:damage ){
    if (
is_user_connected(victim) && (victim == defuser && isDefusing) ) {
        
StopDefuser(victim)
    }
}

StopDefuser(const player//Credits https://forums.alliedmods.net/showpost.php?p=2592752&postcount=4
{
    const 
m_bStartDefuse 384                                                    
    
const m_bIsDefusing  929
    
static gmsgBarTime

    
if(!gmsgBarTime)
    {
        
gmsgBarTime get_user_msgid("BarTime")
    }

    if( 
is_user_connected(player) )
        {
            
set_pdata_bool(playerm_bIsDefusingfalse)
            
set_pdata_bool(playerm_bStartDefusefalse)
            
            
message_begin(MSG_ONEgmsgBarTime_player)
            {
                
write_short(0)
                
message_end()
            }
            
            
engclient_cmd(player"lastinv")
            
engclient_cmd(player"lastinv")
        }

Thanks, very kind.

having an error compiling it:

C:\Users\efler\Desktop\addons\amxmodx\scripti ng\custom_def_cancel.sma(1) : fatal error 100: cannot read from file: "á<amxmodx>"

the code is exactly the same , i suspect there is something wrong with my compiler

edit: i dont think there is a problem with my compiler, but im getting this on several code i found browsing the forums.

all my 40 plugins recompile without this issue. anyone know what's up?

i even downloaded amx on another pc , copied your code, tried to compile it and didnt work. so not a problem on my end,
not even with a web compiler, amx studio or a random pawn compiler from github.

what is going on?

Last edited by Ark_Procession; 11-27-2022 at 18:54. Reason: whatisgoingon
Ark_Procession is offline