Raised This Month: $ Target: $400
 0% 

Hat is invisible to others players when I use "kRenderTransAlpha"


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-23-2016 , 16:17   Hat is invisible to others players when I use "kRenderTransAlpha"
Reply With Quote #1

So, I made a completely new plugin for hats and I added an option to change between two hat glow types: normal and transparent. When the hat glow is set to "normal", there are no problems with it, but when it's set to "transparent", the hat is completely invisible to other players. Only the player who uses it can see it (using /cam plugin). Here's what I'm talking about:



(Both players on the picture have the same hat and as you can see, only I can see my hat, and only the other player can see his hat (well you can't actually see that).)

This is how I add the hat and set its transparency:

PHP Code:
#define HAT_TRANSPARENCY 10.0

g_entHat[id] = create_entity("info_target")
set_pev(g_entHat[id], pev_movetypeMOVETYPE_FOLLOW)
set_pev(g_entHat[id], pev_aimentid)
set_pev(g_entHat[id], pev_renderfxkRenderFxGlowShell)
set_pev(g_entHat[id], pev_renderamtHAT_TRANSPARENCY)
updateType(id)

engfunc(EngFunc_SetModelg_entHat[id], g_szHats[g_iHat[id] - 2])
entity_set_int(g_entHat[id], EV_INT_bodystr_to_num(g_szHats[g_iHat[id] - 1]))
fm_set_entity_visibility(g_entHat[id], 1)
updateColor(id)

public 
updateColor(id)
{
    new 
Float:iColor[3]
    
iColor[0] = float(g_iColor[id][RED])
    
iColor[1] = float(g_iColor[id][GREEN])
    
iColor[2] = float(g_iColor[id][BLUE])
    
set_pev(g_entHat[id], pev_rendercoloriColor)
}

public 
updateType(id)
    
set_pev(g_entHat[id], pev_rendermodeg_iColor[id][MODE] ? kRenderTransAlpha kRenderNormal// the variable is "1" when the hat should be transparent

stock fm_set_entity_visibility(indexvisible 1set_pev(indexpev_effectsvisible == pev(indexpev_effects) & ~EF_NODRAW pev(indexpev_effects) | EF_NODRAW

Last edited by OciXCrom; 01-23-2016 at 16:18.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
 



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 09:25.


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