Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*bool showPedSpawnerWindow;*/ void ShowPedSpawnerWindow()
- {
- //if (!showPedSpawnerWindow) return;
- CPlayerPed* pLocalPlayer = FindPlayerPed();
- std::string elementName = std::to_string(pedID) + "-" + peds[pedID];
- ImGuiComboFlags flags = ImGuiComboFlags_NoArrowButton;
- ImGuiStyle& style = ImGui::GetStyle();
- float w = ImGui::CalcItemWidth();
- float spacing = style.ItemInnerSpacing.x;
- float button_sz = ImGui::GetFrameHeight();
- ImGui::PushItemWidth(w - spacing * 2.0f - button_sz * 2.0f);
- if (ImGui::BeginCombo("##vehicleid", elementName.c_str()))
- {
- for (std::map<int, std::string>::iterator it = peds.begin(); it != peds.end(); ++it) {
- elementName = std::to_string(it->first) + " - " + it->second;
- bool isSelected = (pedID == it->first);
- if (ImGui::Selectable(elementName.c_str(), isSelected))
- {
- pedID = it->first;
- if (isSelected)
- ImGui::SetItemDefaultFocus();
- }
- }
- ImGui::EndCombo();
- }
- std::map<int, std::string>::iterator pedIterateID = peds.find(pedID);
- ImGui::PopItemWidth();
- ImGui::SameLine(0, spacing);
- if (ImGui::ArrowButton("##l", ImGuiDir_Left))
- {
- if (pedIterateID->first > 0)
- pedIterateID = --pedIterateID;
- pedID = pedIterateID->first;
- if (pedID < 0)
- pedID = 0;
- }
- ImGui::SameLine(0, spacing);
- if (ImGui::ArrowButton("##r", ImGuiDir_Right))
- {
- if (pedIterateID->first < 299)
- pedIterateID = ++pedIterateID;
- pedID = pedIterateID->first;
- if (pedID > 299)
- pedID = 299;
- }
- ImGui::SameLine(0, style.ItemInnerSpacing.x);
- ImGui::Text("Ped ID");
- if (ImGui::Button("Spawn ped", ImVec2(100, 20)))
- {
- CStreaming::RequestModel(pedID, 0);
- CStreaming::LoadAllRequestedModels(false);
- CPed* ped = new CCivilianPed(CPopulation::IsFemale(pedID) ? PED_TYPE_CIVFEMALE : PED_TYPE_CIVMALE, pedID);
- if (ped)
- {
- ped->SetPosn(pLocalPlayer->TransformFromObjectSpace(CVector(0.0f, 5.0f, 2.0f)));
- CVector pedOrientation;
- pLocalPlayer->GetOrientation(pedOrientation.x, pedOrientation.y, pedOrientation.z);
- ped->SetOrientation(pedOrientation.x, pedOrientation.y, pedOrientation.z);
- CWorld::Add(ped);
- ped->PositionAnyPedOutOfCollision();
- ped->m_pIntelligence->m_TaskMgr.SetTask(new CTaskSimpleGoToPoint(PEDMOVE_WALK, pLocalPlayer->GetPosition(), 1.5f, true, true), 4, false);
- }
- }
- //ImGui::End();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement