SourceMod plugin that sends entity inputs to existing map entities (edicts).
Current version: 1.2.0. See CHANGELOG.md for the complete version history.
Repository: Sourcemod-Trigger-Mapentity.
Admins can list and trigger map entities using console commands, for example to open a jail door, toggle a laser barrier, or press a button. This is especially useful for jail servers. Access can be restricted to players, the server console/RCON, or both. Counter-Strike also supports team restrictions.
- A current stable version of SourceMod.
- Updater plugin (optional, for automatic updates).
The bundled scripting/include/updater.inc is required for compilation even if the Updater plugin is not installed.
Copy plugins/trigger_mapentity.smx to addons/sourcemod/plugins/ and load or reload the plugin. The configuration file is generated at cfg/sourcemod/plugin.trigger_mapentity.cfg.
All commands require admin flag o (ADMFLAG_CUSTOM1).
sm_trigger_mapentity <class> <name> <input>
sm_trigger_mapentity_id <id> <input>
sm_trigger_mapentity_list
Examples:
sm_trigger_mapentity func_door "main door" Open
sm_trigger_mapentity_id 123 Open
sm_trigger_mapentity func_button Button_Lighton Press
The last example presses a button of class func_button with the target name Button_Lighton.
Class matching uses a case-insensitive substring, preserving the original behavior. The target name must match exactly. Names containing spaces must be quoted. All matching entities receive the input; the response indicates whether the engine accepted it. Inputs requiring additional values or parameters are not supported. Searches and listings cover networked entities (edicts).
| ConVar | Default | Description |
|---|---|---|
sm_trigger_mapentity_version |
1.2.0 |
Displays the plugin version |
sm_trigger_mapentity_enable |
1 |
Enables all three commands |
sm_trigger_mapentity_access |
1 |
1 = in game, 2 = server console/RCON, 3 = both |
sm_trigger_mapentity_access_cs |
15 |
CS team mask: 1 = unassigned, 2 = spectators, 4 = T, 8 = CT; 12 = T and CT |
The team mask applies only to cstrike and csgo. Settings are read each time a command runs. For RCON access, set sm_trigger_mapentity_access to 2 or 3; this also applies to the list command.
Run from this directory using the shared SourceMod compiler:
mkdir -p plugins
../../../spcomp64 scripting/trigger_mapentity.sp -iscripting/include -i../../../include -oplugins/trigger_mapentity.smxFor a standalone checkout, adjust the compiler and standard include paths to your SourceMod installation. On Windows, use spcomp64.exe. The bundled updater.inc is in scripting/include; the Updater plugin is optional at runtime. The existing update URL has been preserved; its availability and the version it distributes have not been verified.
Compiled with SourcePawn 1.12.0.7253 without errors or warnings. Runtime testing on the game server is still pending. Check an entity with a high ID, a long target name, missing arguments, invalid IDs, and access from both the game and RCON. An unknown input should produce a rejected response.
scripting/trigger_mapentity.sp
scripting/include/updater.inc
plugins/trigger_mapentity.smx (local build, excluded from Git)
A corrected copy also remains at ../trigger_mapentity.sp to preserve the previous working file path. Make future changes in scripting/trigger_mapentity.sp; the two files are not synchronized automatically.
The source does not declare a license.
Thanks to Monkeys and rcarm. Thanks to SHAREN for reporting the invalid classname issue fixed in version 1.1.0.
The current version is 1.2.0. Changes in this version and the historical releases from the original forum post are documented in the Changelog.