0% found this document useful (0 votes)
23 views2 pages

Bot v2

Uploaded by

misi0figura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Bot v2

Uploaded by

misi0figura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include "bakkesmod/plugin/bakkesmodplugin.

h"
#include "bakkesmod/cvarmanager/cvarmanager.h"
#include "bakkesmod/wrappers/gamewrapper.h"
#include "bakkesmod/wrappers/carwrapper.h"

class FreestylePlugin : public BakkesMod::Plugin::BakkesModPlugin {


public:
virtual void onLoad() override {
// Register CVars for freestyle settings
cvarManager->registerCvar("freestyle_mode", "0", "Enable or disable
freestyle mode", true, true, 0, true, 1);
cvarManager->registerCvar("trick_type", "0", "Type of trick to perform:
0=MustyFlick, 1=FlipReset, 2=DoubleTap", true, true, 0, true, 2);

// Notifier for toggling freestyle mode


cvarManager->addNotifier("toggleFreestyle", [this](std::vector<std::string>
args) {
bool enabled = cvarManager->getCvar("freestyle_mode").getBoolValue();
if (enabled) {
cvarManager->getCvar("freestyle_mode").setValue("0");
gameWrapper->Toast("Freestyle mode disabled!");
} else {
cvarManager->getCvar("freestyle_mode").setValue("1");
gameWrapper->Toast("Freestyle mode enabled!");
}
}, "", 0);

// Notifier for performing tricks


cvarManager->addNotifier("performTrick", [this](std::vector<std::string>
args) {
int trickType = cvarManager->getCvar("trick_type").getIntValue();
switch (trickType) {
case 0: performMustyFlick(); break;
case 1: performFlipReset(); break;
case 2: performDoubleTap(); break;
default: gameWrapper->Toast("Unknown trick type!"); break;
}
}, "", 0);
}

virtual void onUnload() override {


// Cleanup code here
}

private:
void performMustyFlick() {
auto car = gameWrapper->GetGameEventAsServer().GetLocalCar();
if (car) {
auto carPhysics = car->GetPhysics();
// Implement Musty Flick logic
// For example, apply a vertical force and a quick flip
carPhysics->AngularVelocity = FVector(0, 0, 0);
carPhysics->Velocity = FVector(0, 0, 0);
carPhysics->Location = car->GetLocation() + FVector(0, 0, 100);
car->SetPhysics(carPhysics);
gameWrapper->Toast("Musty Flick performed!");
}
}
void performFlipReset() {
auto car = gameWrapper->GetGameEventAsServer().GetLocalCar();
if (car) {
auto carPhysics = car->GetPhysics();
// Implement Flip Reset logic
// For example, apply forces to reset the car's flip
carPhysics->AngularVelocity = FVector(0, 0, 0);
carPhysics->Velocity = FVector(0, 0, 0);
// Adjust these values to properly reset the flip
carPhysics->Location = car->GetLocation() + FVector(0, 0, 50);
car->SetPhysics(carPhysics);
gameWrapper->Toast("Flip Reset performed!");
}
}

void performDoubleTap() {
auto car = gameWrapper->GetGameEventAsServer().GetLocalCar();
if (car) {
auto carPhysics = car->GetPhysics();
// Implement Double Tap logic
// For example, apply a force to perform a double tap
carPhysics->AngularVelocity = FVector(0, 0, 0);
carPhysics->Velocity = FVector(0, 0, 0);
carPhysics->Location = car->GetLocation() + FVector(0, 0, 75);
car->SetPhysics(carPhysics);
gameWrapper->Toast("Double Tap performed!");
}
}
};

BAKKESMOD_PLUGIN(FreestylePlugin, "Freestyle Plugin", "1.0",


PLUGINTYPE_THIRD_PARTY)

You might also like