Added Fix for Equip Item "exploit" for People Hosting with Trainer Loaded, and reworked some Code Functionality. Finna add more "exploit" fixes soon.

This commit is contained in:
Unknown 2024-05-10 02:27:59 +02:00
parent d95714f19a
commit 0470691dfd
3 changed files with 101 additions and 30 deletions

View File

@ -7,7 +7,7 @@
#include "Settings.h"
#define DEBUG
//#define DEBUG
#define Gatekeep
void RunMainHost();

View File

@ -6,7 +6,7 @@ namespace HostOptions {
{
ULONGLONG TickCount = GetTickCount64();
if (Settings::Host_CollisionPlayers || Settings::Host_Event_TeleportPlayers)
if (Settings::Host_CollisionPlayers || Settings::Host_FunMode || Settings::Host_Event_TeleportPlayers)
{
static ULONGLONG TickCount_Host = 0;

View File

@ -31,22 +31,33 @@ void ConsoleExit() {
}
namespace FunctionPtrsProcessEvent {
void* Lobby_PlayerController_COC_KickedFromLobby = nullptr;
void* MP_PlayerController_COC_KickedFromLobby = nullptr;
void* Lobby_PlayerController_CReceiveBeginPlay = nullptr;
void* W_Kicked_C_Tick = nullptr;
enum FunctionDefs
{
Lobby_PlayerController_COC_KickedFromLobby,
MP_PlayerController_COC_KickedFromLobby,
W_Kicked_C_Tick,
Lobby_PlayerController_CReceiveBeginPlay,
BPCharacter_Demo_C_SpawnEquipItem_SERVER,
};
void* FunctionHooks[5];
const size_t FunctionHookSize = sizeof(FunctionHooks) / 8;
void NullObjects() {
Lobby_PlayerController_COC_KickedFromLobby = nullptr;
MP_PlayerController_COC_KickedFromLobby = nullptr;
Lobby_PlayerController_CReceiveBeginPlay = nullptr;
W_Kicked_C_Tick = nullptr;
for (size_t i = 0; i < FunctionHookSize; i++)
{
FunctionHooks[i] = nullptr;
}
}
};
void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms) {
using namespace FunctionPtrsProcessEvent;
auto execF = Function;
@ -55,7 +66,8 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
#pragma region FindPointers
if (!FunctionPtrsProcessEvent::Lobby_PlayerController_COC_KickedFromLobby) {
if (!FunctionPtrsProcessEvent::FunctionHooks[Lobby_PlayerController_COC_KickedFromLobby]) {
static ULONGLONG TickCount_ = 0;
auto Tick = GetTickCount64();
@ -70,13 +82,13 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
auto Func = Class_->GetFunction("Lobby_PlayerController_C", "OC_KickedFromLobby");
if (Func)
{
FunctionPtrsProcessEvent::Lobby_PlayerController_COC_KickedFromLobby = Func;
FunctionPtrsProcessEvent::FunctionHooks[0] = Func;
}
}
}
}
if (!FunctionPtrsProcessEvent::MP_PlayerController_COC_KickedFromLobby) {
if (!FunctionPtrsProcessEvent::FunctionHooks[MP_PlayerController_COC_KickedFromLobby]) {
static ULONGLONG TickCount_ = 0;
auto Tick = GetTickCount64();
@ -91,13 +103,13 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
auto Func = Class_->GetFunction("MP_PlayerController_C", "OC_KickedFromLobby");
if (Func)
{
FunctionPtrsProcessEvent::MP_PlayerController_COC_KickedFromLobby = Func;
FunctionPtrsProcessEvent::FunctionHooks[1] = Func;
}
}
}
}
if (!FunctionPtrsProcessEvent::W_Kicked_C_Tick) {
if (!FunctionPtrsProcessEvent::FunctionHooks[W_Kicked_C_Tick]) {
static ULONGLONG TickCount_ = 0;
auto Tick = GetTickCount64();
@ -113,7 +125,7 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
if (Func)
{
FunctionPtrsProcessEvent::W_Kicked_C_Tick = Func;
FunctionPtrsProcessEvent::FunctionHooks[2] = Func;
}
}
@ -121,7 +133,7 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
}
if (!FunctionPtrsProcessEvent::Lobby_PlayerController_CReceiveBeginPlay) {
if (!FunctionPtrsProcessEvent::FunctionHooks[Lobby_PlayerController_CReceiveBeginPlay]) {
static ULONGLONG TickCount_ = 0;
auto Tick = GetTickCount64();
@ -136,7 +148,28 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
auto Func = Class_->GetFunction("Lobby_PlayerController_C", "ReceiveBeginPlay");
if (Func)
{
FunctionPtrsProcessEvent::Lobby_PlayerController_CReceiveBeginPlay = Func;
FunctionPtrsProcessEvent::FunctionHooks[3] = Func;
}
}
}
}
if (!FunctionPtrsProcessEvent::FunctionHooks[BPCharacter_Demo_C_SpawnEquipItem_SERVER]) {
static ULONGLONG TickCount_ = 0;
auto Tick = GetTickCount64();
if (Tick >= TickCount_) {
TickCount_ = Tick + 100;
auto Class_ = SDK::ABPCharacter_Demo_C::StaticClass();
if (Class_)
{
auto Func = Class_->GetFunction("BPCharacter_Demo_C", "SpawnEquipItem_SERVER");
if (Func)
{
FunctionPtrsProcessEvent::FunctionHooks[4] = Func;
}
}
}
@ -146,7 +179,7 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
if (execF == FunctionPtrsProcessEvent::Lobby_PlayerController_COC_KickedFromLobby || execF == FunctionPtrsProcessEvent::MP_PlayerController_COC_KickedFromLobby) {
if (execF == FunctionHooks[Lobby_PlayerController_COC_KickedFromLobby] || execF == FunctionHooks[MP_PlayerController_COC_KickedFromLobby]) {
Cheat::MainRun(nullptr);
if (Obj == Cheat::PlayerController) {
@ -161,15 +194,15 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
}
if (execF == FunctionPtrsProcessEvent::Lobby_PlayerController_CReceiveBeginPlay) {
if (execF == FunctionHooks[Lobby_PlayerController_CReceiveBeginPlay]) {
Cheat::MainRun(nullptr);
if (Obj != Cheat::PlayerController) {
SDK::ALobby_PlayerController_C* Controller = (SDK::ALobby_PlayerController_C*)Obj;
if(Controller->PlayerState)
Cheat::Message(std::string("Player " + Controller->PlayerState->PlayerNamePrivate.ToString() + "joined your Game!"));
if (Controller->PlayerState)
Cheat::Message(std::string("Player " + Controller->PlayerState->PlayerNamePrivate.ToString() + "joined your Game!"));
}
else
{
@ -177,19 +210,57 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
}
}
if (execF == FunctionPtrsProcessEvent::W_Kicked_C_Tick) {
if (execF == FunctionHooks[W_Kicked_C_Tick]) {
auto obj_ = (SDK::UW_Kicked_C*)Obj;
auto params_ = (SDK::Params::UW_Kicked_C_Tick_Params*)Parms;
auto mssg = Cheat::TextLib->Conv_StringToText(SDK::FString(L"Host the Broke ass fella kicked you lmao"));
obj_->TextBlock_Message->SetText(mssg);
}
if (execF == FunctionHooks[BPCharacter_Demo_C_SpawnEquipItem_SERVER]) {
auto CallingPawn = (SDK::ABPCharacter_Demo_C*)Obj;
auto params_ = (SDK::Params::ABPCharacter_Demo_C_SpawnEquipItem_SERVER_Params*)Parms;
bool IsLocalHost = false;
bool IsLocalPlayer = false;
SDK::AMP_GameMode_C* GameMode = nullptr;
if (CallingPawn->Controller) {
auto world = SDK::UWorld::GetWorld();
IsLocalHost = true;
GameMode = (SDK::AMP_GameMode_C*)world->AuthorityGameMode;
if (auto LocalPlayer = world->OwningGameInstance->LocalPlayers[0]; LocalPlayer && LocalPlayer->PlayerController) {
IsLocalPlayer = (CallingPawn->Controller == LocalPlayer->PlayerController);
}
}
if (!IsLocalPlayer) {
if (auto ItemClass = params_->ItemClass; ItemClass) {
if (!ItemClass->IsA(SDK::ABP_Item_C::StaticClass())) {
if (IsLocalHost) {
Cheat::MessageW(L"Non Item was passed to SpawnEquipItem, kicking that bad Cheater!");
GameMode->KickPlayer(CallingPawn->PlayerState, CallingPawn->GetOwner(), (SDK::AMP_PlayerController_C*)CallingPawn->Controller, true, true);
}
}
}
else
{
if (IsLocalHost) {
Cheat::MessageW(L"Nullpointer was passed to SpawnEquipItem, kicking that bad Cheater!");
GameMode->KickPlayer(CallingPawn->PlayerState, CallingPawn->GetOwner(), (SDK::AMP_PlayerController_C*)CallingPawn->Controller, true, true);
}
}
}
}
return fnProcessEventOrigin(Obj, Function, Parms);
}