This commit is contained in:
FutureRave 2022-05-11 20:06:29 +01:00
parent eea50d8add
commit 1799f98064
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
2 changed files with 36 additions and 7 deletions

View File

@ -1,11 +1,15 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game/game.hpp"
#include "game/dvars.hpp"
#include "game/scripting/entity.hpp"
#include "game/scripting/execution.hpp"
#include "command.hpp"
#include "console.hpp"
#include "game_console.hpp"
#include "scheduler.hpp"
#include <utils/hook.hpp>
#include <utils/string.hpp>
@ -576,10 +580,10 @@ namespace command
if (!cheats_ok(ent))
return;
ent->flags ^= 1;
ent->flags ^= game::FL_GODMODE;
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
utils::string::va("f \"godmode %s\"", ent->flags & 1 ? "^2on" : "^1off"));
utils::string::va("f \"godmode %s\"", (ent->flags & game::FL_GODMODE) ? "^2on" : "^1off"));
});
add_sv("demigod", [](game::mp::gentity_s* ent, const params_sv&)
@ -587,10 +591,10 @@ namespace command
if (!cheats_ok(ent))
return;
ent->flags ^= 2;
ent->flags ^= game::FL_DEMI_GODMODE;
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
utils::string::va("f \"demigod mode %s\"", ent->flags & 2 ? "^2on" : "^1off"));
utils::string::va("f \"demigod mode %s\"", (ent->flags & game::FL_DEMI_GODMODE) ? "^2on" : "^1off"));
});
add_sv("notarget", [](game::mp::gentity_s* ent, const params_sv&)
@ -598,10 +602,10 @@ namespace command
if (!cheats_ok(ent))
return;
ent->flags ^= 4;
ent->flags ^= game::FL_NOTARGET;
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
utils::string::va("f \"notarget %s\"", ent->flags & 4 ? "^2on" : "^1off"));
utils::string::va("f \"notarget %s\"", (ent->flags & game::FL_NOTARGET) ? "^2on" : "^1off"));
});
add_sv("noclip", [](game::mp::gentity_s* ent, const params_sv&)
@ -658,7 +662,7 @@ namespace command
if (params.size() < 2)
{
game::SV_GameSendServerCommand(ent->s.number, game::SV_CMD_RELIABLE,
"f \"You did not specify a weapon name\"");
"f \"You did not specify a weapon name\"");
return;
}
@ -669,6 +673,24 @@ namespace command
game::G_TakePlayerWeapon(ps, wp);
}
});
add_sv("kill", [](game::mp::gentity_s* ent, const params_sv& params)
{
if (!cheats_ok(ent))
return;
scheduler::once([ent]()
{
try
{
const auto player = scripting::call("getentbynum", {ent->s.number}).as<scripting::entity>();
player.call("suicide");
}
catch (...)
{
}
}, scheduler::pipeline::server);
});
}
};
}

View File

@ -1340,6 +1340,13 @@ namespace game
TRACE_HITTYPE_GLASS
};
enum entityFlag
{
FL_GODMODE = 1 << 0,
FL_DEMI_GODMODE = 1 << 1,
FL_NOTARGET = 1 << 2,
};
struct trace_t
{
char pad[0x29];