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

[CSX] client_death reports wpnid as 0 when killed by bomb


  
 
 
Thread Tools Display Modes
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 11-11-2006 , 01:30   [CSX] client_death reports wpnid as 0 when killed by bomb
#1

Shouldn't it return CSW_C4? If you are killed by the bomb in CS it says you were killed by weapon id 0.

Test code:
Code:
public client_death( killer,victim,wpnindex,hitplace,TK ) {     client_print( victim, print_chat, "[DEBUG] You were killed by %d with weapon %d", killer, wpnindex ); }

Result:
Quote:
[DEBUG] You were killed by 1 with weapon 0
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 11-11-2006 , 01:44   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#2

Also, this is how i'm working around it:

Code:
// All we want to check is if the user was killed by the bomb public client_death( iAttacker, iVictim, iWeapon, hitplace, TK ) {     // Check out who the inflictor was     new iInflictor = entity_get_edict( iVictim, EV_ENT_dmg_inflictor );     // Check to see if the death was from the bomb     if ( 0 < iInflictor < MAXPLAYERS && iWeapon != CSW_HEGRENADE && iInflictor )     {                 if ( is_valid_ent ( iInflictor ) )         {             new szClassName[64];             entity_get_string( iInflictor, EV_SZ_classname, szClassName, 63 );             // Check the classname of our inflictor             if ( equali( szClassName, "grenade" ) || equali( szClassName, "env_explosion" ) )             {                 iWeapon = CSW_C4;                 iAttacker = 0;                 real_death_call( iVictim, iAttacker, iWeapon, 0 );             }         }     } }
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
VEN
Veteran Member
Join Date: Jan 2005
Old 11-12-2006 , 03:43   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#3

I believe in the older versions of CSX it returned CSW_C4. Though the planted C4 isn't actually a "weapon_c4" but a "grenade" which isn't a weapon. [edited]

Last edited by VEN; 11-13-2006 at 09:36.
VEN is offline
BAILOPAN
Join Date: Jan 2004
Old 11-12-2006 , 04:01   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#4

Indeed, when you are killed by C4, you are killed by a grenade.

However, the question is whether CSX should be abstracting past this or not.
__________________
egg
BAILOPAN is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-12-2006 , 04:40   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#5

Currently, IIRC, the forward return HE grenade weapon index for HE grenade kill. So why it was made to not return CSW_C4 [cut]. Seems illogical to me.

In my opinion "abstracting" wouldn't make worse since players can't kill someone with actual "weapon_hegrenade" or "weapon_c4" anyway.

Last edited by VEN; 11-13-2006 at 09:37.
VEN is offline
BAILOPAN
Join Date: Jan 2004
Old 11-12-2006 , 05:00   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#6

I don't like that, and if I were to redo it (which I can't, for backwards compatibility), I would make it be consistent and return WEAPON_HEGRENADE.

That said, my thoughts: Encapsulating it to return CSW_C4 is a good idea. Saying you can't kill them with the "actual weapon" is semantics at best, implementation dependent at worst. What wpnindex should mean is "which weapon CAUSED death." By your logic, it should return the index of an M4A1 instead of WEAPON_M4A1, because it was actually a bullet that killed them ;)

As long as it doesn't break old code I don't mind making this change.
__________________
egg
BAILOPAN is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 11-12-2006 , 13:30   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#7

yay! BAIL ftw!
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
VEN
Veteran Member
Join Date: Jan 2005
Old 11-13-2006 , 09:35   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#8

I've made some testings and found that if you standing close to the center of the explosion it will return WID == 0 (dmg_inflictor has "env_explosion" classname). But if you are not close it will return CSW_C4 (dmg_inflictor's classname is "grenade" in this case). So the forward able to return CSW_C4 but not in the all cases.

But i personally would not use client_death forward anyway, at least because it's not called on user_kill native execution or on falldamage death.
VEN is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 11-14-2006 , 14:43   Re: [CSX] client_death reports wpnid as 0 when killed by bomb
#9

True, thats why you do the check like in my above example
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
 



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 16:39.


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