Merge pull request #298 from diamante0018/develop

Vstr feature from IW6x
This commit is contained in:
Maurice Heumann 2021-12-27 09:47:02 +01:00 committed by GitHub
commit 36b11f260a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -393,6 +393,33 @@ namespace command
}, true);
}
});
add("vstr", [](const params& params)
{
if (params.size() < 2)
{
console::info("vstr <variablename> : execute a variable command\n");
return;
}
const auto* dvarName = params.get(1);
const auto* dvar = game::Dvar_FindVar(dvarName);
if (dvar == nullptr)
{
console::info("%s doesn't exist\n", dvarName);
return;
}
if (dvar->type != game::dvar_type::string
&& dvar->type != game::dvar_type::enumeration)
{
console::info("%s is not a string-based dvar\n", dvar->name);
return;
}
execute(dvar->current.string);
});
}
static void add_commands_sp()