Code:
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_button"));
this should do it imo
and remove these lines
Code:
set_pev(ent, pev_classname, g_Classname);
engfunc(EngFunc_AllocString, "func_button");
and if you still can't get it working you can take a look at
this plugin, there's a functionality that lets you create buttons in there