manups4e / ScaleformUI

ScaleformUI is a GTA menu styled API made with custom Scaleforms to be lighter, faster and visually better
Other
139 stars 49 forks source link

2 or more menus showing up #217

Open RealMrCactus opened 1 month ago

RealMrCactus commented 1 month ago
RegisterCommand("echeveria", function ()
    menu:Visible(true)
end, false)

RegisterKeyMapping("echeveria", "Opens the trainer", "KEYBOARD", "f1")

thats how ive been opening it and there is only one menu declared

manups4e commented 1 month ago

I have no experience on key mappings 🤔 but on ticks this doesn't happen.. might happen that commands are executed twice tho 🤔

manups4e commented 1 month ago

Also.. if you restart your script without closing the menu first.. a new instance will open.. that's scaleforns..

RealMrCactus commented 1 month ago

i dont think so because if i do the command manually it still happens

RealMrCactus commented 1 month ago

Also.. if you restart your script without closing the menu first.. a new instance will open.. that's scaleforns..

yeah ive been making sure to close it

RealMrCactus commented 1 month ago

image

manups4e commented 1 month ago

the menu opens twice only when visible is set to true 🤔 unless you set Visible(true) twice there's no logic way to make it appear twice i made multiple checks into that.. unless your command is executing twice 🤔

RealMrCactus commented 1 month ago

image well im not sure then

Slyker commented 1 month ago

On my side when closed I need to send command twice so it opens after being closed (esc) Lua

manups4e commented 1 month ago

I don't use commands so I can't say why this happens.. if you check the example.lua I open the menu via classic IsControlJustPressed native 🤔 and it works flawlessly 🤔 I'll try to investigate but I can't control commands natives

RealMrCactus commented 1 month ago

I don't use commands so I can't say why this happens.. if you check the example.lua I open the menu via classic IsControlJustPressed native 🤔 and it works flawlessly 🤔 I'll try to investigate but I can't control commands natives

i perfer registerKeybind and command so people can set a different keybind if they want

manups4e commented 1 month ago

ok so... i've been trying to use this

RegisterCommand("echeveria", function ()
    CreateMenu()
end, false)

RegisterKeyMapping("echeveria", "Opens the trainer", "KEYBOARD", "f1")

and everything is working fine with example menu

Swellington-Soares commented 1 week ago
RegisterCommand("echeveria", function ()
    menu:Visible(true)
end, false)

RegisterKeyMapping("echeveria", "Opens the trainer", "KEYBOARD", "f1")

thats how ive been opening it and there is only one menu declared

You can put like this:

RegisterCommand('openptfxmenu', function()
    if menu and not MenuHandler:IsAnyMenuOpen() then
        menu:Visible(true)
    end
end)

CreateThread(function()
    CreatePtfxMainMenu() -- create menu 
    RegisterKeyMapping('openptfxmenu', 'Open PTFX Test Menu', 'KEYBOARD', 'F1') -- keybind
end)
manups4e commented 1 week ago

Thanks for the hint I'll test this in the next days and report 🤔

manups4e commented 2 days ago

using the code you provided i did

RegisterCommand('openptfxmenu', function()
    if exampleMenu and not MenuHandler:IsAnyMenuOpen() then
        exampleMenu:Visible(true)
    end
end)

CreateThread(function()
CreateMenu() -- create menu 
    RegisterKeyMapping('openptfxmenu', 'Open PTFX Test Menu', 'KEYBOARD', 'L') -- keybind
end)

and this is the result

image

i would suggest you to use the correct quake command alike intended for this feature.. so

image

as you can see i added a minus before the command this is intended for commands that we want to execute once without toggling things.

quick explanation: image

if you want it to be a +command in this case the command would be

RegisterCommand('+openptfxmenu', function()
    if exampleMenu and not MenuHandler:IsAnyMenuOpen() then
        exampleMenu:Visible(true)
    else 
    MenuHandler:CloseAndClearHistory()
    end
end)
Mathu-lmn commented 17 hours ago

What's this issue's status ?

RealMrCactus commented 17 hours ago

Busy with stuff ATM but will test stuff ASAP