Raised This Month: $ Target: $400
 0% 

Block smoke / flashbang from smoking / exploding


Post New Thread Reply   
 
Thread Tools Display Modes
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 06-27-2008 , 22:17   Re: Block smoke / flashbang from smoking / exploding
Reply With Quote #11

Alright I did it ;).
Here is my algorytm that blocks all the nades from exploding and forces them to detonate when you press e(+use)

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN    "Block Reaserch"
#define AUTHOR    "OT"
#define VERSION    "1"


new const g_sNadeModels[][] =
{
    
//"models/w_hegrenade.mdl",
    
"models/w_flashbang.mdl",
    
"models/w_smokegrenade.mdl"
};

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_SetModel,"fw_setmodel")
    
register_forward(FM_Think,"fw_think")
}

public 
fw_setmodel(ent,const model[])
{
    if (!
pev_valid(ent))
        return 
FMRES_IGNORED;
    
    new 
0;
    
    for(new 
i=0;i<1;i++)
    {
        if (
equal(g_sNadeModels[i],model))
            
k=1
    
}
    
    if (
k==0)
        return 
FMRES_IGNORED
    
    
new info_id engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString"info_target"))
    
set_pev(info_id,pev_classname,"info_nade")
    
set_pev(info_id,pev_iuser1,ent)
    
set_pev(info_id,pev_owner,pev(ent,pev_owner))
    
set_pev(info_id,pev_nextthink,get_gametime() + 0.01)
    
    
set_pev(ent,pev_nextthink,get_gametime() + 4000)
    
    return 
FMRES_IGNORED;
}

public 
fw_think(ent)
{
    if (!
pev_valid(ent))
        return 
FMRES_IGNORED;
    
    new 
classname[10]
    
pev(ent,pev_classname,classname,9)
    if (!(
equal(classname,"info_nade")))
        return 
FMRES_IGNORED;
    
    new 
owner pev(ent,pev_owner)
    new 
ent_id =  pev(ent,pev_iuser1)
    
    if (
pev(owner,pev_button) & IN_USE && !(pev(owner,pev_oldbuttons) & IN_USE))
    {
        
set_pev(ent_id,pev_nextthink,get_gametime()+0.001)
        
engfunc(EngFunc_RemoveEntity,ent)
        return 
FMRES_IGNORED;
    }
    
    
    
set_pev(ent,pev_nextthink,get_gametime() + 0.01)
    return 
FMRES_IGNORED;

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 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 16:55.


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