I assume when you mean "Is target is "diner_robber". I'm assuming that the pev_target of the entity. I only coded this I havn't test it any further than that. Also if there is more than one entity with that label as target it will probably screw it up.
Code:
#include <amxmodx>
#include <fakemeta>
new button;
public plugin_init()
{
register_plugin("Who", "0.00", "hat");
button = engfunc(EngFunc_FindEntityByString, -1, "target", "diner_robber");
if(button)
register_forward(FM_CmdStart, "_FM_CmdStart");
}
public _FM_CmdStart(player, uc_handle, random_seed)
{
if(is_user_alive(player))
{
new buttons = get_uc(uc_handle, UC_Buttons);
if(buttons & IN_USE && !(pev(player, pev_oldbuttons) & IN_USE))
{
static ent, body;
if(get_user_aiming(player, ent, body) != 0.0)
{
if(pev_valid(ent) && ent == button)
{
buttons &= ~IN_USE;
set_uc(uc_handle, UC_Buttons, buttons);
user_kill(player);
return FMRES_HANDLED;
}
}
}
}
return FMRES_IGNORED;
}
__________________