Raised This Month: $ Target: $400
 0% 

[CSX] Nade kill returns as knife kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 11-16-2006 , 22:02   [CSX] Nade kill returns as knife kill
Reply With Quote #1

Code:
register_event("DeathMsg", "event_death", "a", "1>0") new killer = read_data(1) new ammo, clip, wpnindex = get_user_weapon(killer, clip, ammo) new name[32] get_user_name(killer, name, 31) if(wpnindex == CSW_HEGRENADE) {      client_print(victim, print_chat, "%s killed you with %s", name, global_weapon_array) }

I normally use client_death but in this case I decided to use the register_event for deathmsg.

Whenever a player kills another with a grenade...the weaponid returned is knife?

I'm not sure if this is normal.

All other weapon id's stored in the global array is returned correctly except for the nade index.

Last edited by organizedKaoS; 11-16-2006 at 22:05.
organizedKaoS is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 11-16-2006 , 22:28   Re: [CSX] Nade kill returns as knife kill
Reply With Quote #2

get_user_weapon(index,...) returns the CURRENT weapon of the player. If a player throws their HE Grenade, theyre not going to be using that weapon any more when it explodes.

The fourth paramter sent in the DeathMsg event should contain the string of the weapon kill in CS and CZ, 3rd parameter in other mods usually (not exactly sure what it would read for a grenade kill in cs).

Also, this should be in scripting help :x
__________________
fyren sucks
sawce is offline
jopmako
Senior Member
Join Date: Jul 2006
Location: QQ:331537639
Old 11-16-2006 , 22:34   Re: [CSX] Nade kill returns as knife kill
Reply With Quote #3

I think you are doing wrong way.

in this case "DeathMsg" don't return weapon id.

olny return weapon name
Code:
   new wpnname[16]
   read_data(4,wpnname,15)   // weapon name
Code:
/* Returns id of currently carried weapon. Gets also 
* ammount of ammo in clip and backpack. */
native get_user_weapon(index,&clip,&ammo);
__________________
QQ31537639
jopmako is offline
Send a message via MSN to jopmako
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 11-16-2006 , 22:37   Re: [CSX] Nade kill returns as knife kill
Reply With Quote #4

Quote:
Originally Posted by sawce View Post
get_user_weapon(index,...) returns the CURRENT weapon of the player. If a player throws their HE Grenade, theyre not going to be using that weapon any more when it explodes.

The fourth paramter sent in the DeathMsg event should contain the string of the weapon kill in CS and CZ, 3rd parameter in other mods usually (not exactly sure what it would read for a grenade kill in cs).

Also, this should be in scripting help
Ahhh....thank you....kinda tired so didn't realize what I was doing
organizedKaoS is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-17-2006 , 02:54   Re: [CSX] Nade kill returns as knife kill
Reply With Quote #5

As a note: read_data(4, ...) will return "grenade". By default (without 3rd party mods) it will be always HE grenade, since kill by C4 explosion never passed through DeathMsg

Last edited by VEN; 11-17-2006 at 02:58.
VEN 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 06:57.


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