AlliedModders

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

Mauricio Frb 07-21-2013 09:52

Ham_TakeDamage
 
I have a simple question,

Why this code works
Code:

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        RegisterHam(Ham_TakeDamage, "player", "ham_playertakedamage", 0);
}


public ham_playertakedamage(idvictim, idinflictor, idattacker, Float:damage, damagebits)
{
        SetHamReturnInteger(0);
        return HAM_SUPERCEDE;
}

and that's not
Code:

new HamHook:HamForward;

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        HamForward = RegisterHam(Ham_TakeDamage, "player", "ham_playertakedamage", 0);
       
        // End round event
        register_logevent("logevent_endround", 2, "1=Round_End");
}

public logevent_endround()
{
        EnableHamForward(HamForward);
}

public ham_playertakedamage(idvictim, idinflictor, idattacker, Float:damage, damagebits)
{
        SetHamReturnInteger(0);
        return HAM_SUPERCEDE;
}

I don't get the bug.

YamiKaitou 07-21-2013 10:43

Re: Ham_TakeDamage
 
The forward is enabled by default. If you want to use EnableHamForward, you must first disable the forward

Mauricio Frb 07-21-2013 11:08

Re: Ham_TakeDamage
 
I try
Code:

DisableHamForward(HamForward = RegisterHam(Ham_TakeDamage, "player", "ham_playertakedamage", 0));
But still not works.

YamiKaitou 07-21-2013 11:10

Re: Ham_TakeDamage
 
DisableHamForward(HamForward);

Mauricio Frb 07-21-2013 12:24

Re: Ham_TakeDamage
 
Yes I do this, but not work too.

Code:

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        HamForward = RegisterHam(Ham_TakeDamage, "player", "ham_playertakedamage", 0);
        DisableHamForward(HamForward);
       
        // End round event
        register_logevent("logevent_endround", 2, "1=Round_End");
}


Arkshine 07-21-2013 12:31

Re: Ham_TakeDamage
 
What is "not working" exactly ? You are unclear.

Mauricio Frb 07-21-2013 12:34

Re: Ham_TakeDamage
 
Let me explain: on 2º code the damage should be zero on round end.

Mauricio Frb 07-21-2013 13:05

Re: Ham_TakeDamage
 
Now it works lol, I must script something wrong, but thanks for the help!

mottzi 07-21-2013 15:11

Re: Ham_TakeDamage
 
You have to disable the forward on init and roundend. Then enable it on roundstart


All times are GMT -4. The time now is 06:25.

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