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

Ham_TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-09-2012 , 20:07   Ham_TakeDamage
Reply With Quote #1

When you register Ham_TakeDamage

PHP Code:
RegisterHam(Ham_TakeDamage"player""Ham_PlayerTakeDamage_Post"1); 
PHP Code:
public Ham_PlayerTakeDamage_Post(iVictim,iInflictor,iAttacker,Float:flDamage,iBits
If the iVictim is hit by a shot from a weapon, iInflictor and iAttacker are the same. How can I find the weapon that was used to cause the damage? i.e. deagle or ak47 or... Thank you
vitorrossi is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 09-09-2012 , 20:56   Re: Ham_TakeDamage
Reply With Quote #2

Quote:
Originally Posted by vitorrossi View Post
When you register Ham_TakeDamage

PHP Code:
RegisterHam(Ham_TakeDamage"player""Ham_PlayerTakeDamage_Post"1); 
PHP Code:
public Ham_PlayerTakeDamage_Post(iVictim,iInflictor,iAttacker,Float:flDamage,iBits
If the iVictim is hit by a shot from a weapon, iInflictor and iAttacker are the same. How can I find the weapon that was used to cause the damage? i.e. deagle or ak47 or... Thank you
Just use get_user_weapon(iAttacker) for retrieving the attacker's weapon, but you must be sure that the attacker is a player. For that one, you can just use is_user_connected
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-09-2012 , 20:58   Re: Ham_TakeDamage
Reply With Quote #3

If iAttacker is a player then get his weapon, get_user_weapon() I think.
__________________
fysiks is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-09-2012 , 22:13   Re: Ham_TakeDamage
Reply With Quote #4

Thank you, I will try that. What if I use instead

PHP Code:
ExecuteHam(Ham_TakeDamage,iVictim,iInflictor,iAttacker,Float:Damage,DMG_GENERIC
If I use this during the round it works fine but if I set this to happen after round is over (ie all Ts or CTs are dead) it doesn't call it. Is there any special parameter or method to make it work even after all players in one team are dead?
vitorrossi is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-10-2012 , 01:26   Re: Ham_TakeDamage
Reply With Quote #5

Quote:
Originally Posted by vitorrossi View Post
Thank you, I will try that. What if I use instead

PHP Code:
ExecuteHam(Ham_TakeDamage,iVictim,iInflictor,iAttacker,Float:Damage,DMG_GENERIC
If I use this during the round it works fine but if I set this to happen after round is over (ie all Ts or CTs are dead) it doesn't call it. Is there any special parameter or method to make it work even after all players in one team are dead?
That doesn't make sense. Executing Ham_TakeDamage is not a substitute for registering it . . .
__________________
fysiks is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-10-2012 , 11:05   Re: Ham_TakeDamage
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
That doesn't make sense. Executing Ham_TakeDamage is not a substitute for registering it . . .
Oh no, I understand that, this was a separate question about the same ham command... And btw I figured it out, thank you
P.S. get_user_weapon() worked perfectly!

Last edited by vitorrossi; 09-10-2012 at 13:32.
vitorrossi is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-10-2012 , 12:23   Re: Ham_TakeDamage
Reply With Quote #7

also check
Code:
!(0 < iAttacker <= get_maxplayers() )
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-10-2012 , 13:29   Re: Ham_TakeDamage
Reply With Quote #8

Don't forget to check if attacker is the same as inflictor, else inflictor can be a grenade.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 13:40.


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