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

How to detect grenade damage in the Ham_takedamage function?


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-04-2008 , 12:19   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #11

it's a bit difficult to explain since my english is too poor. Take a look into the official guide of pawn, you will find some useful informations. ( http://www.compuphase.com/pawn/pawn-lang.pdf )
__________________
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 06-04-2008 , 12:35   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #12

Ok! Tnx for all info!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 06-04-2008 , 22:19   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #13

Quote:
Originally Posted by DA View Post
idinflictor is the id from the weapon.
This is not the result I get with Ham_TakeDamage. The way I understand it, for a grenade, the inflictor is the ENTITY number (like 321) of the grenade, NOT the weapon ID (like CSW_HEGRENADE).

So to determine if it was a grenade, you should probably use arkshine's method and do a classname compare on the inflictor (entity number).

Its also been my experience that if the damage was inflicted by a weapon owned by a player (the usual occurance), the inflictor value will be the SAME as the attacker value. So before you check for a grenade classname, check if the inflictor is > 32. And to determine the weapon used (if NOT a grenade) you need to use get_user_weapon().

Please correct me if I'm all wet.
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 06-04-2008 at 22:23.
Vet is offline
Send a message via MSN to Vet
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-05-2008 , 00:02   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #14

If the damage was from the attacker's weapon, the inflictor is equal to the attacker.
The weapon will be found by using get_user_weapon(attacker, ...).
So, if inflictor != attacker & classname equals "grenade", then the inflictor value holds the grenade's entity index.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-05-2008 , 00:53   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #15

Be careful that c4 classname is "grenade" as well.
You can use VEN's method(fakemeta util thread page 10 or 11) if arkshine's way (DMG_GRENADE) doesn't work.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 06-05-2008 , 04:37   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #16

Quote:
Originally Posted by X-olent View Post
If the damage was from the attacker's weapon, the inflictor is equal to the attacker.
This doesn't really sound logical if you're using grenades.
Quote:
Originally Posted by X-olent View Post
The weapon will be found by using get_user_weapon(attacker, ...).
I think you got confused here. This gets his current weapon, not the one he threw 3 seconds ago.




CSX way.
Code:
#include <amxmodx> #include <csx> public client_damage(attacker, victim, damage, wpnindex, hitplace, TA) {     if ( wpnindex != CSW_HEGRENADE )         return;     }

Last edited by [ --<-@ ] Black Rose; 06-05-2008 at 04:48.
[ --<-@ ] Black Rose is offline
Old 06-05-2008, 04:45
[ --<-@ ] Black Rose
This message has been deleted by [ --<-@ ] Black Rose. Reason: Fucking doublepost, I meant to edit the other and add it there...
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 06-05-2008 , 11:45   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #17

Yes, grenades, once thrown, no longer belong to the owner. I think we stated that in the posts. No confusion.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 06-05-2008 , 13:32   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #18

Quote:
Originally Posted by Vet View Post
Yes, grenades, once thrown, no longer belong to the owner. I think we stated that in the posts. No confusion.
Maby you didn't notice X-olent posted AFTER you.
[ --<-@ ] Black Rose is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-05-2008 , 13:57   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #19

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
I think you got confused here. This gets his current weapon, not the one he threw 3 seconds ago.
Quote:
Originally Posted by 'X-olent View Post
If the damage was from the attacker's weapon, the inflictor is equal to the attacker.
The weapon will be found by using get_user_weapon(attacker, ...).
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 06-05-2008 , 14:00   Re: How to detect grenade damage in the Ham_takedamage function?
Reply With Quote #20

Be more comprehendable next time.
[ --<-@ ] Black Rose 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 07:21.


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