Tracing damage indicator
Hi everyone!
I was looking for new methods of filtering damage recieving for my damage_displayer.sma, and I've had an interesting idea. I would like to hook the state, where the user has a damage indication red paralelogram around the cursor. I know that hamsandwich's damage hook has a damage_type parameter, but what of the situations, where damage is composed of the following two steps: 1) set user's health directly 2) put a DMG_BULLET indication on it's HUD. Like in monstermod, or in zp_extra_lasermine, or in much other plugins. First of all, I've tried invoking it, and came up with the code below: PHP Code:
But how to hook this. I've tried the code below: PHP Code:
So how can I hook a MSG_ONE_UNRELIABLE? Or any other ideas on how to track if the user has the damage on their screen? Thanks guys in advance! |
Re: Tracing damage indicator
You're having problems hooking your own messages or what ?
message_* can't be hooked, emessage_* can. If other plugins use that you can't hook them unless they're emessage_*. Ham_TakeDamage would be the best way, that triggers whenever player takes real damage. Hooking health msg could also work and you can get the dmg type from an offset (I think). If that's not it, then I don't really understand what you want. |
Re: Tracing damage indicator
Oh, sorry, forgot to mention. I am trying to avoid hamsandwich, so my plugin would be applyable to mods as sven-coop, where there is no linux libraries( yet ), so hamsandwich could not be written fully. And Ham_TakeDamage also doesn't work.
|
Re: Tracing damage indicator
Quote:
|
Re: Tracing damage indicator
To make the game itself send a Damage event, all you have to do is to set properly pev_dmg_take, m_bitsDamageType and pev_dmg_inflictor, Damage message will be sent at UpdateClientData :
Code:
if (pev->dmg_take || pev->dmg_save || m_bitsHUDDamage != m_bitsDamageType)PHP Code:
Then the game will know that player has just taken damage and will send a Damage message with correct origins values. |
Re: Tracing damage indicator
Hmm, how's the HUD health rounded, up or down ?
If it's up, I belive flHealth should be checked <= 0 Anyway, nice method :P |
Re: Tracing damage indicator
I don't think there is anything to round, even if health is a float :)
|
| All times are GMT -4. The time now is 10:28. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.