AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Damage he grenade mutil by another weapons? (https://forums.alliedmods.net/showthread.php?t=229440)

Lucky888 11-08-2013 00:41

Damage he grenade mutil by another weapons?
 
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!

alan_el_more 11-08-2013 05:14

Re: Damage he grenade mutil by another weapons?
 
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



Lucky888 11-10-2013 11:03

Re: Damage he grenade mutil by another weapons?
 
^
It's not work, but thanks you for your support.
Maybe it can fix without fw_takedamage.)( I guess) :))


All times are GMT -4. The time now is 23:19.

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