Skip to content

feat: change license plate #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions src/game/features/vehicle/Spawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ namespace YimMenu::Features
static BoolCommand _UseCustomLicensePlate{"usecustomlicenseplate", "Use custom license plate", "Use a custom license plate for the vehicle", false};
static StringCommand _CustomLicensePlate{"customlicenseplate", "Custom license plate", "The custom license plate for the vehicle"};

class SpawnVehicle : public Command {
class SpawnVehicle : public Command
{
using Command::Command;

virtual void OnCall() override
{
auto model = _VehicleModelname.GetString();

if (!model.length())
{
Notifications::Show("Spawn Vehicle", "No model name provided.", NotificationType::Error);
Expand Down Expand Up @@ -58,7 +59,7 @@ namespace YimMenu::Features
else if (licensePlate.length() > 0)
{
veh.SetPlateText(licensePlate);
}
}
}
}
else
Expand All @@ -68,5 +69,36 @@ namespace YimMenu::Features
}
};

class SetLicensePlate : public Command
{
using Command::Command;

virtual void OnCall() override
{
auto veh = Self::GetVehicle();

if (!veh)
{
Notifications::Show("License Plate", "No vehicle found.", NotificationType::Error);
return;
}

std::string licensePlate = _CustomLicensePlate.GetString();
if (licensePlate.length() == 0)
{
Notifications::Show("License Plate", "No license plate provided.", NotificationType::Error);
}
else if (licensePlate.length() > 8)
{
Notifications::Show("License Plate", "License plate must be 8 characters or less.", NotificationType::Error);
}
else if (licensePlate.length() > 0)
{
veh.SetPlateText(licensePlate);
}
}
};

static SpawnVehicle _SpawnVehicle{"spawnvehicle", "Spawn Vehicle", "Spawns a vehicle at your current location"};
static SetLicensePlate _SetLicensePlate{"setlicenseplate", "Set License Plate", "Sets the license plate of the vehicle you are in"};
}
8 changes: 4 additions & 4 deletions src/game/frontend/items/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace YimMenu
{
Group::Group(const std::string& name, int items_per_row) :
m_Name(name),
m_ItemsPerRow(items_per_row)
Group::Group(const std::string& name, int items_per_column) :
m_Name(name),
m_ItemsPerColumn(items_per_column)
{
}

Expand All @@ -34,7 +34,7 @@ namespace YimMenu
item->Draw();
item_count++;

if (m_ItemsPerRow != -1 && item_count % m_ItemsPerRow == 0)
if (m_ItemsPerColumn != -1 && item_count % m_ItemsPerColumn == 0)
{
ImGui::EndGroup();
ImGui::SameLine();
Expand Down
5 changes: 2 additions & 3 deletions src/game/frontend/items/Items.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ namespace YimMenu
class HotkeySetter : public UIItem
{
public:

explicit HotkeySetter(joaat_t);
void Draw() override;

Expand All @@ -146,7 +145,7 @@ namespace YimMenu
class Group : public UIItem
{
public:
explicit Group(const std::string& name, int items_per_row = 7);
explicit Group(const std::string& name, int items_per_column = 7);
void Draw() override;

void AddItem(std::shared_ptr<UIItem>&& item)
Expand All @@ -156,7 +155,7 @@ namespace YimMenu

private:
std::string m_Name;
int m_ItemsPerRow;
int m_ItemsPerColumn;
std::vector<std::shared_ptr<UIItem>> m_Items;
};

Expand Down
28 changes: 13 additions & 15 deletions src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ namespace YimMenu::Submenus
auto tab = std::make_shared<TabItem>("Diamond Casino Heist");

auto cuts = std::make_shared<Group>("Heist Cuts", 2);
auto setups1 = std::make_shared<Group>("Heist Setups");
auto setups2 = std::make_shared<Group>("");
auto setups = std::make_shared<Group>("Heist Setups", 11);
auto loots = std::make_shared<Group>("Loots");
auto misc = std::make_shared<Group>("Misc", 1);

Expand All @@ -19,21 +18,21 @@ namespace YimMenu::Submenus
cuts->AddItem(std::make_shared<CommandItem>("diamondcasinoheistforceready"_J));
cuts->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetcuts"_J));

setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdifficulty"_J));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistprimarytarget"_J));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistapproach"_J));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistgunman"_J));
setups1->AddItem(std::make_shared<ImGuiItem>([] {
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdifficulty"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistprimarytarget"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistapproach"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistgunman"_J));
setups->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
setups1->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistweapon"_J));
setups2->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdriver"_J));
setups2->AddItem(std::make_shared<ImGuiItem>([] {
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistweapon"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistdriver"_J));
setups->AddItem(std::make_shared<ImGuiItem>([] {
ImGui::SameLine();
}));
setups2->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistvehicle"_J));
setups2->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheisthacker"_J));
setups2->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetup"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheistvehicle"_J));
setups->AddItem(std::make_shared<ListCommandItem>("diamondcasinoheisthacker"_J));
setups->AddItem(std::make_shared<CommandItem>("diamondcasinoheistsetup"_J));

loots->AddItem(std::make_shared<IntCommandItem>("diamondcasinoheistpotentialtake"_J));
loots->AddItem(std::make_shared<ImGuiItem>([] {
Expand All @@ -51,8 +50,7 @@ namespace YimMenu::Submenus
misc->AddItem(std::make_shared<CommandItem>("diamondcasinoheistinstantfinish"_J));

tab->AddItem(cuts);
tab->AddItem(setups1);
tab->AddItem(setups2);
tab->AddItem(setups);
tab->AddItem(loots);
tab->AddItem(misc);

Expand Down
6 changes: 4 additions & 2 deletions src/game/frontend/submenus/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ namespace YimMenu::Submenus
main->AddItem(std::move(bringOpts));
main->AddItem(std::move(weatherOpts));

auto spawnGroup = std::make_shared<Group>("Vehicle");
auto modsGroup = std::make_shared<Group>("Modifications");
auto spawnGroup = std::make_shared<Group>("Vehicle", 8);
auto modsGroup = std::make_shared<Group>("Modifications");

spawnGroup->AddItem(std::make_shared<StringCommandItem>("vehmodelname"_J));
spawnGroup->AddItem(std::make_shared<BoolCommandItem>("spawninvehicle"_J));
spawnGroup->AddItem(std::make_shared<BoolCommandItem>("spawnupgraded"_J));
spawnGroup->AddItem(std::make_shared<BoolCommandItem>("usecustomlicenseplate"_J));
spawnGroup->AddItem(std::make_shared<ConditionalItem>("usecustomlicenseplate"_J, std::make_shared<StringCommandItem>("customlicenseplate"_J)));
spawnGroup->AddItem(std::make_shared<ConditionalItem>("usecustomlicenseplate"_J, std::make_shared<ImGuiItem>([] { ImGui::SameLine(); })));
spawnGroup->AddItem(std::make_shared<ConditionalItem>("usecustomlicenseplate"_J, std::make_shared<CommandItem>("setlicenseplate"_J, "Set##licenseplate")));
spawnGroup->AddItem(std::make_shared<CommandItem>("spawnvehicle"_J));

modsGroup->AddItem(std::make_shared<BoolCommandItem>("lsccustomsbypass"_J));
Expand Down