AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Shouldn't this work for hooking the damage event? (https://forums.alliedmods.net/showthread.php?t=211)

Geesu 03-12-2004 13:53

Shouldn't this work for hooking the damage event?
 
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 ]

PM 03-12-2004 14:03

Re: Shouldn't this work for hooking the damage event?
 
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 :)

Geesu 03-12-2004 14:05

I thought set_msg_arg_int(2,ARG_BYTE,damage) changes it before the engine receives the message. What does this function do then?

PM 03-12-2004 14:10

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

Geesu 03-12-2004 14:21

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?


All times are GMT -4. The time now is 05:56.

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