(C#) MenuAPI - MAPI v3.0.3 [RedM & FiveM]

What you’ve downloaded it’s the source code of the API, you have to compile it yourself and create the resource. And even after that nothing will work unless you write a script which will use such API

Works great!

Something that I’d love to be added (maybe you’ve already planned it):

  • Change menu banner with either a sprite or color

To add to what @Neos7 said:

Read the first post, specifically the important note part. This isn’t a plug 'n play resource. It’s for developers.

so do we HAVE to have this with the new update?

What update?

With the new vmenu

MenuAPI is included with vMenu, you don’t need to download this separately.

Any idea why it’s throwing this error?

Loaded vMenuShared.net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null into ScriptDomain_484891820
Loaded vMenuServer.net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null into ScriptDomain_484891820
Instantiated instance of script GHMatti.Http.RequestInternal.
Instantiated instance of script GHMatti.Http.Request.
Instantiated instance of script vMenuServer.BanManager.
Loaded Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed into ScriptDomain_484891820
error in mono_error_set_method_load: Could not find method with signature string

Failed to instantiate instance of script vMenuServer.MainServer: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method 'CitizenFX.Core.Debug.WriteLine' not found.
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00014] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at CitizenFX.Core.InternalManager.CreateAssemblyInternal (System.Byte[] assemblyData, System.Byte[] symbolData) [0x00069] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\InternalManager.cs:78
error in mono_error_set_method_load: Could not find method with signature string

Failed to instantiate instance of script vMenuServer.UpdateChecker: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method 'CitizenFX.Core.Debug.WriteLine' not found.
  at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at vMenuServer.UpdateChecker.CheckUpdates () [0x0001b] in <50108f3a61d04f0aa2f092547134ebc9>:0
  at vMenuServer.UpdateChecker..ctor () [0x00006] in C:\projects\vmenu\vMenuServer\UpdateChecker.cs:24
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00014] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
  at CitizenFX.Core.InternalManager.CreateAssemblyInternal (System.Byte[] assemblyData, System.Byte[] symbolData) [0x00069] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\InternalManager.cs:78
Started resource vMenu

Uhm somehow the client api set is broken. It’s missing Debug.WriteLine.

My apologies, This was meant for the vMenu topic.

Ok thanks

Excellent work on this, will be using in all my C# resources

1 Like

Has anyone had any issues where if I use the MenuAPI on another resource (such as my house system) even though this menu is not even scripted to open yet when I open the vMenu menu my house menu pops up too?

uhm, are you referencing the dll from the vMenu folder? or did you include it in your own resource? I’m not sure if that would even matter, but I just tested with vMenu and another ‘test’ menu both having MenuAPI.net.dll in their own resource folder & __resource.lua, one using the Q key and the other using the M key, they work separately just fine. No issues at all…

I am just referencing the DLL inside my project. I don’t even have a key to open it yet because I am using a marker and a key so it is weird that it is opening with vMenu.

I mean at this moment this is all it is.

        public void GenerateMenu()
        {
            MenuController.MenuAlignment = MenuController.MenuAlignmentOption.Right;
            houseManageMenu = new Menu("House Manager");
            keyholdersMenu = new Menu("House Keyholders", "Current house keyholders");
            MenuController.AddSubmenu(houseManageMenu, keyholdersMenu);

            MenuItem keyholdersButton = new MenuItem("Key Holders")
            {
                Label = "→→→"
            };
            houseManageMenu.AddMenuItem(keyholdersButton);
            MenuController.BindMenuItem(houseManageMenu, keyholdersMenu, keyholdersButton);
        }

another edit…

Even when I pass this

        public void OpenHouseManagerMenu(int _houseIndex)
        {
            currentHouseIndex = _houseIndex;
            houseManageMenu.Visible = true; // This
            houseManageMenu.OpenMenu(); // or This
            Utils.Message($"Current House Manager Index: {currentHouseIndex}");
        }

the menu doesn’t seem to open. It only opens with vMenu XD.

default open key for MenuAPI is set to M (interaction menu).

Just call this if you don’t want any key to open or close it:

MenuController.MenuToggleKey = (Control)(-1);

Ah. Alright. :man_facepalming: I didn’t know that there was a default key. I just over looked it I guess… That fixed the problem I was having. Thank you.

Haven’t really been keeping up with the changelog stuff here.
Just pushed v1.1.1 to releases.

For a summary of all changes since v1.0.4, checkout this page:

MenuAPI v1.1.2

+ MC: Add option to disable controller menu toggle key. (bool EnableMenuToggleKeyOnController (true (enabled) by default))

Ok, I feel stupid but I just want to use this with vMenu do I just put it with my server files at the FXServer Directory ?