Raised This Month: $ Target: $400
 0% 

Get kill weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 05-05-2013 , 06:09   Get kill weapon
Reply With Quote #1

How to get the weapon with which user killed an enemy?
Unkolix is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 05-05-2013 , 06:14   Re: Get kill weapon
Reply With Quote #2

pick it up after they die?
__________________
Blizzard_87 is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 05-05-2013 , 06:20   Re: Get kill weapon
Reply With Quote #3

Quote:
Originally Posted by Blizzard_87 View Post
pick it up after they die?
No, I need to get it right after the kill, I am doing it on DeathMsg... It's kinda MIX stats plugin I am working on.
Unkolix is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 05-05-2013 , 06:32   Re: Get kill weapon
Reply With Quote #4

Quote:
Originally Posted by Unkolix View Post
No, I need to get it right after the kill, I am doing it on DeathMsg... It's kinda MIX stats plugin I am working on.
you will need a global variable to hold the weapon name from CurWeapon event. how you put it into your stats plugin is upto you.
__________________
Blizzard_87 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-05-2013 , 06:57   Re: Get kill weapon
Reply With Quote #5

Quote:
Originally Posted by didoWEE View Post
get_user_weapon(read_data(1))
That won't work for all cases - such as grenade kill. He needs to read data 4 for weapon name. You can then reformat the name and use get_weaponid().

Quote:
Originally Posted by Blizzard_87 View Post
you will need a global variable to hold the weapon name from CurWeapon event. how you put it into your stats plugin is upto you.
No, that would be inefficient and unnecessary.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-05-2013 at 07:01.
hornet is offline
didoWEE
Senior Member
Join Date: Oct 2012
Location: Bulgaria
Old 05-05-2013 , 06:30   Re: Get kill weapon
Reply With Quote #6

get_user_weapon(read_data(1))

Last edited by didoWEE; 05-05-2013 at 06:30.
didoWEE is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 05-05-2013 , 07:41   Re: Get kill weapon
Reply With Quote #7

Did it like this, everything works except he kill...
PHP Code:
    new WeaponName[20]
    new 
WeaponID get_weaponid(WeaponName)
   
    
read_data(4WeaponName19)

    if (
WeaponID == CSW_HEGRENADE)    gs_stats[attacker][GS_HE]++; 
Unkolix is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-05-2013 , 07:48   Re: Get kill weapon
Reply With Quote #8

Quote:
Originally Posted by Unkolix View Post
Did it like this, everything works except he kill...
PHP Code:
    new WeaponName[20]
    new 
WeaponID get_weaponid(WeaponName)
   
    
read_data(4WeaponName19)

    if (
WeaponID == CSW_HEGRENADE)    gs_stats[attacker][GS_HE]++; 
I think you need to check WeaponName before getting weapon id.
If weaponname == "grenade" then here is your grenade kill
.Dare Devil. is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 05-05-2013 , 07:54   Re: Get kill weapon
Reply With Quote #9

Quote:
Originally Posted by .Dare Devil. View Post
I think you need to check WeaponName before getting weapon id.
If weaponname == "grenade" then here is your grenade kill
Didn't quite get that...
Unkolix is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-05-2013 , 07:59   Re: Get kill weapon
Reply With Quote #10

Code:
/* Function is called after player death ,
* if player was killed by teammate TK is set to 1 */
forward client_death(killer,victim,wpnindex,hitplace,TK);
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 10:48.


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