CommandBuilder
CommandBuilder is a MetaHookSv plugin for Sven Co-op that provides an interactive control panel for constructing and executing engine and admin commands using dynamic macros and queue execution.
Concept
CommandBuilder combines an interactive player and preset browser with a live console bar. Selecting a player and command preset automatically evaluates dynamic macros (SteamID, player name, crosshair raycast coordinates) into a complete console command ready for instant execution or batch queuing.
Features
- Direct Mode: Selecting a player and preset populates the console command bar. Pressing ENTER or clicking Send executes the command directly in the game console.
- Batch Queue: Build multi-command sequences and dispatch them sequentially with 50ms intervals to prevent server rate limiting.
- Raycast Coordinates: Live 3D crosshair raycast tracing (
{aim}) calculates world impact coordinates (X Y Z).
- SteamID Conversion: Automatic math conversion of SteamID64 into SteamID2 (
STEAM_0:X:Y) and SteamID3 ([U:1:Z]) formats.
- JSON Configuration: Configurable command presets stored in
commandbuilder/presets.json.
Console Commands
| Command |
Description |
commandbuilder |
Open / close interface panel |
Keybind Example
bind "f6" "commandbuilder"
Macro Definitions
Macro names are case-insensitive.
Target Player Macros
{playername} — Target player name.
{steamid} — Target player SteamID2 (e.g. STEAM_0:1:123456).
{steamid64} — Target player 64-bit SteamID.
{steamid3} — Target player SteamID3 (e.g. [U:1:246912]).
{playernum} — Target player server slot index (1–32).
Local Player Macros
{me} — Local player name.
{mysteamid} — Local player SteamID2.
{myorigin} — Local player 3D origin (X Y Z).
Raycast & Coordinate Macros
{aim} — 3D world impact coordinates of crosshair raycast (X Y Z).
{aim_x}, {aim_y}, {aim_z} — Individual X, Y, Z components of raycast collision point.
{vec3}, {input} — Prompt user for custom input parameter via modal dialog.
System & Time Macros
{date}, {time} — Local date (YYYY-MM-DD) and time (HH:MM:SS).
{unixtime} — Current Unix timestamp.
Preset Configuration (presets.json)
Presets file is loaded using the following priority order:
svencoop_addon/commandbuilder/presets.json
svencoop/commandbuilder/presets.json
commandbuilder_presets.json (game root)
JSON Structure Example
{
"presets": [
{
"id": "tp_to_aim",
"label": "Teleport Player to Aim",
"category": "Teleport",
"template": "say !tp {playername} {aim}",
"perPlayer": true,
"description": "Teleports selected player to crosshair raycast location"
},
{
"id": "ban_5m",
"label": "Ban 5 Minutes",
"category": "Moderation",
"template": "amx_ban \"{steamid}\" 5 \"{input}\"",
"perPlayer": true,
"description": "Bans selected player by SteamID for 5 minutes with reason prompt"
}
]
}
Building
Build using Visual Studio targeting Win32 (x86) within MetaHookSv solution:
- Open MetaHookSv solution in Visual Studio.
- Select
Release or Debug (Win32).
- Build
CommandBuilder project.
评论