Raised This Month: $ Target: $400
 0% 

Remaining Health on Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-30-2010 , 01:51   Re: Remaining Health on Damage
Reply With Quote #1

You could directly work in Post TakeDamage and only check pev(victim, pev_dmg_take) and take it as an integer.

This should be ok :

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "0.0.1"
#define PLUGIN ""

#define FIRST_PLAYER_ID    1
#define MAX_PLAYERS        32
new g_iMaxPlayers
#define IsPlayer(%1)    ( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )

new g_iDamage[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
RegisterHam(Ham_Spawn"player""Ham_CBasePlayer_Spawn_Post"1)
    
RegisterHam(Ham_TakeDamage"player""CBasePlayer_TakeDamage_Post"1)
    
g_iMaxPlayers get_maxplayers()
}

public 
Ham_CBasePlayer_Spawn_Postid )
{
    
g_iDamage[id] = 0
}

public 
CBasePlayer_TakeDamage_Post(idiInflictoriAttackerFloat:flDamagebitsDamageType)
{
    if( 
id != iAttacker && IsPlayer(iAttacker) && cs_get_user_team(id) != cs_get_user_team(iAttacker) )
    {
        
g_iDamage[iAttacker] += pev(idpev_dmg_take)

        if( !
is_user_alive(id) )
        {
            
g_iDamage[iAttacker] += get_user_health(id)
        }
    }    


Anyway, i think csx module already provides some natives that could give you exactly what you want.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 11:17.


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