Raised This Month: $ Target: $400
 0% 

Get killers weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-20-2005 , 04:01   Get killers weapon
Reply With Quote #1

How would I go by getting the weapon of the person who just killed me?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-20-2005 , 10:57  
Reply With Quote #2

From amxmodx.inc:
Code:
/* If player is not attacked function returns 0, in other * case returns index of attacking player. On second and third * parameter you may get info about weapon and body hit place. */ native get_user_attacker(index,...);

Example:
Code:
public SomeFunc( id ) // Maybe the Damage Event? {     new iWeapon, iBody     new iAttacker = get_user_attacker( id, iWeapon, iBody )     // blah blah blah }

The weapon will be an index # of the constant weapon types from amxconst.inc....
xeroblood is offline
Send a message via MSN to xeroblood
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 03-20-2005 , 15:16   easy
Reply With Quote #3

Code:
register_event("DeathMsg", "event_DeathMsg", "a") public event_DeathMsg(id) {     new weapon = read_data(4)     // code }
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-20-2005 , 15:33  
Reply With Quote #4

Some mods don't even use the DeathMsg event, knekter.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-20-2005 , 16:01  
Reply With Quote #5

and that would only work when the player dies... but it was good to point out none the less! there is more than one way, of course, so im sure people like to see the other ways too!
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-20-2005 , 16:15  
Reply With Quote #6

Thanks, I'll try it out..

Edit: Xero, does that do it for when the victim is already dead, or when he's being attacked?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-20-2005 , 18:06  
Reply With Quote #7

whenever you choose to call the function (generally only after being damaged/killed)..

So you could call it in a DeathMsg Event function or a Damaga Event function...
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-20-2005 , 18:14  
Reply With Quote #8

So..
Code:
public plugin_init() {     // ..     register_event("DeathMsg", "event_DeathMsg", "a") } public event_DeathMsg(id) {     new iWeapon, iBody     new iAttacker = get_user_attacker(id, iWeapon, iBody)     // blah blah blah }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-20-2005 , 20:42  
Reply With Quote #9

Exactly! You got it!!

(But return PLUGIN_CONTINUE too)
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-20-2005 , 21:02  
Reply With Quote #10

Quote:
Originally Posted by xeroblood
(But return PLUGIN_CONTINUE too)
Yea, kinda figured that.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 14:16.


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