AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fall Damage on event_damage (https://forums.alliedmods.net/showthread.php?t=195414)

Liverwiz 09-07-2012 10:11

Fall Damage on event_damage
 
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 


jimaway 09-07-2012 10:16

Re: Fall Damage on event_damage
 
return PLUGIN_HANDLED to block?

Arkshine 09-07-2012 10:29

Re: Fall Damage on event_damage
 
More simple to hook Ham_TakeDamage, and checking DMG_FALL.

Liverwiz 09-07-2012 11:14

Re: Fall Damage on event_damage
 
Quote:

Originally Posted by jimaway (Post 1793454)
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 (Post 1793472)
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.

Arkshine 09-07-2012 12:03

Re: Fall Damage on event_damage
 
get_param(3) , you mean read_data(3) ...

ConnorMcLeod 09-07-2012 12:08

Re: Fall Damage on event_damage
 
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.

Liverwiz 09-07-2012 12:23

Re: Fall Damage on event_damage
 
Quote:

Originally Posted by Arkshine (Post 1793560)
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 (Post 1793563)
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?

claudiuhks 09-07-2012 13:11

Re: Fall Damage on event_damage
 
I strongly recommend hooking Ham_TakeDamage

Liverwiz 09-07-2012 17:36

Re: Fall Damage on event_damage
 
Alright, thanks all.
Ham_TakeDamage works.

But is there any ideas as to why using event_Damage doesn't work?


All times are GMT -4. The time now is 08:18.

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