100% untested!This plugin should allow you to "use" any entity (for example a button or a hostage) with the command
amx_use TARGETNAME where TARGETNAME is the name of the entity.
Example use: amx_use doorbellbtn
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define ADMIN_LEVEL ADMIN_LEVEL_A
public plugin_init() {
register_plugin("Use Entity", "1.0", "potatis_invalido");
register_clcmd("amx_use", "cmdUse", ADMIN_LEVEL, "amx_use TARGETNAME");
}
public cmdUse(id, level, cid) {
if(cmd_access(id, level, id, 1)) {
new nameArgumentValue[33];
if(read_argc() != 2 || read_argv(1, nameArgumentValue, (sizeof nameArgumentValue) - 1) < 1) {
console_print(id, "[amx_use] - Invalid number of arguments.");
} else {
new entityId = engfunc(EngFunc_FindEntityByString, -1, "targetname", nameArgumentValue);
if(!pev_valid(entityId)) {
console_print(id, "[amx_use] - Entity not found");
} else {
console_print(id, "[amx_use] - Using entity with ID number %i", entityId);
dllfunc(DLLFunc_Use, entityId, id);
}
}
}
return PLUGIN_HANDLED;
}
I don't have the time to install AMX Mod X right now. I hope it works!