fix(TabSpawn): Input enter returns true & improved code
This commit is contained in:
parent
79a59603b5
commit
c4b6e7698d
@ -9,9 +9,10 @@ namespace big
|
|||||||
{
|
{
|
||||||
if (ImGui::BeginTabItem("Spawn"))
|
if (ImGui::BeginTabItem("Spawn"))
|
||||||
{
|
{
|
||||||
ImGui::InputText("Model Name", model, sizeof(model));
|
if (
|
||||||
|
ImGui::InputText("Model Name", model, sizeof(model), ImGuiInputTextFlags_EnterReturnsTrue) ||
|
||||||
if (ImGui::Button("Spawn"))
|
ImGui::Button("Spawn")
|
||||||
|
)
|
||||||
{
|
{
|
||||||
QUEUE_JOB_BEGIN_CLAUSE(= )
|
QUEUE_JOB_BEGIN_CLAUSE(= )
|
||||||
{
|
{
|
||||||
@ -19,17 +20,13 @@ namespace big
|
|||||||
|
|
||||||
if (hash)
|
if (hash)
|
||||||
{
|
{
|
||||||
int tries = 0;
|
for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++)
|
||||||
const int max = 100;
|
|
||||||
while (!STREAMING::HAS_MODEL_LOADED(hash) && tries < max)
|
|
||||||
{
|
{
|
||||||
STREAMING::REQUEST_MODEL(hash);
|
STREAMING::REQUEST_MODEL(hash);
|
||||||
|
|
||||||
tries++;
|
|
||||||
|
|
||||||
script::get_current()->yield();
|
script::get_current()->yield();
|
||||||
}
|
}
|
||||||
if (tries >= max)
|
if (!STREAMING::HAS_MODEL_LOADED(hash))
|
||||||
{
|
{
|
||||||
features::notify::above_map("~r~Failed to spawn model, did you give an incorrect model?");
|
features::notify::above_map("~r~Failed to spawn model, did you give an incorrect model?");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user