From 396e6a98743cf46b7f6fb79db70bd46a49a01dca Mon Sep 17 00:00:00 2001 From: Vauff Date: Fri, 20 Oct 2023 21:28:03 -0400 Subject: [PATCH] Add !rcon/c_rcon --- src/adminsystem.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/adminsystem.cpp b/src/adminsystem.cpp index 84e331ac..ce6ddc8a 100644 --- a/src/adminsystem.cpp +++ b/src/adminsystem.cpp @@ -823,6 +823,30 @@ CON_COMMAND_CHAT(hsay, "say something as a hud hint") ClientPrintAll(HUD_PRINTCENTER, "%s", args.ArgS()); } +CON_COMMAND_CHAT(rcon, "send a command to server console") +{ + if (!player) + return; + + int iCommandPlayer = player->GetPlayerSlot(); + + ZEPlayer* pPlayer = g_playerManager->GetPlayer(iCommandPlayer); + + if (!pPlayer->IsAdminFlagSet(ADMFLAG_RCON)) + { + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "You don't have access to this command."); + return; + } + + if (args.ArgC() < 2) + { + ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX "Usage: !rcon "); + return; + } + + g_pEngineServer2->ServerCommand(args.ArgS()); +} + bool CAdminSystem::LoadAdmins() { m_vecAdmins.Purge();