Raised This Month: $32 Target: $400
 8% 

Glow causes sometimes the glow to appear without ownership


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-29-2020 , 07:39   Glow causes sometimes the glow to appear without ownership
Reply With Quote #1

Sometimes a player sees a glow that stays in thin air. This only ever happens if I SetTransmit the glow and never once happened in the original plugin which transmits to all. How to solve it?

Code:
stock bool UC_CreateGlow(int client, int Color[3])
{
	UC_TryDestroyGlow(client);
	
	ClientGlow[client] = 0;
	char Model[PLATFORM_MAX_PATH];

	// Get the original model path
	GetEntPropString(client, Prop_Data, "m_ModelName", Model, sizeof(Model));
	
	int GlowEnt = CreateEntityByName("prop_dynamic");
		
	if(GlowEnt == -1)
		return false;
		
	
	DispatchKeyValue(GlowEnt, "model", Model);
	DispatchKeyValue(GlowEnt, "disablereceiveshadows", "1");
	DispatchKeyValue(GlowEnt, "disableshadows", "1");
	DispatchKeyValue(GlowEnt, "solid", "0");
	DispatchKeyValue(GlowEnt, "spawnflags", "256");
	DispatchKeyValue(GlowEnt, "renderamt", "0");
	SetEntProp(GlowEnt, Prop_Send, "m_CollisionGroup", 11);
	
	// Give glowing effect to the entity
	
	SetEntProp(GlowEnt, Prop_Send, "m_bShouldGlow", true, true);
	SetEntProp(GlowEnt, Prop_Send, "m_nGlowStyle", 1);
	SetEntPropFloat(GlowEnt, Prop_Send, "m_flGlowMaxDist", 10000.0);
	
	// Set glowing color
	
	int VariantColor[4];
		
	for(int i=0;i < 3;i++)
		VariantColor[i] = Color[i];
		
	VariantColor[3] = 76
	
	SetVariantColor(VariantColor);
	AcceptEntityInput(GlowEnt, "SetGlowColor");
	
	// Spawn and teleport the entity
	DispatchSpawn(GlowEnt);
	
	int fEffects = GetEntProp(GlowEnt, Prop_Send, "m_fEffects");
	SetEntProp(GlowEnt, Prop_Send, "m_fEffects", fEffects|EF_BONEMERGE|EF_NOSHADOW|EF_NORECEIVESHADOW|EF_PARENT_ANIMATES);
	
	// Set the activator and group the entity
	SetVariantString("!activator");
	AcceptEntityInput(GlowEnt, "SetParent", client);
	
	SetVariantString("primary");
	AcceptEntityInput(GlowEnt, "SetParentAttachment", GlowEnt, GlowEnt, 0);
	
	AcceptEntityInput(GlowEnt, "TurnOn");
	
	SetEntPropString(GlowEnt, Prop_Data, "m_iName", "ShopOnlyAWPGlow");
	SetEntPropEnt(GlowEnt, Prop_Send, "m_hOwnerEntity", client);
	
	SDKHook(GlowEnt, SDKHook_SetTransmit, Hook_ShouldSeeGlow);
	ClientGlow[client] = GlowEnt;
	
	return true;

}

public Action Hook_ShouldSeeGlow(int glow, int viewer)
{
	if(!IsValidEntity(glow))
	{
		SDKUnhook(glow, SDKHook_SetTransmit, Hook_ShouldSeeGlow);
		return Plugin_Continue;
	}
	
	int client = GetEntPropEnt(glow, Prop_Send, "m_hOwnerEntity");
	
	if(client == 0)
	{
		AcceptEntityInput(glow, "Kill");
		
		SDKUnhook(glow, SDKHook_SetTransmit, Hook_ShouldSeeGlow);
		
		return Plugin_Handled;
	}
	else if(client == viewer)
		return Plugin_Handled;
	
	else if(GetEntProp(viewer, Prop_Send, "m_iObserverMode") == OBSERVER_MODE_KILL_CAM)
		return Plugin_Handled;
		
	else if(!IsPlayerAlive(client))
		return Plugin_Handled;
		
	int ObserverTarget = GetEntPropEnt(viewer, Prop_Send, "m_hObserverTarget"); // This is the player the viewer is spectating. No need to check if it's invalid ( -1 )
	
	if(ObserverTarget == client)
		return Plugin_Handled;

	else if(GetClientTeam(client) == GetClientTeam(viewer))
		return Plugin_Handled;
	
	new Float:Origin[3];
	GetEntPropVector(client, Prop_Data, "m_vecOrigin", Origin);
	
	new Float:glowOrigin[3];
	GetEntPropVector(glow, Prop_Data, "m_vecOrigin", glowOrigin);
	
	return Plugin_Continue;
}

