AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block HE nade explosion (https://forums.alliedmods.net/showthread.php?t=133533)

Javivi 07-26-2010 11:35

Block HE nade explosion
 
How I can block the HE nade explosion ? I want just throw it and instead of explode, make it disappear.

Arkshine 07-26-2010 12:05

Re: Block HE nade explosion
 
Already asked, already answered..

Javivi 07-26-2010 12:12

Re: Block HE nade explosion
 
Quote:

Originally Posted by Arkshine (Post 1252084)
Already asked, already answered..

Google doesn't find anything :P

Leon M. 07-27-2010 02:15

Re: Block HE nade explosion
 
PHP Code:

/* ==  ==  ==  ==  ==  ==  ==  ==     Change the font to "Times New Roman" with a size of 10 for a good readability     ==  ==  ==  ==  ==  ==  == */

#define PLUGIN     "Block HE Explosion"
#define AUTHOR     "Leon McVeran"
#define VERSION     "beta"

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

public plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_forward(FM_Think"fwd_think")
}

public 
fwd_think(iEntity){
    if (!
pev_valid(iEntity)){
        return 
FMRES_IGNORED
    
}

    new 
szModel[25]
    
pev(iEntitypev_modelszModel24)
    if (
equali(szModel"models/w_hegrenade.mdl")){
        new 
Float:fDmgTime
        pev
(iEntitypev_dmgtimefDmgTime)

        if (
fDmgTime <= get_gametime() && fDmgTime != 0.0){
            
func_nade_explode(iEntity)
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

public 
func_nade_explode(iEntity){
    if (!
pev_valid(iEntity)){
        return
    }

    
// Your replacement for the explosion
    // ...



DaxProxy 07-28-2010 07:56

Re: Block HE nade explosion
 
Can't this be done without fw_think? Because this simply eats cpu.

Gadzislaw007 07-28-2010 09:42

Re: Block HE nade explosion
 
You can always make new entity with granade model while attacking with granade.

Leon M. 07-29-2010 02:44

Re: Block HE nade explosion
 
Ofcourse, that need a little bit more CPU, but this should not the problem. Trust me!

But you could also use the engine.

PHP Code:

register_forward(FM_Think"fwd_think"

:arrow:
PHP Code:

register_think("grenade","fwd_think"


Javivi 07-30-2010 10:23

Re: Block HE nade explosion
 
Um, its not working... when i try to throw a nade... SVC_BAD

PHP Code:

public fw_NadeThink(iEntity)
{
    if (!
pev_valid(iEntity))
    {
        return 
FMRES_IGNORED
    
}

    new 
szModel[25]
    
pev(iEntitypev_modelszModel24)

    if (
equali(szModel"models/w_hegrenade.mdl"))
    {
        new 
Float:fDmgTime
        pev
(iEntitypev_dmgtimefDmgTime)

        if (
fDmgTime <= get_gametime() && fDmgTime != 0.0)
        {
            
client_print0print_chat"HI" )
            
//func_nade_explode(iEntity)
            
return FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED



master4life 07-30-2010 10:47

Re: Block HE nade explosion
 
Try this

PHP Code:

register_forwardFM_SetModel"FwdSetModel");

[...]

public 
FwdSetModel( const iEntity, const szModel[ ] ) {
    if( !
pev_validiEntity ) || !( <= id <= g_iMaxPlayers ) ) 
        return 
FMRES_IGNORED;    
    
    if( 
equalszModel"models/w_hegrenade.mdl" 
    || 
equalszModel"models/w_flashgrenade.mdl" 
    || 
equalszModel"models/w_smokegrenade.mdl" ) )        
            
entity_set_floatiEntityEV_FL_dmgtime9999.0 );

    return 
FMRES_IGNORED;



Leon M. 07-31-2010 02:01

Re: Block HE nade explosion
 
Quote:

Originally Posted by Javivi (Post 1256120)
Um, its not working... when i try to throw a nade... SVC_BAD

Ok, then try using fakemeta instead of engine. I'm using this since 1 1/2 years. Just fine!


All times are GMT -4. The time now is 00:10.

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