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_movetype, MOVETYPE_FOLLOW)
set_pev(g_entHat[id], pev_aiment, id)
set_pev(g_entHat[id], pev_renderfx, kRenderFxGlowShell)
set_pev(g_entHat[id], pev_renderamt, HAT_TRANSPARENCY)
updateType(id)
engfunc(EngFunc_SetModel, g_entHat[id], g_szHats[g_iHat[id] - 2])
entity_set_int(g_entHat[id], EV_INT_body, str_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_rendercolor, iColor)
}
public updateType(id)
set_pev(g_entHat[id], pev_rendermode, g_iColor[id][MODE] ? kRenderTransAlpha : kRenderNormal) // the variable is "1" when the hat should be transparent
stock fm_set_entity_visibility(index, visible = 1) set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)