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

Trying to pull property m_bGlowEnabled from object


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Galdabrast
New Member
Join Date: Apr 2024
Old 04-01-2024 , 11:01   Trying to pull property m_bGlowEnabled from object
Reply With Quote #1

Hi all,

I am new to scripting and have been having fun making some tfbot enablers for new maps.

I am trying to do pd_suijin, where periodically one set of signs glow, signalling the capture point is open.

I want to pull the property m_bGlowEnabled and return the index if it is true, however when I run this code, the script kind of just dies. I assume it is an error from GetEntProp, though it is annoying that there seems to be no way to safeguard it.

This is the code snippet, after many hours spent trying to debug why it dies. signEnt finds the correct value. targetname is "cap_a_sign1":

Code:
stock int FindTheGlow(const char[] targetname)
{
	int index = -1;
	int signEnt = FindEntityByTargetname(targetname, "prop_dynamic");
	int glowEffect = 0;
	ServerCommand("say Gloweffect %d", glowEffect);
	
	if(-1 != signEnt)
	{
		glowEffect = GetEntProp(signEnt, Prop_Data, "m_bGlowEnabled");
		index = signEnt;
	}
	return(index);
}
Any help would be appreciated, as the code dies uncermoniously right after attempting to assign glowEffect.
Galdabrast is offline
XGAK
Junior Member
Join Date: May 2018
Old 04-01-2024 , 12:57   Re: Trying to pull property m_bGlowEnabled from object
Reply With Quote #2

GetEntProp(signEnt, Prop_Data, "m_bGlowEnabled")
to
GetEntProp(signEnt, Prop_Send, "m_bGlowEnabled")
XGAK is offline
Galdabrast
New Member
Join Date: Apr 2024
Old 04-01-2024 , 15:12   Re: Trying to pull property m_bGlowEnabled from object
Reply With Quote #3

Darn, tried it and same effect. Thanks for answering though!

I updated my "debuggers" to look like this, trying with both bool and int for glowEffect:

Code:
stock int FindTheGlow(const char[] targetname)
{
	int index = -1;
	int signEnt = FindEntityByTargetname(targetname, "prop_dynamic");
	bool glowEffect = 0;
	ServerCommand("say SignEnt %d", signEnt);
	
	if(-1 != signEnt)
	{
		ServerCommand("say Testing for Glow");
		glowEffect = GetEntProp(signEnt, Prop_Send, "m_bGlowEnabled");
		ServerCommand("say Testing for Glow %d", glowEffect);
		index = signEnt;
	}
	return(index);
}
It just exits completely between "Testing for Glow" and "Testing for Glow %d"

Maybe I have the wrong property. It's whatever gives the effect from the attached photo.
Attached Thumbnails
Click image for larger version

Name:	example.jpg
Views:	38
Size:	35.0 KB
ID:	203975  

Last edited by Galdabrast; 04-01-2024 at 15:14. Reason: attach image
Galdabrast is offline
Galdabrast
New Member
Join Date: Apr 2024
Old 04-01-2024 , 15:56   Re: Trying to pull property m_bGlowEnabled from object
Reply With Quote #4

Ah! found the solution.

prop_dynamic doesn't even have m_bGlowEnabled. The offset table for GetPropData stops way before 1704, where it would be. It was a tf_glow effect that was added, which I can detect using
Code:
int tVal = GetEntProp(glowEffect, Prop_Send, "m_bDisabled");
Anyways, thanks for responding. I super appreciate it.
Galdabrast is offline
XGAK
Junior Member
Join Date: May 2018
Old 04-02-2024 , 22:46   Re: Trying to pull property m_bGlowEnabled from object
Reply With Quote #5

You could use HasEntProp to check if an entity property exist.
XGAK is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-03-2024 , 05:23   Re: Trying to pull property m_bGlowEnabled from object
Reply With Quote #6

Check error logs, would have probably told you the property doesn't exist.

You can use PrintToChatAll() or PrintToServer() instead of ServerCommand("say")
__________________
Silvers is offline
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 13:19.


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