AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [CSX] Nade kill returns as knife kill (https://forums.alliedmods.net/showthread.php?t=47396)

organizedKaoS 11-16-2006 22:02

[CSX] Nade kill returns as knife kill
 
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.

sawce 11-16-2006 22:28

Re: [CSX] Nade kill returns as knife kill
 
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

jopmako 11-16-2006 22:34

Re: [CSX] Nade kill returns as knife kill
 
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);


organizedKaoS 11-16-2006 22:37

Re: [CSX] Nade kill returns as knife kill
 
Quote:

Originally Posted by sawce (Post 404011)
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

Ahhh....thank you....kinda tired so didn't realize what I was doing :P

VEN 11-17-2006 02:54

Re: [CSX] Nade kill returns as knife kill
 
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


All times are GMT -4. The time now is 06:57.

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