RCON client improvement

Use 3rd argument as password instead of 'rcon_password' ConVar if arg count is > 2.
This commit is contained in:
Kawe Mazidjatari 2022-06-13 01:03:36 +02:00
parent 723976d9cb
commit 27eae42b10
2 changed files with 9 additions and 2 deletions

View File

@ -8,7 +8,6 @@ enum class PaintMode_t
PAINT_INGAMEPANELS = (1 << 1),
};
class CEngineVGui
{
public:

View File

@ -764,7 +764,15 @@ void RCON_CmdQuery_f(const CCommand& args)
{
if (strcmp(args.Arg(1), "PASS") == 0) // Auth with RCON server using rcon_password ConVar value.
{
string svCmdQuery = g_pRConClient->Serialize(rcon_password->GetString(), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
string svCmdQuery;
if (args.ArgC() > 2)
{
svCmdQuery = g_pRConClient->Serialize(args.Arg(2), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
}
else // Use 'rcon_password' ConVar as password.
{
svCmdQuery = g_pRConClient->Serialize(rcon_password->GetString(), "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
}
g_pRConClient->Send(svCmdQuery);
return;
}