Raised This Month: $ Target: $400
 0% 

Displaying bullet damage with HamSandwich


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-12-2009 , 14:06   Re: Displaying bullet damage with HamSandwich
Reply With Quote #1

I don't know if final damage (pev_dmg_take) is proportional to initial damage, but if it is, this should work :
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new Float:g_fCritHit[33];

public 
plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""hTakeDamagePre");
    
RegisterHam(Ham_TakeDamage"player""hTakeDamagePost"1);
}

public 
hTakeDamagePre(iVictimiInflictoriAttackerFloat:fDmg)
{
    if(
random_num(099) < 15// 15% of success
    
{
        
g_fCritHit[iAttacker] = random_float(1.52.5);
        
SetHamParamFloat(4fDmg g_fCritHit[iAttacker]);
    }
}

public 
hTakeDamagePost(iVictimiInflictoriAttackerFloat:fDmg)
{
    static 
Float:fMult
    
if( ( fMult g_fCritHit[iAttacker] ) )
    {
        
pev(iVictimpev_dmg_takefDmg);  
        
client_print(iAttackerprint_chat,
            
"You've made a critical hit: normal dmg: %d, dmg multiplier: %.1f, total dmg: %d",
            
floatround(fDmg*fMult), fMultfloatround(fDmg))
        
g_fCritHit[iAttacker] = 0.0;
    }

__________________
- 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 01:38.


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