AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Grenade Kill (https://forums.alliedmods.net/showthread.php?t=183100)

Napoleon_be 04-17-2012 10:55

Grenade Kill
 
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?

Exolent[jNr] 04-17-2012 10:59

Re: Grenade Kill
 
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.

Napoleon_be 04-17-2012 11:08

Re: Grenade Kill
 
Quote:

Originally Posted by Exolent[jNr] (Post 1691035)
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?

Exolent[jNr] 04-17-2012 11:11

Re: Grenade Kill
 
You can search. It's in the funcwiki and I've used it to post requested plugins here before.

DarkGL 04-17-2012 11:15

Re: Grenade Kill
 
Code:

public client_death(killer,victim,wpnindex,hitplace,TK){
        if( wpnindex == CSW_HEGRENADE ){
        }
}


Napoleon_be 04-17-2012 11:59

Re: Grenade Kill
 
Quote:

Originally Posted by DarkGL (Post 1691050)
Code:

public client_death(killer,victim,wpnindex,hitplace,TK){
    if( wpnindex == CSW_HEGRENADE ){
    }
}


Thanks

Devil259 04-17-2012 16:25

Re: Grenade Kill
 
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.      } }


All times are GMT -4. The time now is 07:43.

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