Raised This Month: $120 Target: $400
 30% 

[CS:GO] Create glow around player.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-12-2018 , 17:55   [CS:GO] Create glow around player.
Reply With Quote #1

I'm trying a stock to create glow around player, but it creates another player which glows. If it was somehow possible to like make the glow's model invisible but the glow remain, it would probably work.

Code:
CreateGlow(client)
{
	new String:Model[PLATFORM_MAX_PATH];
	new Float:Origin[3], Float:Angles[3];

	// Get the original model path
	GetEntPropString(client, Prop_Data, "m_ModelName", Model, sizeof(Model));
	
	// Find the location of the player
	GetClientEyePosition(client, Origin);
	Origin[2] -= 75.0;
	GetClientEyeAngles(client, Angles);
	new GlowEnt = CreateEntityByName("prop_dynamic_glow");
	
	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);
		
	// Spawn and teleport the entity
	DispatchSpawn(GlowEnt);
	TeleportEntity(GlowEnt, Origin, Angles, NULL_VECTOR);

	// Give glowing effect to the entity
	SetEntProp(GlowEnt, Prop_Send, "m_bShouldGlow", true, true);
	SetEntPropFloat(GlowEnt, Prop_Send, "m_flGlowMaxDist", 69420.0);

	// Set glowing color
	SetVariantColor({255, 255, 255, 255});
	AcceptEntityInput(GlowEnt, "SetGlowColor");

	// Set the activator and group the entity
	SetVariantString("!activator");
	AcceptEntityInput(GlowEnt, "SetParent", client);
	
	AcceptEntityInput(GlowEnt, "TurnOn");

}
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.
eyal282 is offline
Vaggelis
Senior Member
Join Date: May 2017
Old 09-12-2018 , 18:18   Re: [CS:GO] Create glow around player.
Reply With Quote #2

Not my code, i cant remember from where i took it.
It also needs this plugin in order to work: https://forums.alliedmods.net/showthread.php?p=2140384
PHP Code:
SetGlow(clientrgbastyle)
{
    new 
String:szModel[PLATFORM_MAX_PATH]
    
GetClientModel(clientszModelsizeof(szModel))
    
    new 
skin CPS_SetSkin(clientszModelCPS_RENDER)
    
    if(
SDKHookEx(skinSDKHook_SetTransmitOnSetTransmit_GlowSkin))
    {
        new 
offset
        
        
if((offset GetEntSendPropOffs(skin"m_clrGlow")) != -1)
        {
            
SetEntProp(skinProp_Send"m_bShouldGlow"truetrue)
            
SetEntProp(skinProp_Send"m_nGlowStyle"style)
            
SetEntPropFloat(skinProp_Send"m_flGlowMaxDist"10000000.0)
            
            
SetEntData(skinoffsetr_true)
            
SetEntData(skinoffset 1g_true)
            
SetEntData(skinoffset 2b_true)
            
SetEntData(skinoffset 3a_true)
            
            
SetEntityRenderMode(skinRENDER_GLOW)
            
SetEntityRenderColor(skin255255255a)
            
            
SetEntityRenderMode(clientRENDER_GLOW)
            
SetEntityRenderColor(client255255255a)
        }
    }
}

public 
Action:OnSetTransmit_GlowSkin(skinclient)
{
    for(new 
1<= MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            if(!
CPS_HasSkin(i))
            {
                continue
            }
            
            if(
EntRefToEntIndex(CPS_GetSkin(i)) != skin)
            {
                continue
            }

            return 
Plugin_Continue
        
}
    }
    
    return 
Plugin_Handled

PHP Code:
RemoveGlow(client)
{
    if(
client && IsClientInGame(client))
    {
        new 
skin CPS_GetSkin(client)
        
        if(
skin != INVALID_ENT_REFERENCE)
        {
            
SetEntProp(skinProp_Send"m_bShouldGlow"falsetrue)
            
SDKUnhook(skinSDKHook_SetTransmitOnSetTransmit_GlowSkin)
        }
    }

Vaggelis is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 09-13-2018 , 00:01   Re: [CS:GO] Create glow around player.
Reply With Quote #3

Quote:
Originally Posted by Vaggelis View Post
Not my code, i cant remember from where i took it.
It also needs this plugin in order to work: https://forums.alliedmods.net/showthread.php?p=2140384
PHP Code:
public Action:OnSetTransmit_GlowSkin(skinclient)
{
    for(new 
1<= MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            if(!
CPS_HasSkin(i))
            {
                continue
            }
            
            if(
EntRefToEntIndex(CPS_GetSkin(i)) != skin)
            {
                continue
            }

            return 
Plugin_Continue
        
}
    }
    
    return 
Plugin_Handled

Looks like some of my code from my Admin ESP plugin, however the transmit is terrible for server performance. You can always set the owner of the prop_dynamic_glow and retrieve it within the transmit instead of looping every single player in the game.
__________________
Mitchell is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-13-2018 , 18:10   Re: [CS:GO] Create glow around player.
Reply With Quote #4

Quote:
Originally Posted by Mitchell View Post
Looks like some of my code from my Admin ESP plugin, however the transmit is terrible for server performance. You can always set the owner of the prop_dynamic_glow and retrieve it within the transmit instead of looping every single player in the game.
Code:
CreateGlow(client)
{
	ClientGlow[client] = 0;
	new String:Model[PLATFORM_MAX_PATH];
	new Float:Origin[3], Float:Angles[3];

	// Get the original model path
	GetEntPropString(client, Prop_Data, "m_ModelName", Model, sizeof(Model));
	
	// Find the location of the weapon
	GetClientEyePosition(client, Origin);
	Origin[2] -= 75.0;
	GetClientEyeAngles(client, Angles);
	new GlowEnt = CreateEntityByName("prop_dynamic_glow");
	
	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);
		
	// Spawn and teleport the entity
	DispatchSpawn(GlowEnt);
	
	new fEffects = GetEntProp(GlowEnt, Prop_Send, "m_fEffects");
	SetEntProp(GlowEnt, Prop_Send, "m_fEffects", fEffects|EF_BONEMERGE|EF_NOSHADOW|EF_NORECEIVESHADOW|EF_PARENT_ANIMATES);

	// 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
	SetVariantColor({255, 255, 255, 255});
	AcceptEntityInput(GlowEnt, "SetGlowColor");

	// Set the activator and group the entity
	SetVariantString("!activator");
	AcceptEntityInput(GlowEnt, "SetParent", client);
	
	SetVariantString("primary");
	AcceptEntityInput(GlowEnt, "SetParentAttachment", GlowEnt, GlowEnt, 0);
	
	AcceptEntityInput(GlowEnt, "TurnOn");
	
	SetEntPropEnt(GlowEnt, Prop_Send, "m_hOwnerEntity", client);
	
	SDKHook(GlowEnt, SDKHook_SetTransmit, Hook_ShouldSeeGlow);
	ClientGlow[client] = GlowEnt;

}
Works given HookShouldSeeGlow blocks seeing my own glow.
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.
eyal282 is offline
Reply


Thread Tools
Display Modes

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


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