AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_TakeDamage problem (https://forums.alliedmods.net/showthread.php?t=128892)

Backstabnoob 06-06-2010 15:41

Ham_TakeDamage problem
 
PHP Code:

public _Ham_TakeDamage(id,Inflictor,Attacker,Float:Damage,DamageBits)
{
    if(
get_pcvar_num(p_On) && is_user_alive(id) && is_user_alive(Attacker) && (g_Countdown[id] > || (g_Dueling[id] != Attacker && g_Dueling[id]) || (!g_Dueling[id] && g_Dueling[Attacker]) || (get_pcvar_num(p_OnlyDuel) && !g_Dueling[id] && !g_Dueling[Attacker])))
        
SetHamParamFloat(4,0.0)
    
    
    if(
g_Dueling[id] && g_Dueling[Attacker])
    {
        new 
health get_user_healthid )
        if ( (
health Damage) < )
        {
            
set_user_health(id1)
            
            
            new 
Other g_Dueling[id]
            
g_Dueling[id] = 0
            g_Dueling
[Other] = 0
            
            
new NameAtt[32], NameVic[32]
            
get_user_name(AttackerNameAtt31)
            
get_user_name(idNameVic31)
            
            
            
Render(id,0,Float:{255.0,255.0,255.0})
            
            
ForwardPlayerPostThink(id)
            
            new 
Health get_user_health(Attacker)
            
client_print(id,print_chat,"[ARP] %s te porazil v duelu s %d zbyvajicimi zivoty.",NameAtt,Health)
            
client_print(Attacker,print_chat,"[ARP] Porazil jsi %s se %d zbyvajicimi zivoty.",NameVic,Health)
            
            
client_cmd(Attacker"say /me porazil %s v duelu!"NameVic)
            
            
Render(Attacker,0,Float:{255.0,255.0,255.0})
    
        }
        
    }

return 
HAM_IGNORED


Why the code above always blocks any damage? I don't know how to work with returns in HamSandwich, but I think it's caused by them.

drekes 06-06-2010 16:16

Re: Ham_TakeDamage problem
 
this blocks all the damage done.
It changes the 4th parameter to 0.0, which in Float: Damage in this case
PHP Code:

SetHamParamFloat(4,0.0


Backstabnoob 06-06-2010 16:22

Re: Ham_TakeDamage problem
 
No, that if() is completely right and I'm pretty sure.

Backstabnoob 06-06-2010 16:35

Re: Ham_TakeDamage problem
 
fixed that already.

drekes 06-06-2010 16:44

Re: Ham_TakeDamage problem
 
I don't see anything else that could cause the problem


All times are GMT -4. The time now is 05:22.

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