Raised This Month: $51 Target: $400
 12% 

Sven Co-op: DeathMsg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fyske
New Member
Join Date: Apr 2008
Old 04-05-2008 , 20:32   Sven Co-op: DeathMsg
Reply With Quote #1

Hello everyone,

I would like to know if there is anyway to know when a Player dies? I'm currently working on a plugin with many, MANY timers that start whenever a player spawn and is supposed to destroy itself (so that it can get restarted later properly) whenever the player die.

I have tried to work with DeathMsg only to find out that it doesn't seem to work.

I have looked in the Forums, but did not find anything related to it. Is this a issue only for me, or?

Also, I'd like to know if the event "Damage" will apply BEFORE the damage get applied? (Like, for example, if I want to make a Player able to sometimes recover extra hp & armor from an attack, I just apply the HP and Armor before the player actually take damage. That way, it would save the Player's life if he is on low HP.)

Thanks for help.
Fyske is offline
OpenMind
Junior Member
Join Date: Apr 2007
Location: /dev/null
Old 04-05-2008 , 21:38   Re: Sven Co-op: DeathMsg
Reply With Quote #2

What exactly did not work with DeathMsg?

Try something like this:

Code:
public plugin_init() {     RegisterHam(Ham_Spawn, "player", "player_spawned", 1);     register_event("DeathMsg", "death_event", "a"); } public player_spawned(id) {     set_task(1.0, "your_timer", id+100, _, _, "b"); } public death_event() {     new victim = read_data(2);     if(task_exists(victim+100)) {         remove_task(victim+100);     } }

Last edited by OpenMind; 04-05-2008 at 21:42.
OpenMind is offline
Send a message via ICQ to OpenMind Send a message via MSN to OpenMind
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-05-2008 , 21:42   Re: Sven Co-op: DeathMsg
Reply With Quote #3

You can use the hamsandwich module:

Code:
#include <amxmodx> #include <hamsandwich> public plugin_init() {     RegisterHam(Ham_Killed, "player", "fwd_Ham_Killed"); } public fwd_Ham_Killed(id) {     // called whenever a player dies }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Fyske
New Member
Join Date: Apr 2008
Old 04-05-2008 , 23:02   Re: Sven Co-op: DeathMsg
Reply With Quote #4

Quote:
What exactly did not work with DeathMsg?
What exactly? Well, it's pretty simple: no matter how I write it down, DeathMsg even NEVER EVER happen..

@X-olent: I'm gonna sound like a noob, but I couldn't find anything related to hamsandwich in the documention? Is there one? I have read many great good about it, but I can't really do anything with it I don't know how any of the functions. ^^;

Thanks for the fast answers, guys.

Last edited by Fyske; 04-05-2008 at 23:09.
Fyske 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 23:44.


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