Raised This Month: $51 Target: $400
 12% 

Block HE explode after death!


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 02-06-2011 , 10:02   Block HE explode after death!
Reply With Quote #1

Plugin features:

If a player is dead, and in his hand grenade was left with a cotter plucked - it will not explode after death. It simply disappears =).

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

#define PLUGIN "Anti HE explode on death"
#define VERSION "1.0"
#define AUTHOR "HoLLyWooD"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_SetModel,"fw_SetModel")
}

public 
fw_SetModel(ent,const model[]){
    
//Check ent validity
    
if(!pev_valid(ent))
        return 
FMRES_IGNORED;
    
    
//If model is equal to HE model
    
if(!equali(model,"models/w_hegrenade.mdl"))
        return 
FMRES_IGNORED;
        
    
//get owner
    
new owner pev(ent,pev_owner)
    if(
is_user_connected(owner) && !is_user_alive(owner)){
        
set_pev(entpev_flagspev(entpev_flags) | FL_KILLME
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;

Attached Files
File Type: sma Get Plugin or Get Source (no_death_exlpode.sma - 678 views - 901 Bytes)
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ

Last edited by HoLLyWooD; 02-13-2011 at 01:53.
HoLLyWooD is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 02-06-2011 , 10:12   Re: Block HE explode after death!
Reply With Quote #2

You don't have to check if the user is connected.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 02-06-2011 , 11:23   Re: Block HE explode after death!
Reply With Quote #3

Quote:
Originally Posted by drekes View Post
You don't have to check if the user is connected.
if(is_user_connected(owner) && !is_user_alive(owner)){
engfunc( EngFunc_RemoveEntity, ent);
return FMRES_SUPERCEDE;
}
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 02-06-2011 , 12:09   Re: Block HE explode after death!
Reply With Quote #4

I mean it isn't necessary to check if the owner is connected.
And you don't have to include engine and amxmisc
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 02-06-2011 , 13:29   Re: Block HE explode after death!
Reply With Quote #5

Without this test, the player will not even buy a hand grenade.
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 02-06-2011 , 13:33   Re: Block HE explode after death!
Reply With Quote #6

You clearly don't know what you are doing. Did you even test this before posting?

Unapproved.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 02-06-2011 , 13:46   Re: Block HE explode after death!
Reply With Quote #7

I'm tested. works like a clock. When a player dies and in his hand grenade with the pulled cotter - then it disappears. All as needed.
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-06-2011 , 14:05   Re: Block HE explode after death!
Reply With Quote #8

Quote:
Originally Posted by HoLLyWooD View Post
if(is_user_connected(owner) && !is_user_alive(owner)){
engfunc( EngFunc_RemoveEntity, ent);
return FMRES_SUPERCEDE;
}
Also the way you remove the entity is wrong...
Change
PHP Code:
engfuncEngFunc_RemoveEntityent); 
To
PHP Code:
set_pev(entpev_flagspev(entpev_flags) | FL_KILLME
Why is it wrong?
Well the first thing does work but will not make the forward FM_RemoveEntity execute while the second one will.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 02-13-2011 , 01:51   Re: Block HE explode after death!
Reply With Quote #9

Sorry guys.

The previous version also worked without error. Thank you for having suggested the best way =) Updated the first post.
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD 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 18:57.


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