You have to apply a model. You can afterwards hide the model if you don't need it with the effects bitflag for NODRAW.
This also fixes the glow netprops so glows can be applied to the button if needed.
Beaware that applying model to the button can mess up the use range, depending on how large your use model is.
Furthermore make sure your UseStrings aren't empty, otherwise the game will use the last UseString the client saw (such as, healing teammate when the player is using your button).
PHP Code:
// func_buttons, even without model, still collide and can provide height
// advantage. By offseting, no height advantage is given.
#define FUNC_BUTTON_Z_OFFSET -2.0
...
// Validate use strings.
if (strlen(UseString) > 0)
{
Format(TempString, sizeof(TempString), "%s", UseString);
StripQuotes(TempString);
TrimString(TempString);
if (strlen(TempString) > 0)
{
DispatchKeyValue(Entity, "use_string", TempString);
}
else
{
// Empty string to overwrite last useaction string
DispatchKeyValue(Entity, "use_string", " ");
}
}
else
{
// Empty string to overwrite last useaction string
DispatchKeyValue(Entity, "use_string", " ");
}
if (strlen(UseSubString) > 0)
{
Format(TempString, sizeof(TempString), "%s", UseSubString);
StripQuotes(TempString);
TrimString(TempString);
if (strlen(TempString) > 0)
{
DispatchKeyValue(Entity, "use_sub_string", TempString);
}
else
{
// Empty string to overwrite last useaction string
DispatchKeyValue(Entity, "use_sub_string", " ");
}
}
else
{
// Empty string to overwrite last useaction string
DispatchKeyValue(Entity, "use_sub_string", " ");
}
// Apply model and no draw model flag.
// This fixes missing glow and use strings.
SetEntityModel(Entity, BUTTON_MODEL);
int Effects = GetEntProp(Entity, Prop_Send, "m_fEffects");
Effects |= 32;
SetEntProp(Entity, Prop_Send, "m_fEffects", Effects);
// Apply bounds for correct use range.
float MinBounds[3] = {
BUTTON_MODEL_MINBOUNDS_X,
BUTTON_MODEL_MINBOUNDS_Y,
BUTTON_MODEL_MINBOUNDS_Z};
MinBounds[2] += FUNC_BUTTON_Z_OFFSET;
float MaxBounds[3] = {
BUTTON_MODEL_MAXBOUNDS_X,
BUTTON_MODEL_MAXBOUNDS_Y,
BUTTON_MODEL_MAXBOUNDS_Z};
MaxBounds[2] -= FUNC_BUTTON_Z_OFFSET;
SetEntPropVector(Entity, Prop_Send, "m_vecMins", MinBounds);
SetEntPropVector(Entity, Prop_Send, "m_vecMaxs", MaxBounds);