stock bool UC_TryDestroyGlow(int client)
{
	if(ClientGlow[client] != 0 && IsValidEntity(ClientGlow[client]))
	{
		AcceptEntityInput(ClientGlow[client], "TurnOff");
		AcceptEntityInput(ClientGlow[client], "Kill");
		ClientGlow[client] = 0;
		return true;
	}
	
	new ent = -1;
	
	// Just in case..
	while((ent = FindEntityByTargetname(ent, "ShopOnlyAWPGlow", false, false)) != -1)
	{
		if(GetEntPropEnt(ent, Prop_Send, "m_hOwnerEntity") == client)
		{
			AcceptEntityInput(ent, "TurnOff");
			AcceptEntityInput(ent, "Kill");
		}
	}
	return false;
}
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 08-31-2020 , 00:24   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #2

I have this problem too in L4D2
When I use SetTransmit to hide a model, the model gets invisible but I can see the model glowing at the 0,0,0 point of the Map (in case I forced the glow before SetTransmit).

I have found some similar reports in the forum, but seems that there is no solution.

Some said to use a Proxy extension but seems unsupported nowadays
__________________
Marttt is offline
FroGeX
Senior Member
Join Date: Aug 2020
Old 08-31-2020 , 05:18   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #3

This not have solution just dont hook SetTransmit on ents with parented glow or on glow...

Last edited by FroGeX; 08-31-2020 at 05:23.
FroGeX is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 08-31-2020 , 16:12   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #4

Wasn't helpful, the use of SetTransmit in my case, and I believe on eyal too, are necessary.
In L4D2 for e.g people love have their body glowing and change their skin (which makes the attachment necessary), but I have to hide it on 1st person (with SetTransmit), because since it's attached it appears often on the screen.
__________________
Marttt is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-09-2020 , 12:17   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #5

Quote:
Originally Posted by Marttt View Post
Wasn't helpful, the use of SetTransmit in my case, and I believe on eyal too, are necessary.
In L4D2 for e.g people love have their body glowing and change their skin (which makes the attachment necessary), but I have to hide it on 1st person (with SetTransmit), because since it's attached it appears often on the screen.
I have a game mode with player skins and all glowing players are your enemies.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 09-10-2020 , 08:34   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #6

sv_force_transmit_players 1
__________________
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
MasterMind420
BANNED
Join Date: Nov 2010
Old 09-10-2020 , 21:52   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #7

SetTransmit has nothing to do with this happening...if u manually set glows on the players this seems to be the issue. The only advice I can give is to very aggressively remove the glows when the player dies/disconnects...try using all the forwards for disconnect as well as the events...also test removing them during every think on the player when they die or disconnect...its the only way you might fix it. i created a glow plugin and do this which minimizes it happening. ive never tried using clearparent input which may work as well but who knows. Just some thoughts.

Last edited by MasterMind420; 09-10-2020 at 21:54.
MasterMind420 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 09-10-2020 , 22:54   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #8

L4D2. My issue only happens when I set the glow on a parented entity (like in Lux's LMC plugin) with SetTransmit making it invisible for me.
If you teleport/goes to the 0,0,0 point of the map you can see the model which has gone invisible glowing.
Im not the "pro" in SM coding but havent found any simple fix for that. All my attempts unfortunately failed.

Some reported the same here:
https://forums.alliedmods.net/showth...=280484&page=3
__________________

Last edited by Marttt; 09-10-2020 at 22:55.
Marttt is offline
FroGeX
Senior Member
Join Date: Aug 2020
Old 09-11-2020 , 12:50   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #9

Quote:
Originally Posted by _GamerX View Post
sv_force_transmit_players 1
This works for me too no more glows on 0,0,0
FroGeX is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 09-11-2020 , 20:42   Re: Glow causes sometimes the glow to appear without ownership
Reply With Quote #10

sv_force_transmit_players 1

This command, if set to 1 (enabled), will transmit data about every player to clients regardless of whether or not a player is visible to the client. This is by default set to 0, meaning you will only receive data about a player if they should be visible - this is a feature to prevent wall hacks,etc from seeing across the entire map.

Doing this can potentially open your server to wallhacks...also as far as I can tell it doesn't exist in L4D/L4D2.
MasterMind420 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 23:42.


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