Fix rcon not working properly on party servers

This commit is contained in:
rackover 2021-07-04 20:28:23 +02:00
parent ee04b3e07d
commit 2ad1d4a682
2 changed files with 7 additions and 5 deletions

View File

@ -121,7 +121,7 @@ namespace Components
} }
bool Network::Address::isValid() bool Network::Address::isValid()
{ {
return (this->getType() != Game::netadrtype_t::NA_BAD && this->getType() >= Game::netadrtype_t::NA_BOT && this->getType() <= Game::netadrtype_t::NA_IP); return (this->getType() != Game::netadrtype_t::NA_BAD && this->getType() >= Game::netadrtype_t::NA_BOT && this->getType() <= Game::netadrtype_t::NA_IP && this->address.ip.full != 0);
} }
void Network::Handle(const std::string& packet, Utils::Slot<Network::Callback> callback) void Network::Handle(const std::string& packet, Utils::Slot<Network::Callback> callback)
{ {

View File

@ -25,9 +25,13 @@ namespace Components
} }
else else
{ {
if (!RCon::Password.empty() && *reinterpret_cast<int*>(0xB2C540) >= 5) // Get our state auto addr = reinterpret_cast<Game::netadr_t*>(0xA5EA44);
if (!RCon::Password.empty())
{ {
Network::Address target(reinterpret_cast<Game::netadr_t*>(0xA5EA44)); Network::Address target(addr);
if (!target.isValid()) {
target = Party::Target();
}
if (target.isValid()) if (target.isValid())
{ {
@ -107,9 +111,7 @@ namespace Components
static std::string outputBuffer; static std::string outputBuffer;
outputBuffer.clear(); outputBuffer.clear();
#ifdef DEBUG
Logger::Print("Executing RCon request from %s: %s\n", address.getCString(), command.data()); Logger::Print("Executing RCon request from %s: %s\n", address.getCString(), command.data());
#endif
Logger::PipeOutput([](const std::string& output) Logger::PipeOutput([](const std::string& output)
{ {