Add spawn with id for vehicles

This commit is contained in:
Grinch_ 2022-04-17 17:46:28 +06:00
parent e96ec7bee3
commit 0d9314b8ce
6 changed files with 65 additions and 27 deletions

View File

@ -115,19 +115,25 @@
"CheckUpdate": "Check update", "CheckUpdate": "Check update",
"Commands": "Commands", "Commands": "Commands",
"Config": "Config", "Config": "Config",
"Coords": "Coords: %.2f, %.2f, %.2f",
"CopyrightDisclaimer": "Copyright Grinch_ 2019-2022. All rights reserved.", "CopyrightDisclaimer": "Copyright Grinch_ 2019-2022. All rights reserved.",
"CPUUsage": "CPU usage: %.2f%%",
"Credits": "Credits", "Credits": "Credits",
"DiscordRPC": "Discord rich presence", "DiscordRPC": "Discord rich presence",
"DiscordServer": "Discord server", "DiscordServer": "Discord server",
"FixVehKey": "Fix current vehicle", "FixVehKey": "Fix current vehicle",
"FlipVehKey": "Flip current vehicle", "FlipVehKey": "Flip current vehicle",
"Frames": "Frames: %d",
"FreecamKey": "Toggle freecam", "FreecamKey": "Toggle freecam",
"GitHubRepo": "GitHub repo", "GitHubRepo": "GitHub repo",
"GodModeKey": "Toggle god mode", "GodModeKey": "Toggle god mode",
"Hotkeys": "Hotkeys", "Hotkeys": "Hotkeys",
"InvalidComamnd": "Invalid Command",
"InvalidLocation": "Invalid location",
"InvalidValue": "Invalid value", "InvalidValue": "Invalid value",
"Language": "Language", "Language": "Language",
"LanguageChangeFailed": "Failed to change language!", "LanguageChangeFailed": "Failed to change language!",
"Location": "Location: %s",
"Name": "Name", "Name": "Name",
"NoBG": "No background", "NoBG": "No background",
"OpenCMDKey": "Open/ close command window", "OpenCMDKey": "Open/ close command window",
@ -141,6 +147,7 @@
"QuickVehSpawnerCMDText": "Spawn vehicles by typing their model names.\nExample: veh (veh_name)", "QuickVehSpawnerCMDText": "Spawn vehicles by typing their model names.\nExample: veh (veh_name)",
"QuickWepSpawnerCMD": "Quick weapon spawner", "QuickWepSpawnerCMD": "Quick weapon spawner",
"QuickWepSpawnerCMDText": "Spawn weapons by typing their model names.\nExample: wep (wep_name)", "QuickWepSpawnerCMDText": "Spawn weapons by typing their model names.\nExample: wep (wep_name)",
"RAMUsage": "RAM usage: %.2f%%",
"ResetConfig": "Reset config", "ResetConfig": "Reset config",
"ResetConfigMSG": "Config has been reset. Restart the game for it to take effect.", "ResetConfigMSG": "Config has been reset. Restart the game for it to take effect.",
"ResetSize": "Reset size", "ResetSize": "Reset size",
@ -163,9 +170,13 @@
"Usage": "Usage", "Usage": "Usage",
"UsageText": "Left-click selects hotkey.\nLeft clicking outside deselects.\nRight click disables hotkey.", "UsageText": "Left-click selects hotkey.\nLeft clicking outside deselects.\nRight click disables hotkey.",
"VehEngineKey": "Toggle vehicle engine", "VehEngineKey": "Toggle vehicle engine",
"VehHealth": "Veh Health: %.f",
"VehicleSpawned": "Vehicle spawned",
"VehSpeed": "Veh Health: %d",
"VehStartKey": "Vehicle instant start", "VehStartKey": "Vehicle instant start",
"VehStopKey": "Vehicle instant start", "VehStopKey": "Vehicle instant start",
"Version": "Version" "Version": "Version",
"WeaponSpawned": "Weapon spawned"
}, },
"Ped": { "Ped": {
"Accuracy": "Accuracy", "Accuracy": "Accuracy",
@ -234,7 +245,7 @@
"Fat": "Fat", "Fat": "Fat",
"FireProof": "Fire proof", "FireProof": "Fire proof",
"FreeHealthcare": "Free healthcare", "FreeHealthcare": "Free healthcare",
"FreezeWL" : "Freeze wanted level", "FreezeWL": "Freeze wanted level",
"GodDisabled": "God mode disabled", "GodDisabled": "God mode disabled",
"GodEnabled": "God mode enabled", "GodEnabled": "God mode enabled",
"GodMode": "God mode", "GodMode": "God mode",
@ -306,6 +317,11 @@
"TeleportMarker": "Teleport to marker", "TeleportMarker": "Teleport to marker",
"TeleportToCoord": "Teleport to coordinates" "TeleportToCoord": "Teleport to coordinates"
}, },
"Updater": {
"Failed": "Failed to check for updates",
"Found": "Update found",
"NotFound": "No update found"
},
"Vehicle": { "Vehicle": {
"Abs": "Abs", "Abs": "Abs",
"ADM": "Anti dive multiplier", "ADM": "Anti dive multiplier",
@ -372,9 +388,11 @@
"HighSpeedDamping": "High speed damping", "HighSpeedDamping": "High speed damping",
"HSTarget": "HS targetable", "HSTarget": "HS targetable",
"HSTargetTip": "Heat Seaker missile can target this", "HSTargetTip": "Heat Seaker missile can target this",
"IDSpawnText": "Spawn with ID (Enter)",
"InfNitro": "Unlimited nitro", "InfNitro": "Unlimited nitro",
"InfNitroTip": "Nitro will activate when left clicked\n\n\nEnabling this would disable\nAll cars have nitro\nAll taxis have nitro", "InfNitroTip": "Nitro will activate when left clicked\n\n\nEnabling this would disable\nAll cars have nitro\nAll taxis have nitro",
"InstantStop": "Instant stop", "InstantStop": "Instant stop",
"InvalidID": "Invalid model ID",
"InvisCar": "Invisible car", "InvisCar": "Invisible car",
"LessDmg": "Take less damage", "LessDmg": "Take less damage",
"LessTraffic": "Decreased traffic", "LessTraffic": "Decreased traffic",
@ -461,12 +479,6 @@
"Watertight": "Watertight car", "Watertight": "Watertight car",
"WatertightTip": "Peds inside won't drown if the vehicle\nis submerged in water" "WatertightTip": "Peds inside won't drown if the vehicle\nis submerged in water"
}, },
"Updater":
{
"Failed" : "Failed to check for updates",
"Found" : "Update found",
"NotFound" : "No update found"
},
"Visual": { "Visual": {
"Ambient": "Ambient", "Ambient": "Ambient",
"AmbientBl": "Ambient bl", "AmbientBl": "Ambient bl",

View File

@ -796,7 +796,7 @@ void Game::ShowPage()
} }
ImGui::Spacing(); ImGui::Spacing();
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5); ImGui::PushItemWidth((ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x)/2);
Ui::ListBoxStr("##Categories", m_StatData.m_Categories, m_StatData.m_Selected); Ui::ListBoxStr("##Categories", m_StatData.m_Categories, m_StatData.m_Selected);
ImGui::SameLine(); ImGui::SameLine();
Ui::FilterWithHint("##Filter", m_StatData.m_Filter, TEXT("Window.Search")); Ui::FilterWithHint("##Filter", m_StatData.m_Filter, TEXT("Window.Search"));

