Raised This Month: $ Target: $400
 0% 

Problem with Damage[attacker]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dogandcat
BANNED
Join Date: Jan 2009
Old 03-21-2009 , 10:54   Problem with Damage[attacker]
Reply With Quote #1

well, i cant put this to work.

Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>
#include <hamsandwich>

new const item_name[] = "Danio Fijado (175)"
new g_itemid_damage
new g_damageselection[33]
new cvar_bladedamage

public plugin_init() 
{
    register_plugin("[ZP] Damage Selection", "1.0", "MasI")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_clcmd("drop", "clcmd_drop")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    
    
    g_itemid_damage = zp_register_extra_item(item_name, 21, ZP_TEAM_HUMAN)
    cvar_bladedamage = register_cvar("zp_damage_selection", "175")
}

public zp_extra_item_selected(id,itemid)
{
    if(!is_user_alive(id))
    
    return PLUGIN_HANDLED;
    
    if(itemid==g_itemid_damage)
    {
        // Dont Drop
        g_damageselection[id] = true
        //hud
        new name[32]
        get_user_name(id, name, 31)
        set_hudmessage(0, 255, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
        show_hudmessage(0, "%s Se ah Comprado Damage !!!", name)
    }
    return PLUGIN_CONTINUE;
}

// Ham Take Damage Forward (inflictor = weapon)
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{

    if (g_damageselection[attacker])
    {    
        // Set nemesis damage
        SetHamParamFloat(4, get_pcvar_float(cvar_bladedamage))
        return HAM_IGNORED;
    }
    return HAM_SUPERCEDE;
}

public clcmd_drop(id)
{
    if (g_damageselection[id])
        return PLUGIN_HANDLED;
    
    return PLUGIN_CONTINUE;
}

public event_round_start()
{
    for (new player; player <= 32; player++) g_damageselection[player] = false;
}

Last edited by dogandcat; 03-21-2009 at 22:16. Reason: suggestion.
dogandcat is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-21-2009 , 11:45   Re: why it isnt working?damage.
Reply With Quote #2

Try changing the cvar to a float in the cvar register:
PHP Code:
cvar_bladedamage register_cvar("zp_damage_selection""175.0"

And replace HAM_IGNORED with HAM_OVERRIDE

PHP Code:
    if (g_damageselection[attacker])
    {    
        
// Set nemesis damage
        
SetHamParamFloat(4get_pcvar_float(cvar_bladedamage))
        return 
HAM_OVERRIDE;
    } 
The HAM_SUPERCEDE at the bottom should be HAM_IGNORED or else it will block all damage.
__________________
Bugsy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-21-2009 , 11:47   Re: why it isnt working?damage.
Reply With Quote #3

OVERRIDE is not needed because you change on the fly, it should be HANDLED.
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-21-2009 , 11:49   Re: why it isnt working?damage.
Reply With Quote #4

Quote:
Originally Posted by arkshine View Post
OVERRIDE is not needed because you change on the fly, it should be HANDLED.
I was referring to this thread... I now see you also advised HAM_HANDLED is ok to use in the thread as well. :-B

http://forums.alliedmods.net/showthread.php?t=86940
__________________
Bugsy is offline
dogandcat
BANNED
Join Date: Jan 2009
Old 03-21-2009 , 12:37   Re: why it isnt working?damage.
Reply With Quote #5

Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>
#include <hamsandwich>

new const item_name[] = "Danio Fijado (175)"
new g_itemid_damage
new g_damageselection[33]
new cvar_bladedamage

public plugin_init() 
{
    register_plugin("[ZP] Damage Selection", "1.0", "MasI")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_clcmd("drop", "clcmd_drop")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    
    
    g_itemid_damage = zp_register_extra_item(item_name, 21, ZP_TEAM_HUMAN)
    cvar_bladedamage  =  register_cvar("zp_damage_selection", "175.0")
}

public zp_extra_item_selected(id,itemid)
{
    if(!is_user_alive(id))
    
    return PLUGIN_HANDLED;
    
    if(itemid==g_itemid_damage)
    {
        // Dont Drop
        g_damageselection[id] = true
        //hud
        new name[32]
        get_user_name(id, name, 31)
        set_hudmessage(0, 255, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
        show_hudmessage(0, "%s Se ah Comprado Damage !!!", name)
    }
    return PLUGIN_CONTINUE;
}

// Ham Take Damage Forward (inflictor = weapon)
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{

    if (g_damageselection[attacker])
    {    
        // Set nemesis damage
        SetHamParamFloat(4, get_pcvar_float(cvar_bladedamage))
        return HAM_OVERRIDE;
    }
    return HAM_IGNORED;
}

public clcmd_drop(id)
{
    if (g_damageselection[id])
        return PLUGIN_HANDLED;
    
    return PLUGIN_CONTINUE;
}

public event_round_start()
{
    for (new player; player <= 32; player++) g_damageselection[player] = false;
}
not working.

Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>
#include <hamsandwich>

new const item_name[] = "Danio Fijado (175)"
new g_itemid_damage
new g_damageselection[33]
new cvar_bladedamage

public plugin_init() 
{
    register_plugin("[ZP] Damage Selection", "1.0", "MasI")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_clcmd("drop", "clcmd_drop")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    
    
    g_itemid_damage = zp_register_extra_item(item_name, 21, ZP_TEAM_HUMAN)
    cvar_bladedamage  =  register_cvar("zp_damage_selection", "175.0")
}

public zp_extra_item_selected(id,itemid)
{
    if(!is_user_alive(id))
    
    return PLUGIN_HANDLED;
    
    if(itemid==g_itemid_damage)
    {
        // Dont Drop
        g_damageselection[id] = true
        //hud
        new name[32]
        get_user_name(id, name, 31)
        set_hudmessage(0, 255, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
        show_hudmessage(0, "%s Se ah Comprado Damage !!!", name)
    }
    return PLUGIN_CONTINUE;
}

// Ham Take Damage Forward (inflictor = weapon)
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{

    if (g_damageselection[attacker])
    {    
        // Set nemesis damage
        SetHamParamFloat(4, get_pcvar_float(cvar_bladedamage))
        return HAM_HANDLED;
    }
    return HAM_IGNORED;
}

public clcmd_drop(id)
{
    if (g_damageselection[id])
        return PLUGIN_HANDLED;
    
    return PLUGIN_CONTINUE;
}

public event_round_start()
{
    for (new player; player <= 32; player++) g_damageselection[player] = false;
}
not working :S

Last edited by dogandcat; 03-21-2009 at 12:57.
dogandcat is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-21-2009 , 12:47   Re: why it isnt working?damage.
Reply With Quote #6

Try the Bugsy' suggestion. Replace HAM_IGNORE by HAM_HANDLED and HAM_SUPERCE by HAM_IGNORED.
Arkshine is offline
dogandcat
BANNED
Join Date: Jan 2009
Old 03-21-2009 , 12:58   Re: why it isnt working?damage.
Reply With Quote #7

lets see...
dogandcat is offline
dogandcat
BANNED
Join Date: Jan 2009
Old 03-21-2009 , 13:03   Re: why it isnt working?damage.
Reply With Quote #8

Code:
#include <amxmodx>
#include <fun>
#include <zombieplague>
#include <hamsandwich>

new const item_name[] = "Danio Fijado (XD)"
new g_itemid_damage
new g_damageselection[33]
new cvar_bladedamage

public plugin_init() 
{
    register_plugin("[ZP] Damage Selection", "1.0", "MasI")
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    register_clcmd("drop", "clcmd_drop")
    
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    
    
    g_itemid_damage = zp_register_extra_item(item_name, 21, ZP_TEAM_HUMAN)
    cvar_bladedamage  =  register_cvar("zp_damage_selection", "175.0")
}

public zp_extra_item_selected(id,itemid)
{
    if(!is_user_alive(id))
    
    return PLUGIN_HANDLED;
    
    if(itemid==g_itemid_damage)
    {
        // Dont Drop
        g_damageselection[id] = true
        //hud
        new name[32]
        get_user_name(id, name, 31)
        set_hudmessage(0, 255, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
        show_hudmessage(0, "%s Se ah Comprado Damage !!!", name)
    }
    return PLUGIN_CONTINUE;
}

// Ham Take Damage Forward (inflictor = weapon)
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{

    if (g_damageselection[attacker])
    {    
        // Set nemesis damage
        SetHamParamFloat(4, get_pcvar_float(cvar_bladedamage))
        return HAM_HANDLED;
    }
    return HAM_IGNORED;
}


public clcmd_drop(id)
{
    if (g_damageselection[id])
        return PLUGIN_HANDLED;
    
    return PLUGIN_CONTINUE;
}

public event_round_start()
{
    for (new player; player <= 32; player++) g_damageselection[player] = false;
}
Not working LOL
dogandcat is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-21-2009 , 14:01   Re: why it isnt working?damage.
Reply With Quote #9

I managed to get it to work by adding a multiplier of 2.0.

To test, go in your server and throw a nade and stand on it. It will only give 5 damage.

PHP Code:
new Float:g_fMultiplier 2.0;

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
SetHamParamFloat5.0 g_fMultiplier );
    return 
HAM_HANDLED;

__________________
Bugsy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-21-2009 , 18:24   Re: why it isnt working?damage.
Reply With Quote #10

Your topic's title must be descriptive. Fix it before posting again.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply


Thread Tools
Display Modes

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 09:02.


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