Raised This Month: $ Target: $400
 0% 

RegisterHamFromEntity sends incorrectly


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-15-2009 , 04:01   RegisterHamFromEntity sends incorrectly
Reply With Quote #1

I have two plugins that use two different custom entities to think.

In the first code:
Code:
	new ent = fm_create_entity("info_target");
	set_pev(ent, pev_classname, "PPloop");
	RegisterHamFromEntity(Ham_Think, ent, "PartyLoop", 1);
	set_pev(ent, pev_nextthink, get_gametime()+1.0);
Second code:
Code:
		if( !pev_valid(hill) )
			hill = fm_create_entity("info_target");
		set_pev(hill, pev_classname, "PPHill");
		set_pev(hill, pev_iuser1, HILL_TIME);

		if( HamThink == HamHook:-1 )
			HamThink = RegisterHamFromEntity(Ham_Think, hill, "HillThink", 1);
		else
			EnableHamForward( HamThink );

		set_pev(hill, pev_nextthink, get_gametime()+1.0);
However, the second HamThink is being passed the entity from the first HamThink.
Code:
public HillThink( ent )
{
	if( ent != hill ){
		new name[32];
		pev(ent, pev_classname, name, 31);
		client_print(0, print_chat, "%d is a hill apparently. class %s", ent, name );
		return;
	}
	//...
}
It prints: 82 is a hill apparently. class PPloop

Obviously I can do a classname check to get around this problem, but IMO it should not be doing this.

Have I misinterpreted RegisterHamFromEntity, after changing the classname do I need a delay before RegisterHamFromEntity, or is it just whacky?
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
 



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 01:30.


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