View File

@ -163,40 +163,40 @@ void Menu::DrawOverlay()
if (m_Overlay::bCoord) if (m_Overlay::bCoord)
{ {
ImGui::Text("Coord: %.2f, %.2f, %.2f", pos.x, pos.y, pos.z); ImGui::Text(TEXT("Menu.Coords"), pos.x, pos.y, pos.z);
} }
if (m_Overlay::bCpuUsage) if (m_Overlay::bCpuUsage)
{ {
ImGui::Text("CPU usage: %.2f%%", m_Overlay::fCpuUsage); ImGui::Text(TEXT("Menu.CPUUsage"), m_Overlay::fCpuUsage);
} }
if (m_Overlay::bFPS) if (m_Overlay::bFPS)
{ {
ImGui::Text("Frames: %d", m_Overlay::mFPS); ImGui::Text(TEXT("Menu.Frames"), m_Overlay::mFPS);
} }
if (m_Overlay::bLocName) if (m_Overlay::bLocName)
{ {
ImGui::Text("Location: %s", Util::GetLocationName(&pos).c_str()); ImGui::Text(TEXT("Menu.Location"), Util::GetLocationName(&pos).c_str());
} }
if (m_Overlay::bMemUsage) if (m_Overlay::bMemUsage)
{ {
ImGui::Text("RAM usage: %.2f%%", m_Overlay::fMemUsage); ImGui::Text(TEXT("Menu.RAMUsage"), m_Overlay::fMemUsage);
} }
if (pPlayer->m_pVehicle && pPlayer->m_pVehicle->m_pDriver == pPlayer) if (pPlayer->m_pVehicle && pPlayer->m_pVehicle->m_pDriver == pPlayer)
{ {
if (m_Overlay::bVehHealth) if (m_Overlay::bVehHealth)
{ {
ImGui::Text("Veh Health: %.f", pPlayer->m_pVehicle->m_fHealth); ImGui::Text(TEXT("Menu.VehHealth"), pPlayer->m_pVehicle->m_fHealth);
} }
if (m_Overlay::bVehSpeed) if (m_Overlay::bVehSpeed)
{ {
int speed = pPlayer->m_pVehicle->m_vecMoveSpeed.Magnitude() * 50.0f; // 02E3 - GET_CAR_SPEED int speed = pPlayer->m_pVehicle->m_vecMoveSpeed.Magnitude() * 50.0f; // 02E3 - GET_CAR_SPEED
ImGui::Text("Veh Speed: %d", speed); ImGui::Text(TEXT("Menu.VehSpeed"), speed);
} }
} }
@ -304,7 +304,7 @@ void Menu::ProcessCommands()
} }
catch (...) catch (...)
{ {
SetHelpMessage("Invalid location"); SetHelpMessage(TEXT("Menu.InvalidLocation"));
} }
} }
@ -317,7 +317,7 @@ void Menu::ProcessCommands()
{ {
std::string weapon = "-1"; std::string weapon = "-1";
Weapon::GiveWeaponToPlayer(weapon); Weapon::GiveWeaponToPlayer(weapon);
SetHelpMessage("Weapon given"); SetHelpMessage(TEXT("Menu.WeaponSpawned"));
} }
else else
{ {
@ -328,10 +328,10 @@ void Menu::ProcessCommands()
if (wep_name != "" && pweaponinfo->m_nModelId1 != -1) if (wep_name != "" && pweaponinfo->m_nModelId1 != -1)
{ {
Weapon::GiveWeaponToPlayer(weapon_name); Weapon::GiveWeaponToPlayer(weapon_name);
SetHelpMessage("Weapon given"); SetHelpMessage(TEXT("Menu.WeaponSpawned"));
} }
else else
SetHelpMessage("Invalid command"); SetHelpMessage(TEXT("Menu.InvalidComamnd"));
} }
return; return;
@ -346,10 +346,10 @@ void Menu::ProcessCommands()
{ {
std::string smodel = std::to_string(model); std::string smodel = std::to_string(model);
Vehicle::SpawnVehicle(smodel); Vehicle::SpawnVehicle(smodel);
SetHelpMessage("Vehicle spawned"); SetHelpMessage(TEXT("Menu.VehicleSpawned"));
} }
else else
SetHelpMessage("Invalid command"); SetHelpMessage(TEXT("Menu.InvalidComamnd"));
} }
#endif #endif
} }

