basic sv_cheats
This commit is contained in:
parent
c7c27a1fa0
commit
590804506a
@ -6,6 +6,8 @@
|
|||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
|
static const game::native::dvar_t* g_cheats;
|
||||||
|
|
||||||
class client_command final : public module
|
class client_command final : public module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -13,14 +15,21 @@ public:
|
|||||||
{
|
{
|
||||||
if (game::is_mp())
|
if (game::is_mp())
|
||||||
{
|
{
|
||||||
|
g_cheats = game::native::Dvar_RegisterBool("sv_cheats", true, game::native::DVAR_CODINFO, "Enable cheats");
|
||||||
add_mp_client_commands();
|
add_mp_client_commands();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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)
|
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)
|
if (ent->health < 1)
|
||||||
{
|
{
|
||||||
game::native::mp::SV_GameSendServerCommand(ent->s.number, game::native::SV_CMD_CAN_IGNORE,
|
game::native::mp::SV_GameSendServerCommand(ent->s.number, game::native::SV_CMD_CAN_IGNORE,
|
||||||
|
@ -330,7 +330,7 @@ void command::add_sp_commands()
|
|||||||
assert(ent->s.eType == game::native::ET_PLAYER);
|
assert(ent->s.eType == game::native::ET_PLAYER);
|
||||||
assert(ent->client);
|
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)
|
if (params.size() < 4 || params.size() > 6)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user