Raised This Month: $ Target: $400
 0% 

Detect Death by worldspawn?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
swobj
Junior Member
Join Date: Jun 2004
Old 03-06-2006 , 21:31   Detect Death by worldspawn?
Reply With Quote #1

Mm.. quick question. Is there a way to detect if you were killed by worldspawn, like if you were changing your class. Can someone provide a small snippet if it is possible . Thanks for your time.
swobj is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-06-2006 , 21:45  
Reply With Quote #2

Code:
public plugin_init() {    register_event("DeathMsg","death_hook","a"); } public death_hook() {    new killer = read_data(1), victim = read_data(2);    if(!killer) {       // victim was killed by worldspawn    } }

it's also possible that instead of coming up as getting killed by 0 it will come up as getting killed by yourself (killer == victim).
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
VEN
Veteran Member
Join Date: Jan 2005
Old 03-07-2006 , 02:18  
Reply With Quote #3

Your code would work for kill with worldspawn and trigger_hurt so better read 4rd data argument:
Code:
new arg4[12] read_data(4, arg4, 11) if (equal(arg4, "worldspawn")) // then worldspawn kill

Aslo killer == victim at:
- "kill" console command
- HE grenade suicide
- user_kill native
VEN is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-07-2006 , 16:08  
Reply With Quote #4

thanks. i did not know about the fourth argument.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
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 20:21.


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