Raised This Month: $ Target: $400
 0% 

Grenade Kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-17-2012 , 10:55   Grenade Kill
Reply With Quote #1

PHP Code:
register_event("DeathMsg""eDeath""a"
PHP Code:
public eDeath() {
    if(
get_user_weapon(read_data(1)) == CSW_HEGRENADE) {
         
// Code
    
}

Is it okay to check like this if the attacker killed the victim with an HE Grenade?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-17-2012 , 10:59   Re: Grenade Kill
Reply With Quote #2

If the victim is killed with a grenade, then how can the attacker be holding the grenade?

You can either:
1. Check if weapon name sent to the death function is "grenade" (or maybe "hegrenade")
2. Use CSX's client_death() and check if weapon ID is CSW_HEGRENADE.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-17-2012 , 11:08   Re: Grenade Kill
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
If the victim is killed with a grenade, then how can the attacker be holding the grenade?

You can either:
1. Check if weapon name sent to the death function is "grenade" (or maybe "hegrenade")
2. Use CSX's client_death() and check if weapon ID is CSW_HEGRENADE.
Never worked with client_death(). Could you give me an example please?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-17-2012 , 11:11   Re: Grenade Kill
Reply With Quote #4

You can search. It's in the funcwiki and I've used it to post requested plugins here before.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
DarkGL
Senior Member
Join Date: Aug 2010
Location: Warsaw, Poland
Old 04-17-2012 , 11:15   Re: Grenade Kill
Reply With Quote #5

Code:
public client_death(killer,victim,wpnindex,hitplace,TK){
	if( wpnindex == CSW_HEGRENADE ){
	}
}
__________________
DarkGL is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-17-2012 , 11:59   Re: Grenade Kill
Reply With Quote #6

Quote:
Originally Posted by DarkGL View Post
Code:
public client_death(killer,victim,wpnindex,hitplace,TK){
    if( wpnindex == CSW_HEGRENADE ){
    }
}
Thanks
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 04-17-2012 , 16:25   Re: Grenade Kill
Reply With Quote #7

http://wiki.amxmodx.org/Half-Life_1_...vents#DeathMsg

Code:
Name:	 DeathMsg
Structure:	
byte	 KillerID
byte	 VictimID
byte	 IsHeadshot
string	 TruncatedWeaponName
Code:
Note: For grenade kill TruncatedWeaponName isn't "hegrenade" but "grenade", in fact it's an actual classname of a throwed grenade.
So, you can do that :

Code:
public eDeath( ) {      new szWeapon[ 10 ];      read_data( 4, szWeapon, charsmax( szWeapon ) );      if( equal( szWeapon, "grenade" ) )      {           new iKiller = read_data( 1 );           new iVictim = read_data( 2 );           // iKiller killed iVictim with a hegrenade.      } }
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 04-17-2012 at 16:25.
Devil259 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:43.


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