Maybe something like this could work:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public OnPluginStart()
{
FindAndHookButtons();
}
public OnMapStart()
{
FindAndHookButtons();
}
public FindAndHookButtons()
{
for(new entity = MaxClients;entity < GetMaxEntities();entity++)
{
if(IsValidEntity(entity) && IsValidEdict(entity))
{
decl String:className[128];
GetEntityClassname(entity, className, sizeof(className));
if(StrEqual(className, "func_button", false) || StrEqual(className, "func_rot_button", false) || StrEqual(className, "func_weight_button", false) || StrEqual(className, "momentary_rot_button", false))
{
SDKHook(entity, SDKHook_Use, UseButton);
}
}
}
}
public UseButton(button, client)
{
PrintToChatAll("%N used button %i", client, button);
}
Note: it's untested
__________________