basic sv_cheats

This commit is contained in:
Diavolo 2022-08-11 23:13:04 +02:00
parent c7c27a1fa0
commit 590804506a
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
2 changed files with 11 additions and 2 deletions

View File

@ -6,6 +6,8 @@
#include "command.hpp"
#include "scheduler.hpp"
static const game::native::dvar_t* g_cheats;
class client_command final : public module
{
public:
@ -13,14 +15,21 @@ public:
{
if (game::is_mp())
{
g_cheats = game::native::Dvar_RegisterBool("sv_cheats", true, game::native::DVAR_CODINFO, "Enable cheats");
add_mp_client_commands();
}
}
private:
// I know this is supposed to check sv_cheats but it's not even a registered dvar so why bother
static bool cheats_ok(game::native::gentity_s* ent)
{
if (!g_cheats->current.enabled)
{
game::native::mp::SV_GameSendServerCommand(ent->s.number, game::native::SV_CMD_CAN_IGNORE,
utils::string::va("%c \"GAME_CHEATSNOTENABLED\"", 0x65));
return false;
}
if (ent->health < 1)
{
game::native::mp::SV_GameSendServerCommand(ent->s.number, game::native::SV_CMD_CAN_IGNORE,

View File

@ -330,7 +330,7 @@ void command::add_sp_commands()
assert(ent->s.eType == game::native::ET_PLAYER);
assert(ent->client);
game::native::vec3_t origin, angles{ 0.f, 0.f, 0.f };
game::native::vec3_t origin, angles{0.f, 0.f, 0.f};
if (params.size() < 4 || params.size() > 6)
{