AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect Death by worldspawn? (https://forums.alliedmods.net/showthread.php?t=25053)

swobj 03-06-2006 21:31

Detect Death by worldspawn?
 
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.

Kraugh 03-06-2006 21:45

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).

VEN 03-07-2006 02:18

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

Kraugh 03-07-2006 16:08

thanks. i did not know about the fourth argument.


All times are GMT -4. The time now is 20:21.

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