Files
OG-Fortnite-Cheat/Fortnite Internal/Game/Features/Exploits/Vehicle.cpp
T
raax7 b4c19d6cee Chams!
- Added chams! (still lots of work to be done)
- Completely refactored Game/Actors/Loops/FortPickup.cpp
2024-03-28 02:59:50 +00:00

114 lines
4.2 KiB
C++

#include "Vehicle.h"
#include "../../SDK/Classes/FortniteGame_Classes.h"
#include "../../../Configs/Config.h"
#include "../../Actors/ActorCache.h"
#include "../../Actors/Actors.h"
#include "../../Input/Input.h"
void Features::Exploits::Vehicle::Tick(SDK::AFortPlayerPawnAthena* FortPawn) {
SDK::AFortAthenaVehicle* Vehicle = FortPawn->GetVehicle();
if (SDK::IsValidPointer(Vehicle)) {
VehicleLastTick = Vehicle;
if (Config::Exploits::Vehicle::InfiniteBoost) {
if (Vehicle->IsA(SDK::AFortAthenaAntelopeVehicle::StaticClass())) {
SDK::AFortAthenaAntelopeVehicle* Antelope = SDK::Cast<SDK::AFortAthenaAntelopeVehicle, true>(Vehicle);
Antelope->FortAntelopeVehicleConfigs()->SetBoostAccumulationRate(FLT_MAX, &Config::Exploits::Vehicle::InfiniteBoost);
Antelope->FortAntelopeVehicleConfigs()->SetBoostExpenseRate(0.f, &Config::Exploits::Vehicle::InfiniteBoost);
}
if (Vehicle->IsA(SDK::AFortAthenaJackalVehicle::StaticClass())) {
SDK::AFortAthenaJackalVehicle* Jackal = SDK::Cast<SDK::AFortAthenaJackalVehicle, true>(Vehicle);
for (int i = 0; i < Jackal->BoostTimers().Num(); i++) {
Jackal->BoostTimers()[i].SetCharge(1.0f);
}
}
if (Vehicle->IsA(SDK::AFortAthenaDoghouseVehicle::StaticClass())) {
SDK::AFortAthenaDoghouseVehicle* Doghouse = SDK::Cast<SDK::AFortAthenaDoghouseVehicle, true>(Vehicle);
Doghouse->BoostAction()->SetCharge(1.0f);
}
}
if (Config::Exploits::Vehicle::Fly) {
float MoveForwardBackward = 0.0f;
float MoveLeftRight = 0.0f;
float MoveUpDown = 0.0f;
if (Input::IsKeyDown(Input::KeyName::W)) MoveForwardBackward += 1.0f;
if (Input::IsKeyDown(Input::KeyName::S)) MoveForwardBackward -= 1.0f;
if (Input::IsKeyDown(Input::KeyName::A)) MoveLeftRight -= 1.0f;
if (Input::IsKeyDown(Input::KeyName::D)) MoveLeftRight += 1.0f;
if (Input::IsKeyDown(Input::KeyName::SpaceBar)) MoveUpDown += 1.0f;
if (Input::IsKeyDown(Input::KeyName::LeftShift)) MoveUpDown -= 1.0f;
SDK::FRotator CameraRotation = Actors::MainCamera.Rotation;
SDK::FVector ForwardVector = SDK::FVector();
std::chrono::time_point CurrentTime = std::chrono::steady_clock::now();
// Tilting in the air is disabled for planes, it causes many issues
if (Vehicle->IsA(SDK::AFortAthenaDoghouseVehicle::StaticClass()) || Config::Exploits::Vehicle::NoTilting) {
SDK::FRotator AdjustedCameraRotation = Actors::MainCamera.Rotation;
AdjustedCameraRotation.Pitch = 0.f;
ForwardVector = SDK::UKismetMathLibrary::GetForwardVector(AdjustedCameraRotation);
ForwardVector.Z = 0.f;
CameraRotation.Pitch = 0.f;
}
else {
ForwardVector = SDK::UKismetMathLibrary::GetForwardVector(Actors::MainCamera.Rotation);
}
SDK::FVector MovementDirection = ForwardVector * MoveForwardBackward +
SDK::UKismetMathLibrary::GetRightVector(Actors::MainCamera.Rotation) * MoveLeftRight +
SDK::FVector(0, 0, 1) * MoveUpDown;
// Adjust MovementDirection for 60 FPS (so speed doesn't depend on FPS)
MovementDirection = MovementDirection / Actors::FPSScale;
SDK::FVector NewLocation = Vehicle->RootComponent()->RelativeLocation() + (MovementDirection * Config::Exploits::Vehicle::FlySpeed);
if (MovementDirection != SDK::FVector()) {
Vehicle->K2_TeleportTo(NewLocation, CameraRotation);
if (Config::Exploits::Vehicle::FlyThroughWalls) {
WasNoCollisionLastTick = true;
Vehicle->SetActorEnableCollision(false); // ADD AUTO REVERT TO THIS
}
else {
Vehicle->SetActorEnableCollision(true); // ADD AUTO REVERT TO THIS
}
// If FreezeInAir is off, only freeze the vehicle when it's flying
if (Config::Exploits::Vehicle::FreezeInAir == false) {
Vehicle->RootComponent()->SetPhysicsLinearVelocity(SDK::FVector(0, 0, 0), false, SDK::FName());
}
}
else {
Vehicle->K2_SetActorRotation(CameraRotation, true);
}
if (Config::Exploits::Vehicle::FreezeInAir) {
Vehicle->RootComponent()->SetPhysicsLinearVelocity(SDK::FVector(0, 0, 0), false, SDK::FName());
}
}
}
else if (VehicleLastTick) {
if (WasNoCollisionLastTick) {
VehicleLastTick->SetActorEnableCollision(true);
WasNoCollisionLastTick = false;
}
VehicleLastTick = nullptr;
}
}