Raised This Month: $ Target: $400
 0% 

how to stop grenades damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 07-16-2012 , 08:41   how to stop grenades damage
Reply With Quote #1

PHP Code:
public hook_TakeDamage(victimattackeruselessFloat:damagedamagebits) {
 
     if(!
is_user_connected(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED
    
    
static classname[8]
    
pev(uselesspev_classnameclassnamecharsmax(classname))
    
    if(
g_iTimeLeft 0)
    {
        if((
equal(classname"grenade")))
        {
            return 
HAM_SUPERCEDE
        
}
    }
    return 
HAM_IGNORED

This one doesnt work. If i put (1<<24) its not working too. http://forums.alliedmods.net/showpos...8&postcount=71
Quote:
// For grenade damage (In CS) the bits is equal to (1<<24)
GhostMan is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-16-2012 , 09:01   Re: how to stop grenades damage
Reply With Quote #2

PHP Code:
public hook_TakeDamage(victimattackeruseless 
It should be:

victim, useless, attacker

Else, your is_user_connected check fails and that's why damagebits check (and the whole function) doesn't work.
__________________
<VeCo> is offline
GhostMan
Senior Member
Join Date: Jun 2012
Old 07-16-2012 , 10:01   Re: how to stop grenades damage
Reply With Quote #3

Quote:
Originally Posted by <VeCo> View Post
Else, your is_user_connected check fails and that's why damagebits check (and the whole function) doesn't work.
Actually the damage from bullets or knife is stopped, but anyways, you mean i should completely remove this part?
PHP Code:
if(!is_user_connected(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED 

Last edited by GhostMan; 07-16-2012 at 10:01.
GhostMan is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-16-2012 , 10:44   Re: how to stop grenades damage
Reply With Quote #4

I mean to reorder the parameters. You have changed the position of attacker and useless.

But actually, is_user_connected(victim) isn't needed - the victim is always a connected player.
__________________
<VeCo> is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 07-16-2012 , 11:31   Re: how to stop grenades damage
Reply With Quote #5

Code:
is_user_connected( );

->


Code:
is_user_alive( );

I think it's better.
__________________
Pawn ? Useless

Last edited by Aooka; 07-16-2012 at 11:32.
Aooka is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 07-16-2012 , 11:36   Re: how to stop grenades damage
Reply With Quote #6

No , is_user_connected is fine .
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
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 15:18.


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