Raised This Month: $ Target: $400
 0% 

Damage he grenade mutil by another weapons?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lucky888
Senior Member
Join Date: Nov 2011
Location: Paradise
Old 11-08-2013 , 00:41   Damage he grenade mutil by another weapons?
Reply With Quote #1

Hi every one, this is plugin can mutil damage for grenade, it's good but, i found some bug, if you throw genade, then change to another weapons use Ham_TakeDamage, damage of genade will be mutil with mutil damage of another weapons. So can you fix for me?
Here is my code:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>



new P_Cvars[31]


public 
plugin_init()
{
    
register_plugin("Damage Control""1.01""Fxfighter")
    
    
RegisterHam(Ham_TakeDamage"player""hook_TakeDamage")
    
    
P_Cvars[0] = register_cvar("amx_dmg","1")
    
P_Cvars[1] = register_cvar("amx_dmg_grenade","6.0")
    
}
public 
hook_TakeDamage(VictimUselessAttackerFloat:damagedamagebitsdamage_type)
{
    new 
classname[32]
    
pev(Useless,pev_classname,classname,31)
        
    new 
Float:Dmg get_pcvar_float(P_Cvars[1])
    
    if(
get_pcvar_num(P_Cvars[0]) == || Dmg == 1.0 || !equal(classname,"grenade"))
        return 
HAM_IGNORED
        
    
// Get weapon's id
    
static weaponid
    weaponid 
get_user_weapon(Attacker)
    

        
    if(
Attacker == Victim || !zp_get_user_zombie(Victim)) SetHamParamFloat(4damage 0.00001)
    else 
    
SetHamParamFloat(4damage*Dmg)    
//If change to another weapons(have mutil damage *7) when throw grenade, grenade damage = //damage*dmg/7) How to fix?
    
    
return HAM_HANDLED

Thank so much!
__________________
Lucky888 is offline
Send a message via Yahoo to Lucky888
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 11-08-2013 , 05:14   Re: Damage he grenade mutil by another weapons?
Reply With Quote #2

Try this
PHP Code:
#include <amxmodx> 
#include <fakemeta> 
#include <hamsandwich> 
#include <zombieplague> 

new P_Cvars[31]

const 
DMG_HEGRENADE = (1<<24)

public 
plugin_init() 

    
register_plugin("Damage Control""1.01""Fxfighter"
    
    
RegisterHam(Ham_TakeDamage"player""hook_TakeDamage"
    
    
P_Cvars[0] = register_cvar("amx_dmg","1"
    
P_Cvars[1] = register_cvar("amx_dmg_grenade","6.0"
     

public 
hook_TakeDamage(VictimUselessAttackerFloat:damagedamagebitsdamage_type

    if(!
get_pcvar_num(P_Cvars[0])) 
        return 
HAM_HANDLED
        
    
if(damage_type DMG_HEGRENADE)
    {    
        if(
Victim == Attacker)
            return 
HAM_SUPERCEDE
        
        
new Float:Dmg get_pcvar_float(P_Cvars[1])
        
        if(
Dmg != 1.0)
            
SetHamParamFloat(4damage*Dmg)
    }
        
    return 
HAM_IGNORED

__________________
alan_el_more is offline
Lucky888
Senior Member
Join Date: Nov 2011
Location: Paradise
Old 11-10-2013 , 11:03   Re: Damage he grenade mutil by another weapons?
Reply With Quote #3

^
It's not work, but thanks you for your support.
Maybe it can fix without fw_takedamage.)( I guess) )
__________________
Lucky888 is offline
Send a message via Yahoo to Lucky888
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 23:19.


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