mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Merge pull request #298 from diamante0018/develop
Vstr feature from IW6x
This commit is contained in:
commit
36b11f260a
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user