Raised This Month: $ Target: $400
 0% 

best way to catch changed hp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-25-2009 , 07:16   Re: best way to catch changed hp
Reply With Quote #1

ok. this sounds realy complicated but i have to try this way maybe its a little hard to code for me but i have to learn this

ty @ all. i hope i dont post again for this
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-25-2009 , 07:26   Re: best way to catch changed hp
Reply With Quote #2

Hp change detection, + 0HP bug fix (only need if players can have more than 255HP).

I use this method because i figured out that Health message is not sent all time for reasons i don't understand.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>

#define    m_iClientHealth        359

new g_iClientHealth[MAX_PLAYERS+1]

new 
gmsgHealth

public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR )

    
register_forward(FM_UpdateClientData"UpdateClientData")

    
gmsgHealth get_user_msgid("Health")
}

public 
UpdateClientDatar(id)
{
    new 
iHealth get_user_health(id)
    if( 
g_iClientHealth[id] != iHealth )
    {
        
// player hp has changed
        
g_iClientHealth[id] = iHealth

        
// 0 HP bug fix
        
if( iHealth && iHealth 256 == )
        {
            
iHealth -= 1
            set_pdata_int
(idm_iClientHealthiHealth)
            
set_user_health(idiHealth)

            
message_begin(MSG_ONEgmsgHealth_id)
            
write_byte(iHealth)
            
message_end()
            return 
FMRES_HANDLED
        
}
    }
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2009 , 07:32   Re: best way to catch changed hp
Reply With Quote #3

It's not really complicated. The method used on this map to give health is for sure very tricky. Once you know that it's func_door which give health ( just looking with BSPViewer the entities, and seeing the targetname etc.. you can find 4 func_door which give -250 as damage ), you have just to check in the HLSDK, you can find only one function where damage is applied, it's CBaseDoor::Blocked() :

Code:
void CBaseDoor::Blocked( CBaseEntity *pOther ) {     edict_t *pentTarget = NULL;     CBaseDoor   *pDoor      = NULL;     // Hurt the blocker a little.     if ( pev->dmg )         pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );         // [....]

That's why Ham_Blocked should be a simple, efficient and good method to find the Hulk index.
__________________
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-25-2009 , 07:45   Re: best way to catch changed hp
Reply With Quote #4

oh ty. ill try & will report how i did it
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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:33.


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