Raised This Month: $51 Target: $400
 12% 

HookEntityOutput hooks not only specified entity classname


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-15-2020 , 07:42   HookEntityOutput hooks not only specified entity classname
Reply With Quote #1

The code below hooks OutValue of all math_counter entities:

Code:
public void OnPluginStart()
{
	HookEntityOutput("math_counter", "OutValue", OnDamageCounter);
}

public void OnDamageCounter(const char[] output, int caller, int activator, float delay)
{
	float flMaxParam = GetEntPropFloat(caller, Prop_Data, "m_flMax");
}
It works fine, but it appears that it also hooks trigger_multiple sometimes.

Quote:
L 05/15/2020 - 01:48:11: [SM] Exception reported: Property "m_flMax" not found (entity 259/trigger_multiple)
L 05/15/2020 - 01:48:11: [SM] Blaming: showdamage.smx
L 05/15/2020 - 01:48:11: [SM] Call stack trace:
L 05/15/2020 - 01:48:11: [SM] [0] GetEntPropFloat
L 05/15/2020 - 01:48:11: [SM] [1] Line 52, showdamage.sp::OnDamageCounter
how can I prevent that without comparing the classnames?

Last edited by kadet.89; 05-15-2020 at 07:42.
kadet.89 is offline
Send a message via Skype™ to kadet.89
 



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:34.


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