Raised This Month: $ Target: $400
 0% 

Fall Damage on event_damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-07-2012 , 10:11   Fall Damage on event_damage
Reply With Quote #1

I'm trying to cut out execution if fall damage happened to the client with the following code. But it never catches the fall damage. I've tried a number of ways including get_param(3) & DMG_FALL but nothing works. Am i making a mistake or does event_damage really not work like that?

PHP Code:
        register_event("Damage""Event_Damage""be""2!0")

public 
Event_Damage(victimID)
{
    if(!
is_user_alive(victimID) || !is_user_connected(victimID)) 
        return 
PLUGIN_CONTINUE
        
    
new attackerID get_user_attacker(victimID)
    
    if(!(
attackerID <= g_maxPlayers && attackerID == victimID
        || 
get_param(3) & DMG_FALL 
        
|| !is_user_alive(attackerID
        || 
get_user_weapon(attackerID) != CSW_KNIFE 
        
|| hasBrass(attackerID) == 0)
        return 
PLUGIN_CONTINUE
// more code 
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-07-2012 , 10:16   Re: Fall Damage on event_damage
Reply With Quote #2

return PLUGIN_HANDLED to block?
jimaway is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2012 , 10:29   Re: Fall Damage on event_damage
Reply With Quote #3

More simple to hook Ham_TakeDamage, and checking DMG_FALL.
__________________
Arkshine is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-07-2012 , 11:14   Re: Fall Damage on event_damage
Reply With Quote #4

Quote:
Originally Posted by jimaway View Post
return PLUGIN_HANDLED to block?
No because doing that might mess with other things within the core and other plugins. And i'm not trying to block the damage. Just not execute my code on fall damage.

Quote:
Originally Posted by Arkshine View Post
More simple to hook Ham_TakeDamage, and checking DMG_FALL.
That is, honestly, my last resort. I was really trying not to use hamsandwich for this.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 09-07-2012 at 11:22.
Liverwiz is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-07-2012 , 12:03   Re: Fall Damage on event_damage
Reply With Quote #5

get_param(3) , you mean read_data(3) ...
__________________

Last edited by Arkshine; 09-07-2012 at 12:04.
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-07-2012 , 12:08   Re: Fall Damage on event_damage
Reply With Quote #6

Ham : http://forums.alliedmods.net/showpos...00&postcount=2
W/O Ham : http://forums.alliedmods.net/showpos...52&postcount=5
Second way may be not reliable, have not tested enough.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-07-2012 at 12:09.
ConnorMcLeod is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-07-2012 , 12:23   Re: Fall Damage on event_damage
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
get_param(3) , you mean read_data(3) ...
Yeah, that's what i mean. But it still doesn't work......


Quote:
Originally Posted by ConnorMcLeod View Post
Ham : http://forums.alliedmods.net/showpos...00&postcount=2
W/O Ham : http://forums.alliedmods.net/showpos...52&postcount=5
Second way may be not reliable, have not tested enough.
The first one i know works because i have that in many plugins.
But the second one isn't what i'm trying to do. I'm trying to NOT execute that function if it is fall damage.

The weird thing to me is that checking is_user_alive(attackerID) isn't working. Is the ground really alive?
What is this...Doctor Who?
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 09-07-2012 at 12:35.
Liverwiz is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-07-2012 , 13:11   Re: Fall Damage on event_damage
Reply With Quote #8

I strongly recommend hooking Ham_TakeDamage
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-07-2012 , 17:36   Re: Fall Damage on event_damage
Reply With Quote #9

Alright, thanks all.
Ham_TakeDamage works.

But is there any ideas as to why using event_Damage doesn't work?
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz 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 08:18.


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