Raised This Month: $ Target: $400
 0% 

Ham_TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mauricio Frb
Member
Join Date: Jul 2013
Old 07-21-2013 , 09:52   Ham_TakeDamage
Reply With Quote #1

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.
Mauricio Frb is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-21-2013 , 10:43   Re: Ham_TakeDamage
Reply With Quote #2

The forward is enabled by default. If you want to use EnableHamForward, you must first disable the forward
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Mauricio Frb
Member
Join Date: Jul 2013
Old 07-21-2013 , 11:08   Re: Ham_TakeDamage
Reply With Quote #3

I try
Code:
DisableHamForward(HamForward = RegisterHam(Ham_TakeDamage, "player", "ham_playertakedamage", 0));
But still not works.
Mauricio Frb is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-21-2013 , 11:10   Re: Ham_TakeDamage
Reply With Quote #4

DisableHamForward(HamForward);
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Mauricio Frb
Member
Join Date: Jul 2013
Old 07-21-2013 , 12:24   Re: Ham_TakeDamage
Reply With Quote #5

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");
}

Last edited by Mauricio Frb; 07-21-2013 at 12:25.
Mauricio Frb is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-21-2013 , 12:31   Re: Ham_TakeDamage
Reply With Quote #6

What is "not working" exactly ? You are unclear.
__________________
Arkshine is offline
Mauricio Frb
Member
Join Date: Jul 2013
Old 07-21-2013 , 12:34   Re: Ham_TakeDamage
Reply With Quote #7

Let me explain: on 2º code the damage should be zero on round end.
Mauricio Frb is offline
Mauricio Frb
Member
Join Date: Jul 2013
Old 07-21-2013 , 13:05   Re: Ham_TakeDamage
Reply With Quote #8

Now it works lol, I must script something wrong, but thanks for the help!
Mauricio Frb is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-21-2013 , 15:11   Re: Ham_TakeDamage
Reply With Quote #9

You have to disable the forward on init and roundend. Then enable it on roundstart
mottzi is offline
Send a message via MSN to mottzi
Reply



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 06:25.


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