Raised This Month: $ Target: $400
 0% 

Hooking the self damage event?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VarmVaffel
Member
Join Date: Feb 2005
Location: Norway
Old 03-17-2005 , 13:47   Hooking the self damage event?
Reply With Quote #1

Is it possible to hook the player self damage event, like when the player jumps down a cliff or similar?

- VV
VarmVaffel is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-17-2005 , 15:50  
Reply With Quote #2

That is not an event.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-17-2005 , 17:53  
Reply With Quote #3

It is the Damage Event, and the attacker is the world (index 0)...

Something like this:
Code:
#include <amxmodx> public plugin_init() {     register_event( "Damage", "Event_Damage", "b", "2=0" ) } public Event_Damage( id ) {     new szUsername[32]     get_user_name( id, szUsername, 31 )     client_print( 0, print_chat, "%s hurt self!", szUsername )     return PLUGIN_CONTINUE }
xeroblood is offline
Send a message via MSN to xeroblood
VarmVaffel
Member
Join Date: Feb 2005
Location: Norway
Old 03-18-2005 , 05:06  
Reply With Quote #4

Thank you, just what I wanted!

- VV
VarmVaffel is offline
Reignman
Junior Member
Join Date: Jun 2005
Location: Minnesota
Old 06-30-2005 , 12:21  
Reply With Quote #5

How do you get that to display how much damage was done to self like ...

Quote:
Reignman hurt self! 42
__________________
Reignman is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 06-30-2005 , 17:32  
Reply With Quote #6

Code:
#include <amxmodx> public plugin_init() {     register_event( "Damage", "Event_Damage", "b", "2=0" ) } public Event_Damage( id ) {     new iDamage = read_data( 2 )     new szUsername[32]     get_user_name( id, szUsername, 31 )     client_print( 0, print_chat, "%s hurt self for %d HP!", szUsername, iDamage )     return PLUGIN_CONTINUE }
xeroblood is offline
Send a message via MSN to xeroblood
Reignman
Junior Member
Join Date: Jun 2005
Location: Minnesota
Old 06-30-2005 , 19:11  
Reply With Quote #7

It always displays 0 HP! for every fall. Is the script missing something?
__________________
Reignman is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 06-30-2005 , 20:40  
Reply With Quote #8

Oooops.. ya, it should only be printing 0.. that would make sense!!

I messed up, did it too fast.. try this tho, it may be what you're looking for: (but again, I didnt test this)

Code:
#include <amxmodx> public plugin_init() {     register_event( "Damage", "Event_Damage", "b", "2!0" ) } public Event_Damage( id ) {     new iDamage = read_data( 2 )     new iAttackerID = get_user_attacker( id )     if( (iAttackerID == 0) || (iAttackerID == id) )     {         new szUsername[32]         get_user_name( id, szUsername, 31 )         client_print( 0, print_chat, "%s hurt self for %d HP!", szUsername, iDamage )     }     return PLUGIN_CONTINUE }

NOTE: Notice the change in the register_event()
xeroblood is offline
Send a message via MSN to xeroblood
Reignman
Junior Member
Join Date: Jun 2005
Location: Minnesota
Old 07-06-2005 , 19:38  
Reply With Quote #9

Thanks, worked great. Can I get just one more thing added? If the person dies (suicide) can I get it to display ...

Quote:
Player hurt self 37 HP (died)
__________________
Reignman is offline
Anthraxnz
Senior Member
Join Date: May 2005
Location: New Zealand
Old 07-06-2005 , 20:21  
Reply With Quote #10

this might work if you add it to the damage function

Code:
if (iDamage == 0 )     client_print( 0, print_chat, "%s Has Died", szUsername )

just taking a stab in the dark at this prolly doesnt work
__________________
Dont know how to add admins?

use my program
http://www.amxmodx.org/forums/viewto...=129092#129092

it does the work for you ... sort of
Anthraxnz 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:09.


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