Bug 3248 - get_user_weapon reporting wrong weapons in NS
get_user_weapon reporting wrong weapons in NS
Status: RESOLVED INVALID
Product: AMX Mod X
Classification: Unclassified
Component: Core
trunk
PC All
: P4 normal
Assigned To: amxmodx-bugs@alliedmods.net
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-08 07:52 PDT by Rothgar
Modified: 2013-06-15 15:56 PDT (History)
3 users (show)

See Also:


Attachments

Description Rothgar 2008-09-08 07:52:30 PDT
Hi Guys,

It seems get_user_weapon in a death event is returning wrong weapons, it has to do with a few specific things I believe and I can't replicate all of them.

Some weapons initial impact causes get_user_weapon to return the first weapon used instead of the final killing weapon.

For example:

If you parasite a player then kill them with something else you will return the parasite weaponid instead of the weaponid that made the final killing blow...

I have also seen (I think) a player healspraying a defencetower and if that defencetower makes a kill it gets detected as a healspray weapon.

Also jump biting someone will recognize as a leap etc?

In my plugin_init() I have the following death hook:

register_event("DeathMsg", "event_Death", "a")

in my event_Death() function I have the following:

	new killer = read_data(1)
	new victim = read_data(2)

	new killer_weaponid = -1
	if (killer != 0)
		killer_weaponid = get_user_weapon(killer)


I then check weapons like so:

if (killer_weaponid == WEAPON_PARASITE)

The way I have found the wrong errors was then in my check function doing the following:

				new killer_weapon[32]
				get_weaponname(killer_weaponid,killer_weapon,32)

This returns "weapon_parasite" for someone who died and was infected by parasite but was in the end killed by a "bitegun" for example.
Comment 1 Vincent Herbet [:Arkshine] 2013-06-15 15:56:59 PDT
get_user_weapon() returns the current weapon that player is holding. It simply means at this time killer has switched to parasite weapon after killing you with bitegun. There is no bug.

Note You need to log in before you can comment on or make changes to this bug.