mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2025-05-30 23:19:17 +08:00
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:
parent
399edf4380
commit
69e387aa61
44
src/game/features/world/TimeControl.cpp
Normal file
44
src/game/features/world/TimeControl.cpp
Normal 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 (0–23)", 0, 23, 12};
|
||||
static IntCommand _NetworkTimeMinute{"networktimeminute", "Minute", "Set minute (0–59)", 0, 59, 0};
|
||||
static IntCommand _NetworkTimeSecond{"networktimesecond", "Second", "Set second (0–59)", 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"};
|
||||
}
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user