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

Shouldn't this work for hooking the damage event?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-12-2004 , 13:53   Shouldn't this work for hooking the damage event?
Reply With Quote #1

Code:
#include <amxmodx> #include <amxmisc> #include <engine> new gmsgDamage public plugin_init(){     gmsgDamage = get_user_msgid("Damage")     register_message(gmsgDamage, "hookDamage") } public hookDamage(msgid){     new damage = get_msg_arg_int(2)     client_print(1,print_chat,"damage: %d",damage)     damage+=10     set_msg_arg_int(2,ARG_BYTE,damage) }

Shouldn't this add 10 to the damage? It doesn't.


edited by SniperBeamer:
changed bbcode to [ small ]
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-12-2004 , 14:03   Re: Shouldn't this work for hooking the damage event?
Reply With Quote #2

Quote:
Originally Posted by pimp daddy
Code:
#include <amxmodx> #include <amxmisc> #include <engine> new gmsgDamage public plugin_init(){     gmsgDamage = get_user_msgid("Damage")     register_message(gmsgDamage, "hookDamage") } public hookDamage(msgid){     new damage = get_msg_arg_int(2)     client_print(1,print_chat,"damage: %d",damage)     damage+=10     set_msg_arg_int(2,ARG_BYTE,damage) }

Shouldn't this add 10 to the damage? It doesn't.


edited by SniperBeamer:
changed bbcode to [ small ]
as far as i know, this should only tell the client you got damaged +10 hp, but it doesnt do any actual damage
__________________
hello, i am pm
PM is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-12-2004 , 14:05  
Reply With Quote #3

I thought set_msg_arg_int(2,ARG_BYTE,damage) changes it before the engine receives the message. What does this function do then?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-12-2004 , 14:10  
Reply With Quote #4

register_message registers a client message. That is a message that the server sends to the client so that the clients data is updated. On Damage, it sends how many dmg was done, so that the client draws it. if you modify the damage parameter, the health drawn in the client will differ from the 'real' helath on the server...
__________________
hello, i am pm
PM is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-12-2004 , 14:21  
Reply With Quote #5

Odd, it didn't even modify the health on my machine (the client). Will it be possible to change the damage dealt before it hits the engine?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
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 17:10.


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