[ClientCommand] Make kill always avaiable (with cheats on) (#451)
* [ClientCommand] Make kill always avaiable (with cheats on) * Update ClientCommand.cpp
This commit is contained in:
parent
c9eaea47f2
commit
a3776f34c7
@ -242,6 +242,23 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ClientCommand::Add("kill", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] const Command::ServerParams* params)
|
||||||
|
{
|
||||||
|
assert(ent->client != nullptr);
|
||||||
|
assert(ent->client->sess.connected != Game::CON_DISCONNECTED);
|
||||||
|
|
||||||
|
if (ent->client->sess.sessionState != Game::SESS_STATE_PLAYING || !ClientCommand::CheatsOk(ent))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Scheduler::Once([ent]
|
||||||
|
{
|
||||||
|
ent->flags &= ~(Game::FL_GODMODE | Game::FL_DEMI_GODMODE);
|
||||||
|
ent->health = 0;
|
||||||
|
ent->client->ps.stats[0] = 0;
|
||||||
|
Game::player_die(ent, ent, ent, 100000, 12, 0, nullptr, Game::HITLOC_NONE, 0);
|
||||||
|
}, Scheduler::Pipeline::SERVER);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientCommand::AddDevelopmentCommands()
|
void ClientCommand::AddDevelopmentCommands()
|
||||||
@ -330,23 +347,6 @@ namespace Components
|
|||||||
ent->client->ps.stunTime = 1000 + Game::level->time; // 1000 is the default test stun time
|
ent->client->ps.stunTime = 1000 + Game::level->time; // 1000 is the default test stun time
|
||||||
Logger::Debug("playerState_s.stunTime is {}", ent->client->ps.stunTime);
|
Logger::Debug("playerState_s.stunTime is {}", ent->client->ps.stunTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
ClientCommand::Add("kill", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] const Command::ServerParams* params)
|
|
||||||
{
|
|
||||||
assert(ent->client != nullptr);
|
|
||||||
assert(ent->client->sess.connected != Game::CON_DISCONNECTED);
|
|
||||||
|
|
||||||
if (ent->client->sess.sessionState != Game::SESS_STATE_PLAYING || !ClientCommand::CheatsOk(ent))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Scheduler::Once([ent]
|
|
||||||
{
|
|
||||||
ent->flags &= ~(Game::FL_GODMODE | Game::FL_DEMI_GODMODE);
|
|
||||||
ent->health = 0;
|
|
||||||
ent->client->ps.stats[0] = 0;
|
|
||||||
Game::player_die(ent, ent, ent, 100000, 12, 0, nullptr, Game::HITLOC_NONE, 0);
|
|
||||||
}, Scheduler::Pipeline::SERVER);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientCommand::AddScriptFunctions()
|
void ClientCommand::AddScriptFunctions()
|
||||||
|
@ -292,8 +292,8 @@ namespace Components
|
|||||||
|
|
||||||
if (*Game::logfile)
|
if (*Game::logfile)
|
||||||
{
|
{
|
||||||
Game::FS_FCloseFile(reinterpret_cast<int>(*Game::logfile));
|
Game::FS_FCloseFile(*Game::logfile);
|
||||||
*Game::logfile = nullptr;
|
*Game::logfile = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::FS_BuildOSPath(Game::Sys_DefaultInstallPath(), "", "logs/console_mp.log", from_ospath);
|
Game::FS_BuildOSPath(Game::Sys_DefaultInstallPath(), "", "logs/console_mp.log", from_ospath);
|
||||||
|
@ -397,9 +397,9 @@ namespace Components
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
// Flush the console log
|
// Flush the console log
|
||||||
if (const auto logfile = *reinterpret_cast<int*>(0x1AD8F28))
|
if (*Game::logfile)
|
||||||
{
|
{
|
||||||
Game::FS_FCloseFile(logfile);
|
Game::FS_FCloseFile(*Game::logfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ namespace Game
|
|||||||
|
|
||||||
char (*sys_exitCmdLine)[1024] = reinterpret_cast<char(*)[1024]>(0x649FB68);
|
char (*sys_exitCmdLine)[1024] = reinterpret_cast<char(*)[1024]>(0x649FB68);
|
||||||
|
|
||||||
void** logfile = reinterpret_cast<void**>(0x1AD8F28);
|
int* logfile = reinterpret_cast<int*>(0x1AD8F28);
|
||||||
|
|
||||||
GamerSettingState* gamerSettings = reinterpret_cast<GamerSettingState*>(0x107D3E8);
|
GamerSettingState* gamerSettings = reinterpret_cast<GamerSettingState*>(0x107D3E8);
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ namespace Game
|
|||||||
typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, Game::Material* material);
|
typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, Game::Material* material);
|
||||||
extern R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic;
|
extern R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic;
|
||||||
|
|
||||||
typedef void* (__cdecl * R_AllocStaticIndexBuffer_t)(IDirect3DIndexBuffer9** store, int length);
|
typedef void*(__cdecl * R_AllocStaticIndexBuffer_t)(IDirect3DIndexBuffer9** store, int length);
|
||||||
extern R_AllocStaticIndexBuffer_t R_AllocStaticIndexBuffer;
|
extern R_AllocStaticIndexBuffer_t R_AllocStaticIndexBuffer;
|
||||||
|
|
||||||
typedef bool(__cdecl * R_Cinematic_StartPlayback_Now_t)();
|
typedef bool(__cdecl * R_Cinematic_StartPlayback_Now_t)();
|
||||||
@ -1368,7 +1368,7 @@ namespace Game
|
|||||||
|
|
||||||
extern char (*sys_exitCmdLine)[1024];
|
extern char (*sys_exitCmdLine)[1024];
|
||||||
|
|
||||||
extern void** logfile;
|
extern int* logfile;
|
||||||
|
|
||||||
extern GamerSettingState* gamerSettings;
|
extern GamerSettingState* gamerSettings;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user