Raised This Month: $ Target: $400
 0% 

Forward TakeDamage Doesn´t work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-19-2010 , 10:40   Forward TakeDamage Doesn´t work
Reply With Quote #1

I´m making an extra item for Zombie Plague, but when I buy the extra item nothing happens, only show me the first client print

Full Code:
PHP Code:
#include <amxmodx> 
#include <amxmisc>
#include <zombieplague> 
#include <hamsandwich>

new g_thief
new boolthief_active[33]

public 
plugin_init()
{
    
    
register_plugin("[ZP] Extra Item: Ammo Packs Thief""1.0""S34Qu4K3"
    
g_thief zp_register_extra_item("Ammo Packs Thief"10ZP_TEAM_HUMAN
    
register_dictionary("zp_extra_ap_thief.txt")
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage"1)
    
}

public 
zp_extra_item_selected(iditemid
{
    if (
itemid == g_thief
    {

    
thief_active[id] = true
    client_print
(idprint_chat"In your next hit you will try to stole AmmoPacks from your victim")

    }
}  
public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type,id)
{
       
         if (
victim == attacker || ZP_TEAM_HUMAN)  
        return 
HAM_IGNORED
    
    
static damdam floatround(damage)
    
    new 
inflictorsap zp_get_user_ammo_packs(inflictor)
    new 
victimsap zp_get_user_ammo_packs(victim)
    
    
    if(
thief_active[id])
    {
        return 
HAM_IGNORED
    
}
    else
    {
        if(
dam <= 20)
        {
            if(
victimsap >= 1)
            {
                
zp_set_user_ammo_packs(victimvictimsap 1)
                
zp_set_user_ammo_packs(inflictorinflictorsap 1)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 40 && dam <= 59)
        {
            if(
victimsap >= 3)
            {
                
zp_set_user_ammo_packs(victimvictimsap 3)
                
zp_set_user_ammo_packs(inflictorinflictorsap 3)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 60 && dam <= 79)
        {
            if(
victimsap >= 5)
            {
                
zp_set_user_ammo_packs(victimvictimsap 5)
                
zp_set_user_ammo_packs(inflictorinflictorsap 5)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 80 && dam <= 99)
        {
            if(
victimsap >= 6)
            {
                
zp_set_user_ammo_packs(victimvictimsap 6)
                
zp_set_user_ammo_packs(inflictorinflictorsap 6)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 100 && dam <= 119)
        {
            if(
victimsap >= 8)
            {
                
zp_set_user_ammo_packs(victimvictimsap 8)
                
zp_set_user_ammo_packs(inflictorinflictorsap 8)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 120 && dam <= 149)
        {
            if(
victimsap >= 10)
            {
                
zp_set_user_ammo_packs(victimvictimsap 10)
                
zp_set_user_ammo_packs(inflictorinflictorsap 10)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 150 && dam <= 199)
        {
            if(
victimsap >= 10)
            {
                
zp_set_user_ammo_packs(victimvictimsap 12)
                
zp_set_user_ammo_packs(inflictorinflictorsap 12)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 200 && dam <= 499)
        {
            if(
victimsap >= 10)
            {
                
zp_set_user_ammo_packs(victimvictimsap 15)
                
zp_set_user_ammo_packs(inflictorinflictorsap 15)
            }
            else
            {
                
client_print(idprint_chat"You haven't steal anything ")
            }
        }
        
thief_active[id] = true
    
}
    return 
PLUGIN_CONTINUE
        

__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-19-2010 , 10:42   Re: Forward TakeDamage Doesn´t work
Reply With Quote #2

Remove the id param in fw_TakeDamage
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-19-2010 , 10:49   Re: Forward TakeDamage Doesn´t work
Reply With Quote #3

But, if i remove the param, i cant compile, undefined symbol in
PHP Code:
if(thief_active[id]) 
&
PHP Code:
client_print(id,.... 

SHould I use attacker instead of id ?
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-19-2010 , 10:58   Re: Forward TakeDamage Doesn´t work
Reply With Quote #4

The last param is the damageBits, nothing to do with the victim's index which is the first param...
__________________
Arkshine is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-19-2010 , 11:12   Re: Forward TakeDamage Doesn´t work
Reply With Quote #5

We, i don´t understand you Arkshine, i´ve use bad the forward?

I tyried to put attacker instead of id and doesn´t work T_T
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-19-2010 , 13:19   Re: Forward TakeDamage Doesn´t work
Reply With Quote #6

Remove id from the forward param list. Replace id with victim in the forward code.
__________________
Bugsy is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-19-2010 , 13:29   Re: Forward TakeDamage Doesn´t work
Reply With Quote #7

Doesn´t work

PHP Code:

#include <amxmodx> 
#include <amxmisc>
#include <zombieplague> 
#include <hamsandwich>

new g_thief
new boolthief_active[33]

public 
plugin_init()
{
    
    
register_plugin("[ZP] Extra Item: Ammo Packs Thief""1.0""S34Qu4K3"
    
g_thief zp_register_extra_item("Ammo Packs Thief"10ZP_TEAM_HUMAN
    
register_dictionary("zp_extra_ap_thief.txt")
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage"1)
    
}

public 
zp_extra_item_selected(iditemid
{
    if (
itemid == g_thief
    {

    
thief_active[id] = true
    client_print
(idprint_chat"In your next hit you will try to stole AmmoPacks from your victim")

    }
}  
public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
       
         if (
victim == attacker || ZP_TEAM_HUMAN)  
        return 
HAM_IGNORED
    
    
static damdam floatround(damage)
    
    new 
inflictorsap zp_get_user_ammo_packs(inflictor)
    new 
victimsap zp_get_user_ammo_packs(victim)
    
    
    if(
thief_active[victim])
    {
        return 
HAM_IGNORED
    
}
    else
    {
        if(
dam <= 20)
        {
            if(
victimsap >= 1)
            {
                
zp_set_user_ammo_packs(victimvictimsap 1)
                
zp_set_user_ammo_packs(inflictorinflictorsap 1)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 40 && dam <= 59)
        {
            if(
victimsap >= 3)
            {
                
zp_set_user_ammo_packs(victimvictimsap 3)
                
zp_set_user_ammo_packs(inflictorinflictorsap 3)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 60 && dam <= 79)
        {
            if(
victimsap >= 5)
            {
                
zp_set_user_ammo_packs(victimvictimsap 5)
                
zp_set_user_ammo_packs(inflictorinflictorsap 5)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 80 && dam <= 99)
        {
            if(
victimsap >= 6)
            {
                
zp_set_user_ammo_packs(victimvictimsap 6)
                
zp_set_user_ammo_packs(inflictorinflictorsap 6)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 100 && dam <= 119)
        {
            if(
victimsap >= 8)
            {
                
zp_set_user_ammo_packs(victimvictimsap 8)
                
zp_set_user_ammo_packs(inflictorinflictorsap 8)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 120 && dam <= 149)
        {
            if(
victimsap >= 10)
            {
                
zp_set_user_ammo_packs(victimvictimsap 10)
                
zp_set_user_ammo_packs(inflictorinflictorsap 10)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 150 && dam <= 199)
        {
            if(
victimsap >= 10)
            {
                
zp_set_user_ammo_packs(victimvictimsap 12)
                
zp_set_user_ammo_packs(inflictorinflictorsap 12)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        else if(
dam >= 200 && dam <= 499)
        {
            if(
victimsap >= 10)
            {
                
zp_set_user_ammo_packs(victimvictimsap 15)
                
zp_set_user_ammo_packs(inflictorinflictorsap 15)
            }
            else
            {
                
client_print(victimprint_chat"You haven't steal anything ")
            }
        }
        
thief_active[victim] = false
    
}
    return 
PLUGIN_CONTINUE
        

__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 08-19-2010 , 17:37   Re: Forward TakeDamage Doesn´t work
Reply With Quote #8

PHP Code:
if (victim == attacker || !zp_get_user_zombie(attacker))  
        return 
HAM_IGNORED 
and replace inflictor -> attacker
__________________
alan_el_more 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 21:59.


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