mirror of
https://github.com/diamante0018/BlackOpsPlugin.git
synced 2025-04-19 18:12:54 +00:00
done some more stuff
This commit is contained in:
parent
c8b84a9b6a
commit
c4413d062d
40
src/component/ban.cpp
Normal file
40
src/component/ban.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
#include "utils/hook.hpp"
|
||||||
|
|
||||||
|
namespace ban
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const game::dvar_t* sv_discord = nullptr;
|
||||||
|
const game::dvar_t* sv_clanWebsite = nullptr;
|
||||||
|
|
||||||
|
bool out_of_band_print_hk(game::netsrc_t src, game::netadr_s to, const char* msg)
|
||||||
|
{
|
||||||
|
if (msg != "error\nPATCH_BANNED_FROM_SERVER"s)
|
||||||
|
{
|
||||||
|
return game::NET_OutOfBandPrint(src, to, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto errorMsg = std::format("error\nPermanently banned\nDiscord: {}\nWebsite: {}",
|
||||||
|
sv_discord->current.string, sv_clanWebsite->current.string);
|
||||||
|
|
||||||
|
return game::NET_OutOfBandPrint(src, to, errorMsg.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
sv_discord = game::Dvar_RegisterString("sv_discord", "https://www.discord.gg/", game::DVAR_FLAG_SAVED, "Discord invitation link");
|
||||||
|
sv_clanWebsite = game::Dvar_RegisterString("sv_clanWebsite", "https://www.google.com/", game::DVAR_FLAG_SAVED, "Website link");
|
||||||
|
|
||||||
|
utils::hook::call(SELECT(0x48B7E2, 0x0), out_of_band_print_hk);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(ban::component)
|
@ -9,7 +9,6 @@ namespace chat
|
|||||||
public:
|
public:
|
||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -127,35 +127,6 @@ namespace command
|
|||||||
{
|
{
|
||||||
utils::nt::raise_hard_exception();
|
utils::nt::raise_hard_exception();
|
||||||
});
|
});
|
||||||
|
|
||||||
add("dvarDump", [](const params& params)
|
|
||||||
{
|
|
||||||
if (params.size() < 2)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string filename = "dump/";
|
|
||||||
filename.append(params.get(1));
|
|
||||||
if (!filename.ends_with(".txt"))
|
|
||||||
{
|
|
||||||
filename.append(".txt");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto i = 0; i < *game::dvarCount; i++)
|
|
||||||
{
|
|
||||||
const auto dvar = game::sortedDvars[i];
|
|
||||||
|
|
||||||
if (dvar)
|
|
||||||
{
|
|
||||||
const auto line = std::format("{} \"{}\"\r\n", dvar->name,
|
|
||||||
game::Dvar_DisplayableValue(dvar));
|
|
||||||
utils::io::write_file(filename, line, i != 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
game::Com_Printf(game::CON_CHANNEL_SERVER, "%i dvars\n", *game::dvarCount);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,32 @@
|
|||||||
#include <stdinc.hpp>
|
#include <stdinc.hpp>
|
||||||
|
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
#include "utils/hook.hpp"
|
||||||
|
|
||||||
namespace gameplay
|
namespace gameplay
|
||||||
{
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const game::dvar_s* player_meleeRange = nullptr;
|
||||||
|
utils::hook::detour fire_weapon_melee_hook;
|
||||||
|
|
||||||
|
void fire_weapon_melee_stub(game::gentity_s* ent, int time)
|
||||||
|
{
|
||||||
|
if (player_meleeRange->current.value == 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fire_weapon_melee_hook.invoke<void>(ent, time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
|
player_meleeRange = reinterpret_cast<const game::dvar_s*>(SELECT(0xC51990, 0x0));
|
||||||
|
|
||||||
|
fire_weapon_melee_hook.create(SELECT(0x401E00, 0x0), &fire_weapon_melee_stub);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define SELECT(mp, zm) (game::environment::t6mp() ? mp : zm)
|
#define SELECT(mp, zm) (game::environment::t5mp() ? mp : zm)
|
||||||
|
|
||||||
namespace game
|
namespace game
|
||||||
{
|
{
|
||||||
|
@ -7,16 +7,29 @@ namespace game
|
|||||||
// Functions
|
// Functions
|
||||||
WEAK symbol<void(errorParm_t, const char*, ...)> Com_Error{0x627380, 0x0};
|
WEAK symbol<void(errorParm_t, const char*, ...)> Com_Error{0x627380, 0x0};
|
||||||
WEAK symbol<void(conChannel_t, const char*, ...)> Com_Printf{0x4126C0, 0x0};
|
WEAK symbol<void(conChannel_t, const char*, ...)> Com_Printf{0x4126C0, 0x0};
|
||||||
|
WEAK symbol<void(conChannel_t, const char*, ...)> Com_DPrintf{0x4E3FA0, 0x0};
|
||||||
|
|
||||||
WEAK symbol<void(LocalClientNum_t, const char* text)> Cbuf_AddText{0x56EF70, 0x0};
|
WEAK symbol<void(LocalClientNum_t, const char* text)> Cbuf_AddText{0x56EF70, 0x0};
|
||||||
WEAK symbol<void(LocalClientNum_t, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x50B470, 0x0};
|
WEAK symbol<void(LocalClientNum_t, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x50B470, 0x0};
|
||||||
|
|
||||||
|
WEAK symbol<void(client_s*, svscmd_type, const char*, ...)> SV_SendServerCommand{0x588B10, 0x0};
|
||||||
|
WEAK symbol<void(client_s*, const char*)> SV_DelayDropClient{0x4A8DC0, 0x0};
|
||||||
|
WEAK symbol<client_s*()> SV_GetPlayerByName{0x875180, 0x0};
|
||||||
|
WEAK symbol<client_s*()> SV_GetPlayerByNum{0x875260, 0x0};
|
||||||
|
|
||||||
|
WEAK symbol<bool(netsrc_t, netadr_s, const char*)> NET_OutOfBandPrint{0x560BB0, 0x0};
|
||||||
|
WEAK symbol<const char*(netadr_s)> NET_AdrToString {0x49F970, 0x0};
|
||||||
|
|
||||||
WEAK symbol<dvar_s*(const char*)> Dvar_FindVar{0x512F70, 0x0};
|
WEAK symbol<dvar_s*(const char*)> Dvar_FindVar{0x512F70, 0x0};
|
||||||
WEAK symbol<const char*(const dvar_s*)> Dvar_DisplayableValue{0x681DD0, 0x0};
|
WEAK symbol<const char*(const dvar_s*)> Dvar_DisplayableValue{0x681DD0, 0x0};
|
||||||
|
WEAK symbol<const dvar_s*(const char*, const char*,
|
||||||
|
unsigned __int16, const char*)> Dvar_RegisterString{0x4E3410, 0x0};
|
||||||
|
|
||||||
WEAK symbol<void(const char*, void(), cmd_function_t*)> Cmd_AddCommandInternal{0x6AD580, 0x0};
|
WEAK symbol<void(const char*, void(), cmd_function_t*)> Cmd_AddCommandInternal{0x6AD580, 0x0};
|
||||||
WEAK symbol<void(const char* cmdName)> Cmd_RemoveCommand{0x527EA0, 0x0};
|
WEAK symbol<void(const char* cmdName)> Cmd_RemoveCommand{0x527EA0, 0x0};
|
||||||
|
|
||||||
|
WEAK symbol<char*(char*)> I_CleanStr{0x4B0700, 0x0};
|
||||||
|
|
||||||
WEAK symbol<char*(int)> ConcatArgs{0x5D5F10, 0x0};
|
WEAK symbol<char*(int)> ConcatArgs{0x5D5F10, 0x0};
|
||||||
|
|
||||||
WEAK symbol<CmdArgs> cmd_args{0x355BD88, 0x0};
|
WEAK symbol<CmdArgs> cmd_args{0x355BD88, 0x0};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user