I am trying to set a bots (not sure if it makes a difference) knife entity render color to 0 (or another way to make it invisible).
I have tried the following:
Code:
CreateTimer(2.0, Timer_Alphaknife, client);
public Action Timer_Alphaknife(Handle timer, any client)
{
// Loop through array slots and set alpha.
// x = weapon slot.
for (int x = 0; x < 5; x++)
{
int weapons = GetPlayerWeaponSlot(client, x);
// If weapon is invalid, then stop.
if (weapons == -1)
{
continue;
}
if(!HasEntProp(weapons, Prop_Send, "m_nRenderMode"))
continue;
// Turn rendermode on, on the weapon.
SetEntityRenderMode(weapons, RENDER_TRANSALPHA);
// Set alpha value on the weapon.
SetEntityRenderColor(weapons, _, _, _, 0);
}
}
The above a timer delay after spawn to set the render color (thinking maybe the entity didn't exist yet or something)
Also:
Code:
int knife = GivePlayerItem(client, "weapon_knife", 0);
if (knife != -1)
{
PrintToServer("Knife entity %d",knife);
//SetEntityRenderMode(knife, RENDER_TRANSALPHA);
//SetEntityRenderColor(knife, 255, 255, 255, 0);
//SetEntData(knife, 127, 0, 4, true);
SetEntityRenderMode(knife, RENDER_TRANSALPHA);
SetEntityRenderColor(knife, _, _, _, 50);
//SetEntityRenderMode(knife, RENDER_TRANSCOLOR);
//SetEntityRenderColor(knife, 255, 255, 255, 0);
}
If I grab entities such as players the above code seems to work fine. The //commented out with transalpha method was what worked to begin with years ago and I'm working on getting the plugin working again. Anyone have any ideas on this?
Thank you!