mirror of
https://github.com/diamante0018/BlackOpsPlugin.git
synced 2025-04-20 02:22:52 +00:00
fix prank
This commit is contained in:
parent
a25a472d96
commit
92647e0fb9
@ -9,15 +9,9 @@
|
||||
|
||||
namespace patches {
|
||||
namespace {
|
||||
int bot_[32];
|
||||
int demo_client_[32];
|
||||
int client_num_;
|
||||
std::string status_;
|
||||
|
||||
int is_test_client(int client_num) {
|
||||
return bot_[client_num] == TRUE || demo_client_[client_num] == TRUE;
|
||||
}
|
||||
|
||||
void server_status_basic_print([[maybe_unused]] const int channel,
|
||||
const char* fmt) {
|
||||
status_.append(fmt);
|
||||
@ -48,7 +42,9 @@ void server_status_client_number_print([[maybe_unused]] const int channel,
|
||||
void server_status_score_print([[maybe_unused]] const int channel,
|
||||
const char* fmt, const int score) {
|
||||
status_.append(utils::string::va(fmt, score));
|
||||
status_.append(utils::string::va("%3i ", is_test_client(client_num_)));
|
||||
const int fake_player =
|
||||
game::SV_IsTestClient(client_num_) || game::SV_IsDemoClient(client_num_);
|
||||
status_.append(utils::string::va("%3i ", fake_player));
|
||||
}
|
||||
|
||||
void server_status_ping_print([[maybe_unused]] const int channel,
|
||||
@ -94,38 +90,11 @@ void server_status_terminating_print([[maybe_unused]] const int channel,
|
||||
// clear the buffer
|
||||
status_.clear();
|
||||
}
|
||||
|
||||
void sv_send_bot_client_game_state(game::client_s* client) {
|
||||
game::Com_Printf(game::CON_CHANNEL_DONT_FILTER, "Bot joined on slot %i\n",
|
||||
client - game::svs_clients);
|
||||
bot_[client - game::svs_clients] = 1;
|
||||
|
||||
utils::hook::invoke<void>(0x4A1940, client);
|
||||
}
|
||||
|
||||
void sv_send_demo_client_game_state(game::client_s* client) {
|
||||
game::Com_Printf(game::CON_CHANNEL_DONT_FILTER,
|
||||
"Demo client joined on slot %i\n",
|
||||
client - game::svs_clients);
|
||||
demo_client_[client - game::svs_clients] = 1;
|
||||
|
||||
utils::hook::invoke<void>(0x4A1940, client);
|
||||
}
|
||||
|
||||
void client_disconnect_stub(const int client_num) {
|
||||
bot_[client_num] = FALSE;
|
||||
demo_client_[client_num] = FALSE;
|
||||
|
||||
utils::hook::invoke<void>(0x66FA00, client_num);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
class component final : public component_interface {
|
||||
public:
|
||||
void post_unpack() override {
|
||||
ZeroMemory(bot_, sizeof(int[32]));
|
||||
ZeroMemory(demo_client_, sizeof(int[32]));
|
||||
|
||||
if (game::environment::is_sp()) {
|
||||
return;
|
||||
}
|
||||
@ -167,12 +136,6 @@ public:
|
||||
utils::hook::call(0x8762E2, server_status_terminating_print);
|
||||
|
||||
utils::hook::call(0x8762E2, server_status_terminating_print);
|
||||
|
||||
utils::hook::call(0x40A509, sv_send_demo_client_game_state);
|
||||
|
||||
utils::hook::call(0x6B63A0, sv_send_bot_client_game_state);
|
||||
|
||||
utils::hook::call(0x5DC953, client_disconnect_stub);
|
||||
}
|
||||
};
|
||||
} // namespace patches
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <std_include.hpp>
|
||||
|
||||
namespace game {
|
||||
gamemode current = reinterpret_cast<const char*>(0xA6840C) == "multiplayer"s
|
||||
gamemode current =
|
||||
std::memcmp(reinterpret_cast<const char*>(0xA6840C), "multiplayer", 12) == 0
|
||||
? gamemode::multiplayer
|
||||
: gamemode::zombies;
|
||||
|
||||
@ -10,8 +11,4 @@ bool is_mp() { return current == gamemode::multiplayer; }
|
||||
|
||||
bool is_sp() { return current == gamemode::zombies; }
|
||||
} // namespace environment
|
||||
|
||||
int SV_IsTestClient(int clientNum) {
|
||||
return svs_clients[clientNum].bIsTestClient;
|
||||
}
|
||||
} // namespace game
|
||||
|
@ -33,8 +33,6 @@ private:
|
||||
T* t5mp_;
|
||||
T* t5zm_;
|
||||
};
|
||||
|
||||
extern int SV_IsTestClient(int clientNum);
|
||||
} // namespace game
|
||||
|
||||
#include "symbols.hpp"
|
||||
|
@ -27,6 +27,8 @@ WEAK symbol<void(client_s*, const char*)> SV_DelayDropClient{0x4A8DC0,
|
||||
0x4A2EB0};
|
||||
WEAK symbol<client_s*()> SV_GetPlayerByName{0x875180, 0x87C350};
|
||||
WEAK symbol<client_s*()> SV_GetPlayerByNum{0x875260, 0x87C430};
|
||||
WEAK symbol<bool(int clientNum)> SV_IsTestClient{0x4FF4C0, 0x0};
|
||||
WEAK symbol<bool(int clientNum)> SV_IsDemoClient{0x534DC0, 0x0};
|
||||
|
||||
WEAK symbol<bool(netsrc_t, netadr_s, const char*)> NET_OutOfBandPrint{0x560BB0,
|
||||
0x472850};
|
||||
|
Loading…
x
Reference in New Issue
Block a user