2022-02-27 07:53:44 -05:00
|
|
|
#include <STDInclude.hpp>
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
2022-04-12 08:34:51 -04:00
|
|
|
std::unordered_map<std::string, std::function<void(Game::gentity_s*, Command::ServerParams*)>> ClientCommand::HandlersSV;
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
bool ClientCommand::CheatsOk(const Game::gentity_s* ent)
|
|
|
|
{
|
2021-12-09 12:49:47 -05:00
|
|
|
const auto entNum = ent->s.number;
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
if (!Dvar::Var("sv_cheats").get<bool>())
|
|
|
|
{
|
2021-12-09 12:49:47 -05:00
|
|
|
Logger::Print("CheatsOk: cheats are disabled!\n");
|
2021-12-09 07:01:37 -05:00
|
|
|
Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"GAME_CHEATSNOTENABLED\"", 0x65));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ent->health < 1)
|
|
|
|
{
|
2022-01-17 19:21:25 -05:00
|
|
|
Logger::Print("CheatsOk: entity %i must be alive to use this command!\n", entNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"GAME_MUSTBEALIVECOMMAND\"", 0x65));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
void ClientCommand::Add(const char* name, std::function<void(Game::gentity_s*, Command::ServerParams*)> callback)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
const auto command = Utils::String::ToLower(name);
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
ClientCommand::HandlersSV[command] = std::move(callback);
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ClientCommand::ClientCommandStub(const int clientNum)
|
|
|
|
{
|
2022-04-12 08:34:51 -04:00
|
|
|
const auto ent = &Game::g_entities[clientNum];
|
2021-12-09 07:01:37 -05:00
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
if (ent->client == nullptr)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
2021-12-09 12:49:47 -05:00
|
|
|
Logger::Print("ClientCommand: client %d is not fully in game yet\n", clientNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
Command::ServerParams params;
|
|
|
|
const auto command = Utils::String::ToLower(params.get(0));
|
2021-12-09 07:01:37 -05:00
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
if (const auto got = HandlersSV.find(command); got != HandlersSV.end())
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
2022-04-12 08:34:51 -04:00
|
|
|
got->second(ent, ¶ms);
|
|
|
|
return;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
2022-04-12 08:34:51 -04:00
|
|
|
|
|
|
|
Utils::Hook::Call<void(const int)>(0x416790)(clientNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ClientCommand::AddCheatCommands()
|
|
|
|
{
|
2022-04-12 08:34:51 -04:00
|
|
|
ClientCommand::Add("noclip", [](Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (!ClientCommand::CheatsOk(ent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ent->client->flags ^= Game::PLAYER_FLAG_NOCLIP;
|
|
|
|
|
2021-12-09 12:49:47 -05:00
|
|
|
const auto entNum = ent->s.number;
|
2022-01-17 19:21:25 -05:00
|
|
|
Logger::Print("Noclip toggled for entity %i\n", entNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65,
|
|
|
|
(ent->client->flags & Game::PLAYER_FLAG_NOCLIP) ? "GAME_NOCLIPON" : "GAME_NOCLIPOFF"));
|
|
|
|
});
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
ClientCommand::Add("ufo", [](Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (!ClientCommand::CheatsOk(ent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ent->client->flags ^= Game::PLAYER_FLAG_UFO;
|
|
|
|
|
2021-12-09 12:49:47 -05:00
|
|
|
const auto entNum = ent->s.number;
|
2022-01-17 19:21:25 -05:00
|
|
|
Logger::Print("UFO toggled for entity %i\n", entNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65,
|
|
|
|
(ent->client->flags & Game::PLAYER_FLAG_UFO) ? "GAME_UFOON" : "GAME_UFOOFF"));
|
|
|
|
});
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
ClientCommand::Add("god", [](Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (!ClientCommand::CheatsOk(ent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ent->flags ^= Game::FL_GODMODE;
|
|
|
|
|
2021-12-09 12:49:47 -05:00
|
|
|
const auto entNum = ent->s.number;
|
2022-01-17 19:21:25 -05:00
|
|
|
Logger::Print("God toggled for entity %i\n", entNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65,
|
|
|
|
(ent->flags & Game::FL_GODMODE) ? "GAME_GODMODE_ON" : "GAME_GODMODE_OFF"));
|
|
|
|
});
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
ClientCommand::Add("demigod", [](Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (!ClientCommand::CheatsOk(ent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ent->flags ^= Game::FL_DEMI_GODMODE;
|
|
|
|
|
2021-12-09 12:49:47 -05:00
|
|
|
const auto entNum = ent->s.number;
|
2022-01-17 19:21:25 -05:00
|
|
|
Logger::Print("Demigod toggled for entity %i\n", entNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65,
|
|
|
|
(ent->flags & Game::FL_DEMI_GODMODE) ? "GAME_DEMI_GODMODE_ON" : "GAME_DEMI_GODMODE_OFF"));
|
|
|
|
});
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
ClientCommand::Add("notarget", [](Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (!ClientCommand::CheatsOk(ent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ent->flags ^= Game::FL_NOTARGET;
|
|
|
|
|
2021-12-09 12:49:47 -05:00
|
|
|
const auto entNum = ent->s.number;
|
2022-01-17 19:21:25 -05:00
|
|
|
Logger::Print("Notarget toggled for entity %i\n", entNum);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
|
|
|
Game::SV_GameSendServerCommand(entNum, 0, Utils::String::VA("%c \"%s\"", 0x65,
|
|
|
|
(ent->flags & Game::FL_NOTARGET) ? "GAME_NOTARGETON" : "GAME_NOTARGETOFF"));
|
|
|
|
});
|
2022-01-10 07:04:39 -05:00
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
ClientCommand::Add("setviewpos", [](Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
2022-01-10 07:04:39 -05:00
|
|
|
{
|
|
|
|
assert(ent != nullptr);
|
|
|
|
|
|
|
|
if (!ClientCommand::CheatsOk(ent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
Game::vec3_t origin, angles{0.f, 0.f, 0.f};
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
if (params->size() < 4 || params->size() > 6)
|
2022-01-10 07:04:39 -05:00
|
|
|
{
|
|
|
|
Game::SV_GameSendServerCommand(ent->s.number, 0,
|
2022-01-11 13:53:20 -05:00
|
|
|
Utils::String::VA("%c \"GAME_USAGE\x15: setviewpos x y z [yaw] [pitch]\n\"", 0x65));
|
2022-01-10 07:04:39 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto i = 0; i < 3; i++)
|
|
|
|
{
|
2022-04-12 08:34:51 -04:00
|
|
|
origin[i] = std::strtof(params->get(i + 1), nullptr);
|
2022-01-10 07:04:39 -05:00
|
|
|
}
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
if (params->size() >= 5)
|
2022-01-10 07:04:39 -05:00
|
|
|
{
|
2022-04-12 08:34:51 -04:00
|
|
|
angles[1] = std::strtof(params->get(4), nullptr); // Yaw
|
2022-01-10 07:04:39 -05:00
|
|
|
}
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
if (params->size() == 6)
|
2022-01-10 07:04:39 -05:00
|
|
|
{
|
2022-04-12 08:34:51 -04:00
|
|
|
angles[0] = std::strtof(params->get(5), nullptr); // Pitch
|
2022-01-10 07:04:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Game::TeleportPlayer(ent, origin, angles);
|
|
|
|
});
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
|
2022-04-12 08:34:51 -04:00
|
|
|
void ClientCommand::AddDevelopmentCommands()
|
|
|
|
{
|
|
|
|
ClientCommand::Add("dropallbots", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
|
|
|
Game::SV_DropAllBots();
|
|
|
|
});
|
|
|
|
|
|
|
|
ClientCommand::Add("entitylist", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
|
|
|
Game::Svcmd_EntityList_f();
|
|
|
|
});
|
|
|
|
|
|
|
|
ClientCommand::Add("printentities", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
|
|
|
Game::G_PrintEntities();
|
|
|
|
});
|
|
|
|
|
|
|
|
ClientCommand::Add("entitycount", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
2022-04-15 06:16:12 -04:00
|
|
|
Logger::Print("Entity count = %i\n", Game::level->num_entities);
|
2022-04-12 08:34:51 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Also known as: "vis"
|
|
|
|
ClientCommand::Add("visionsetnaked", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
|
|
|
if (params->size() < 2)
|
|
|
|
{
|
|
|
|
Logger::Print("USAGE: visionSetNaked <name> <duration>\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto duration = 1000;
|
|
|
|
if (params->size() > 2)
|
|
|
|
{
|
|
|
|
const auto input = std::strtof(params->get(2), nullptr);
|
|
|
|
duration = static_cast<int>(std::floorf(input * 1000.0f + 0.5f));
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(ent->client != nullptr);
|
|
|
|
|
|
|
|
constexpr auto visMode = Game::visionSetMode_t::VISIONSET_NORMAL;
|
|
|
|
const auto* name = params->get(1);
|
|
|
|
|
|
|
|
ent->client->visionDuration[visMode] = duration;
|
|
|
|
strncpy_s(ent->client->visionName[visMode],
|
|
|
|
sizeof(Game::gclient_t::visionName[0]) / sizeof(char), name, _TRUNCATE);
|
|
|
|
|
|
|
|
Game::SV_GameSendServerCommand(ent->s.number, 1,
|
|
|
|
Utils::String::VA("%c \"%s\" %i", Game::MY_CMDS[visMode], name, duration));
|
|
|
|
});
|
|
|
|
|
|
|
|
ClientCommand::Add("visionsetnight", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
|
|
|
if (params->size() < 2)
|
|
|
|
{
|
|
|
|
Logger::Print("USAGE: visionSetNight <name> <duration>\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto duration = 1000;
|
|
|
|
if (params->size() > 2)
|
|
|
|
{
|
|
|
|
const auto input = std::strtof(params->get(2), nullptr);
|
|
|
|
duration = static_cast<int>(std::floorf(input * 1000.0f + 0.5f));
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(ent->client != nullptr);
|
|
|
|
|
|
|
|
constexpr auto visMode = Game::visionSetMode_t::VISIONSET_NIGHT;
|
|
|
|
const auto* name = params->get(1);
|
|
|
|
|
|
|
|
ent->client->visionDuration[visMode] = duration;
|
|
|
|
strncpy_s(ent->client->visionName[visMode],
|
|
|
|
sizeof(Game::gclient_t::visionName[0]) / sizeof(char), name, _TRUNCATE);
|
|
|
|
|
|
|
|
Game::SV_GameSendServerCommand(ent->s.number, 1,
|
|
|
|
Utils::String::VA("%c \"%s\" %i", Game::MY_CMDS[visMode], name, duration));
|
|
|
|
});
|
|
|
|
|
|
|
|
ClientCommand::Add("g_testCmd", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
|
|
|
assert(ent != nullptr);
|
2022-04-15 06:16:12 -04:00
|
|
|
ent->client->ps.stunTime = 1000 + Game::level->time; // 1000 is the default test stun time
|
2022-04-12 08:34:51 -04:00
|
|
|
});
|
2022-05-27 06:30:43 -04:00
|
|
|
|
|
|
|
ClientCommand::Add("kill", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params)
|
|
|
|
{
|
|
|
|
assert(ent->client != nullptr);
|
|
|
|
assert(ent->client->connected != Game::clientConnected_t::CON_DISCONNECTED);
|
|
|
|
|
|
|
|
if (ent->client->sessionState != Game::sessionState_t::SESS_STATE_PLAYING || !ClientCommand::CheatsOk(ent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
Scheduler::Once([ent]
|
|
|
|
{
|
|
|
|
ent->flags &= ~(Game::entityFlag::FL_GODMODE | Game::entityFlag::FL_DEMI_GODMODE);
|
|
|
|
ent->health = 0;
|
|
|
|
ent->client->ps.stats[0] = 0;
|
|
|
|
Game::player_die(ent, ent, ent, 100000, 12, 0, nullptr, Game::hitLocation_t::HITLOC_NONE, 0);
|
|
|
|
}, Scheduler::Pipeline::SERVER);
|
|
|
|
});
|
2022-04-12 08:34:51 -04:00
|
|
|
}
|
|
|
|
|
2021-12-09 07:01:37 -05:00
|
|
|
void ClientCommand::AddScriptFunctions()
|
|
|
|
{
|
2022-02-23 06:38:37 -05:00
|
|
|
Script::AddMethod("Noclip", [](Game::scr_entref_t entref) // gsc: Noclip(<optional int toggle>);
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
2022-02-25 07:17:57 -05:00
|
|
|
const auto* ent = Game::GetPlayerEntity(entref);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
2022-01-23 14:32:20 -05:00
|
|
|
if (Game::Scr_GetNumParam() >= 1u)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (Game::Scr_GetInt(0))
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->client->flags |= Game::PLAYER_FLAG_NOCLIP;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->client->flags &= ~Game::PLAYER_FLAG_NOCLIP;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->client->flags ^= Game::PLAYER_FLAG_NOCLIP;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-02-23 06:38:37 -05:00
|
|
|
Script::AddMethod("Ufo", [](Game::scr_entref_t entref) // gsc: Ufo(<optional int toggle>);
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
2022-02-25 07:17:57 -05:00
|
|
|
const auto* ent = Game::GetPlayerEntity(entref);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
2022-01-23 14:32:20 -05:00
|
|
|
if (Game::Scr_GetNumParam() >= 1u)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (Game::Scr_GetInt(0))
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->client->flags |= Game::PLAYER_FLAG_UFO;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->client->flags &= ~Game::PLAYER_FLAG_UFO;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->client->flags ^= Game::PLAYER_FLAG_UFO;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-02-23 06:38:37 -05:00
|
|
|
Script::AddMethod("God", [](Game::scr_entref_t entref) // gsc: God(<optional int toggle>);
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
2022-02-25 07:20:34 -05:00
|
|
|
auto* ent = Game::GetEntity(entref);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
2022-01-23 14:32:20 -05:00
|
|
|
if (Game::Scr_GetNumParam() >= 1u)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (Game::Scr_GetInt(0))
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags |= Game::FL_GODMODE;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags &= ~Game::FL_GODMODE;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags ^= Game::FL_GODMODE;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-02-23 06:38:37 -05:00
|
|
|
Script::AddMethod("Demigod", [](Game::scr_entref_t entref) // gsc: Demigod(<optional int toggle>);
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
2022-02-25 07:17:57 -05:00
|
|
|
auto* ent = Game::GetEntity(entref);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
2022-01-23 14:32:20 -05:00
|
|
|
if (Game::Scr_GetNumParam() >= 1u)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (Game::Scr_GetInt(0))
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags |= Game::FL_DEMI_GODMODE;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags &= ~Game::FL_DEMI_GODMODE;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags ^= Game::FL_DEMI_GODMODE;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-02-23 06:38:37 -05:00
|
|
|
Script::AddMethod("Notarget", [](Game::scr_entref_t entref) // gsc: Notarget(<optional int toggle>);
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
2022-02-25 07:17:57 -05:00
|
|
|
auto* ent = Game::GetEntity(entref);
|
2021-12-09 07:01:37 -05:00
|
|
|
|
2022-01-23 14:32:20 -05:00
|
|
|
if (Game::Scr_GetNumParam() >= 1u)
|
2021-12-09 07:01:37 -05:00
|
|
|
{
|
|
|
|
if (Game::Scr_GetInt(0))
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags |= Game::FL_NOTARGET;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags &= ~Game::FL_NOTARGET;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-07 16:00:44 -05:00
|
|
|
ent->flags ^= Game::FL_NOTARGET;
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
});
|
2022-04-12 08:34:51 -04:00
|
|
|
|
2022-05-04 07:44:45 -04:00
|
|
|
Script::AddFunction("DropAllBots", [] // gsc: DropAllBots();
|
2022-04-12 08:34:51 -04:00
|
|
|
{
|
|
|
|
Game::SV_DropAllBots();
|
|
|
|
});
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
ClientCommand::ClientCommand()
|
|
|
|
{
|
2021-12-09 12:49:47 -05:00
|
|
|
// Hook call to ClientCommand in SV_ExecuteClientCommand so we may add custom commands
|
2021-12-09 07:01:37 -05:00
|
|
|
Utils::Hook(0x6259FA, ClientCommand::ClientCommandStub, HOOK_CALL).install()->quick();
|
|
|
|
|
|
|
|
ClientCommand::AddCheatCommands();
|
|
|
|
ClientCommand::AddScriptFunctions();
|
2022-04-12 08:34:51 -04:00
|
|
|
#ifdef _DEBUG
|
|
|
|
ClientCommand::AddDevelopmentCommands();
|
|
|
|
#endif
|
2021-12-09 07:01:37 -05:00
|
|
|
}
|
|
|
|
}
|