MAFINS / MenyooSP

[or Menyoo PC] - Trainer/mod menu for Grand Theft Auto V (single-player).
https://www.gta5-mods.com/scripts/menyoo-pc-sp
GNU General Public License v3.0
771 stars 491 forks source link

Numpad 0 does not return with new LSC options #488

Closed itsjustcurtis closed 1 year ago

itsjustcurtis commented 1 year ago

Really struggling with a fix for this, as far as I can tell the back button and numpad 0 trigger the exact same IsButtonTapped script, as bellow

case Button::Back: isTapped = IS_DISABLED_CONTROL_JUST_PRESSED(2, INPUT_FRONTEND_RRIGHT) || IsKeyJustUp(VirtualKey::Numpad0); break;

However, when if (MenuPressTimer::IsButtonTapped(MenuPressTimer::Button::Back)) is true, the game correctly sets the previous mod parts, but wont go back a menu if numpad 0 is used.

In testing, there is a very brief moment where the menu length drops to 1/1 before returning to the vehicle option that was being selected, and moving the selection back to the first entry, implying that the menu attempts to go up a level but is cancelled for some reason.

On putting SetSub::Previous; back into the above if statement, menyoo will correctly go back one for a numpad 0 press, but will go all the way back to vehicle options (2 levels) if B or backspace is used.

To me this says that the IsButtonTapped if statement somehow interrupts the original setsub::previous functionality, but I cannot find a way around this.

MAFINS commented 1 year ago

I was surprised it was working in the first place with the back button. This is what I expected it to behave like. I guess it is the case with the keyboard hook. The key only returns as tapped/released once. So calling the function twice won't work both times. It may be that the issue is something else entirely but this is the first thing that comes to mind. Can implement some sort of OnBack event for the submenus with a callback and some arguments to do whatever, I guess. I'll look into it sometime.