View File

@ -416,7 +416,7 @@ void Ui::DrawJSON(ResourceStore& data,
std::function<void(std::string&, std::string&, std::string&)> func_left_click, std::function<void(std::string&, std::string&, std::string&)> func_left_click,
std::function<void(std::string&, std::string&, std::string&)> func_right_click) std::function<void(std::string&, std::string&, std::string&)> func_right_click)
{ {
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5); ImGui::PushItemWidth((ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x)/2);
ListBoxStr("##Categories", data.m_Categories, data.m_Selected); ListBoxStr("##Categories", data.m_Categories, data.m_Selected);
ImGui::SameLine(); ImGui::SameLine();
@ -573,7 +573,7 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
imgPopup.function = nullptr; imgPopup.function = nullptr;
} }
ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() / 2 - 5); ImGui::PushItemWidth((ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x)/2);
if (customNames) if (customNames)
{ {
ListBoxCustomNames("##Categories", store.m_Categories, store.m_Selected, customNames, length); ListBoxCustomNames("##Categories", store.m_Categories, store.m_Selected, customNames, length);

View File

@ -998,10 +998,36 @@ void Vehicle::ShowPage()
Ui::CheckboxWithHint(TEXT("Vehicle.SpawnInAir"), &m_Spawner::m_bSpawnInAir); Ui::CheckboxWithHint(TEXT("Vehicle.SpawnInAir"), &m_Spawner::m_bSpawnInAir);
ImGui::Columns(1); ImGui::Columns(1);
ImGui::Spacing(); ImGui::Spacing();
#ifdef GTASA #ifdef GTASA
ImGui::SetNextItemWidth(ImGui::GetWindowContentRegionWidth() - 2.5); int width = (ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x)/2;
ImGui::SetNextItemWidth(width);
#endif
static char smodel[8];
if (ImGui::InputTextWithHint("##SpawnID", TEXT("Vehicle.IDSpawnText"), smodel, 8, ImGuiInputTextFlags_EnterReturnsTrue))
{
try{
int model = std::stoi(smodel);
if (CModelInfo::IsCarModel(model))
{
std::string str = std::string(smodel);
SpawnVehicle(str);
}
else
{
SetHelpMessage(TEXT("Vehicle.InvalidID"));
}
}
catch(...)
{
SetHelpMessage(TEXT("Vehicle.InvalidID"));
}
}
#ifdef GTASA
ImGui::SameLine();
ImGui::SetNextItemWidth(width);
ImGui::InputTextWithHint("##LicenseText", TEXT("Vehicle.PlateText"), m_Spawner::m_nLicenseText, 9); ImGui::InputTextWithHint("##LicenseText", TEXT("Vehicle.PlateText"), m_Spawner::m_nLicenseText, 9);
Ui::DrawImages(m_Spawner::m_VehData, SpawnVehicle, nullptr, Ui::DrawImages(m_Spawner::m_VehData, SpawnVehicle, nullptr,

View File

@ -9,4 +9,4 @@ set "III_DIR="E:\GTA3""
cd tools cd tools
premake5.exe vs2022 premake5.exe vs2022
cd ../build cd ../build
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat"