Raised This Month: $ Target: $400
 0% 

[Help needed]Exclusive damage rate


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-01-2015 , 17:54   Re: [Help needed]Exclusive damage rate
Reply With Quote #2

You should use attacker here, not inflictor. Inflictor is not always the same as attacker, in the case of grenade damage, and possibly C4, it is the entity index of the grenade. I also fixed and improved other things that were done incorrectly.
Code:
if (is_user_connected(attacker) && is_user_alive(attacker) && get_user_flags(attacker) & ACCESS) {     new iWeaponUsed = get_user_weapon(inflictor)     if(iWeapon == CSW_KNIFE || iWeapon == CSW_AWP || iWeapon == CSW_SCOUT || iWeaponUsed == CSW_HEGRENADE)         return PLUGIN_CONTINUE             SetHamParamFloat(4, damage * dmgRate) }
Untested
PHP Code:

#include <amxmodx>
#include <hamsandwich>

#define VERSION "0.2"

#define MAX_PLAYERS 32
#define ACCESS ADMIN_CFG

new const DMG_GRENADE = ( << 24 );
new const 
IGNORE_WEAPONS = ( << CSW_KNIFE ) | ( << CSW_AWP ) | ( << CSW_SCOUT );

new 
pCVar_DamageRate;

public 
plugin_init()
{
    
register_plugin"VIP Sebzes Bonusz" VERSION "RaZ" );
    
    
pCVar_DamageRate register_cvar"vipbonus_dmgrate" "1.3" );

    
RegisterHamHam_TakeDamage "player" "fw_TakeDamage" ); 
}

public 
fw_TakeDamageiVictim iInflictor iAttacker Float:fDamage DamageBits )
{
    if( !( 
<= iAttacker <= MAX_PLAYERS ) || 
        ( 
DamageBits DMG_GRENADE ) ||
        !( 
get_user_flagsiAttacker ) & ACCESS ) ||
        ( ( 
<< get_user_weaponiAttacker ) ) & IGNORE_WEAPONS ) )
        return 
HAM_IGNORED;
        
    
SetHamParamFloatfDamage get_pcvar_floatpCVar_DamageRate ) )
    
    return 
HAM_HANDLED;

__________________

Last edited by Bugsy; 11-01-2015 at 18:30.
Bugsy is offline
 



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


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