feat: add Time Changer (local) (#328)

* feat: add FSL API Support

* Correction in AnticheatBypass.cpp

* feat: add Time Controll

* improved

---------

Co-authored-by: ThePosiDong <kurdanstpolek@gmail.com>
This commit is contained in:
Peter Witgs 2025-05-27 20:05:11 +02:00 committed by GitHub
parent 399edf4380
commit 69e387aa61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,44 @@
#include "core/commands/Command.hpp"
#include "core/commands/IntCommand.hpp"
#include "core/commands/LoopedCommand.hpp"
#include "game/gta/Natives.hpp"
namespace YimMenu::Features
{
static IntCommand _NetworkTimeHour{"networktimehour", "Hour", "Set hour (023)", 0, 23, 12};
static IntCommand _NetworkTimeMinute{"networktimeminute", "Minute", "Set minute (059)", 0, 59, 0};
static IntCommand _NetworkTimeSecond{"networktimesecond", "Second", "Set second (059)", 0, 59, 0};
class SetNetworkTime : public Command
{
using Command::Command;
virtual void OnCall() override
{
NETWORK::NETWORK_OVERRIDE_CLOCK_TIME(_NetworkTimeHour.GetState(),
_NetworkTimeMinute.GetState(),
_NetworkTimeSecond.GetState());
}
};
class FreezeNetworkTime : public LoopedCommand
{
using LoopedCommand::LoopedCommand;
virtual void OnTick() override
{
NETWORK::NETWORK_OVERRIDE_CLOCK_TIME(_NetworkTimeHour.GetState(),
_NetworkTimeMinute.GetState(),
_NetworkTimeSecond.GetState());
}
virtual void OnDisable() override
{
NETWORK::NETWORK_CLEAR_CLOCK_TIME_OVERRIDE();
}
};
static SetNetworkTime _SetTime{"setnetworktime", "Set Time", "Sets the current online time"};
static FreezeNetworkTime _FreezeTime{"freezenetworktime", "Freeze Time", "Freezes the online clock at the selected time"};
}

View File

@ -27,6 +27,15 @@ namespace YimMenu::Submenus
weatherOpts->AddItem(std::make_shared<ConditionalItem>("forceweather"_J, std::make_shared<CommandItem>("setweather"_J), true));
weatherOpts->AddItem(std::make_shared<BoolCommandItem>("forceweather"_J));
auto timeGroup = std::make_shared<Group>("Time Control");
timeGroup->AddItem(std::make_shared<IntCommandItem>("networktimehour"_J, "Hour"));
timeGroup->AddItem(std::make_shared<IntCommandItem>("networktimeminute"_J, "Minute"));
timeGroup->AddItem(std::make_shared<IntCommandItem>("networktimesecond"_J, "Second"));
timeGroup->AddItem(std::make_shared<CommandItem>("setnetworktime"_J, "Set"));
timeGroup->AddItem(std::make_shared<BoolCommandItem>("freezenetworktime"_J, "Freeze"));
auto otherOpts = std::make_shared<Group>("Other", 1);
otherOpts->AddItem(std::make_shared<BoolCommandItem>("pedsignore"_J));
otherOpts->AddItem(std::make_shared<BoolCommandItem>("PedRiotMode"_J));
@ -37,6 +46,7 @@ namespace YimMenu::Submenus
main->AddItem(std::move(bringOpts));
main->AddItem(std::move(weatherOpts));
main->AddItem(std::move(otherOpts));
main->AddItem(timeGroup);
auto spawnVehicle = std::make_shared<Group>("Vehicle");
spawnVehicle->AddItem(std::make_shared<StringCommandItem>("vehmodelname"_J));