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

SetEntityRenderColor resets Entity Render Mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Byte
Senior Member
Join Date: Jun 2010
Location: 📦 CCSPlayer
Old 01-19-2017 , 09:03   SetEntityRenderColor resets Entity Render Mode
Reply With Quote #1

I have an entity which is parented to a client and moves with them.

Then I set the entities render mode to none:
Code:
SetEntityRenderMode(entity, RENDER_NONE);
The entity then becomes invisible, however, whenever the client is frozen (i.e. using sm_freeze), the render mode seems to be 'lost' on the entity and it is visible again:

I found out its actually do to:
Code:
SetEntityRenderColor(client, r, g, b, a)
Whenever that is called on the client, the entity becomes visible again.

I tried making a test function thinking the call reset the render mode but it did not work (nop):

Code:
void test(int client, int entity) {
  SetEntityRenderColor(client, 0, 0, 0, 0)
  SetEntityRenderMode(entity, RENDER_NONE);
}
Only thing that works is recreating the entity which I'd prefer to avoid. Even then I'd need to hook SetEntityRenderColor calls somehow (or monitor each clients render color with a timer) which i'd like to avoid. Anybody have any ideas whats going on?

Thanks
__________________
STEAM: /id/invexbyte | Github: Mo Beigi | Discord: Byte#0017
Community: Invex Gaming | My Plugins: Click Me!


Last edited by Byte; 01-19-2017 at 09:04.
Byte is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 01-19-2017 , 10:55   Re: SetEntityRenderColor resets Entity Render Mode
Reply With Quote #2

SDKHooks SetTransmit works nicely for exactly this, hook the entity and return Plugin_Handled the entity from within SeTransmit Hook...Invisible Entity
MasterMind420 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-19-2017 , 11:19   Re: SetEntityRenderColor resets Entity Render Mode
Reply With Quote #3

Quote:
Originally Posted by MasterMind420 View Post
SDKHooks SetTransmit works nicely for exactly this, hook the entity and return Plugin_Handled the entity from within SeTransmit Hook...Invisible Entity
It's not really invisible.. it's net properties are just not transmitted to the clients which means it will still show up at 0, 0, 0.
Mitchell is offline
Byte
Senior Member
Join Date: Jun 2010
Location: 📦 CCSPlayer
Old 01-19-2017 , 17:17   Re: SetEntityRenderColor resets Entity Render Mode
Reply With Quote #4

Quote:
Originally Posted by MasterMind420 View Post
SDKHooks SetTransmit works nicely for exactly this, hook the entity and return Plugin_Handled the entity from within SeTransmit Hook...Invisible Entity
Unfortunately that does not work. I'll make a demo plugin later to demonstrate.

What is the best way of detecting SetEntityRenderColor changes on a client?
I could use a timer and monitor 'm_clrRender' but is there a cleaner method?
__________________
STEAM: /id/invexbyte | Github: Mo Beigi | Discord: Byte#0017
Community: Invex Gaming | My Plugins: Click Me!

Byte is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 01-20-2017 , 08:28   Re: SetEntityRenderColor resets Entity Render Mode
Reply With Quote #5

Why not SetEntityRenderMode(entity, RENDER_TRANSCOLOR); ?
cravenge is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-20-2017 , 17:04   Re: SetEntityRenderColor resets Entity Render Mode
Reply With Quote #6

Quote:
Originally Posted by InvexByte View Post
The entity then becomes invisible, however, whenever the client is frozen (i.e. using sm_freeze), the render mode seems to be 'lost' on the entity and it is visible again:
Your problem is that those commands like freeze are likely resetting the render mode explicitly... Thst is expected behavior, just set the render mode each time.
In the rare case that the netprop is not updated, you can use changeedictstate...
https://sm.alliedmods.net/api/index....ad=show&id=67&
You can look up the offset for prop/player/whatever:rendermode likely.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Alienmario
Senior Member
Join Date: Aug 2013
Old 01-21-2017 , 13:14   Re: SetEntityRenderColor resets Entity Render Mode
Reply With Quote #7

Another way to make entities invisible is the nodraw flag
PHP Code:
stock void setVisible(int entbool visible){
    
#define EF_NODRAW 32
    
int effects GetEntProp(entProp_Send"m_fEffects"); 
    if(!
visible) {
        
effects |= EF_NODRAW
    } else    {
        
effects &= ~EF_NODRAW;
    }
    
SetEntProp(entProp_Send"m_fEffects"effects); 

Alienmario is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-21-2017 , 19:23   Re: SetEntityRenderColor resets Entity Render Mode
Reply With Quote #8

Nodraw in many cases will cause patented entities to detach and hang at some random unspecified location
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram 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 06:40.


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