ContextMenu v2.0 - Major Update!

Alright. After the third time of someone trying to sell this menu framework I am done. I really wanted to bring out further updates and keep improving it.

As an effect support for this resource will be dropped immediately. I will not answer any questions unless I somehow feel like it.
There might be further updates in the future, but this just killed any motivation of working on this project.










Showcase Video

ContextMenu

ContextMenu is a script that allows you to create your own menus for any kind of purpose. It does nothing by itself. You hold a button and your cursor appears on the screen. You can then click on any object and open specific menus for specific objects. This is kind of like your default rightclick menu in every other application. E.g. clicking on a player can have a completely different menu than clicking on a vehicle.

This is a major update to the version that was uploaded around a year ago. The old topic can be found here.

:clipboard: Features

  • Create custom context based menus using LUA.
  • Menu items include:
    • Item: Just has text and can be clicked.
    • SpriteItem: Background image and can be clicked.
    • TextItem: Just text and no functionality.
    • CheckboxItem: Has a text and a checkbox that can be checked.
    • SubmenuItem: Automatically created when creating a submenu to a menu.
    • Separator: Just a separator line to group items together.
  • Use custom sprites on the right and left side of an item.
  • Extensive customizability with more to come!
  • Easily create custom ingame UI elements using the following elements:
    • Sprites (with UV coordinates)
    • Text (with all settings)
    • Rectangles
  • All elements can be parented, positioned, scaled etc.
  • Compatible with basically everything? Might collide with other targeting scripts.

:floppy_disk: Download

Download the latest ContextMenu.zip file and extract it into your resources folder.

:fire: Performance

  • The script itself draws no performance at all.
  • When you have created your own menu, the performance depends on the amount of items that are currently displayed on the screen.

FAQ

Is this still WIP and will it be expanded upon?

  • Yes, this script is very much a work-in-progress project.
  • A lot of things will be added and changed throughout this process.
  • If you have any suggestions on changes or find features missing, just let me know and I’ll see what is possible and can be done.

How can I create a custom menu?

  • The documentation is currently WIP and can be accessed in the Github repository: Home · Kiminaze/ContextMenu Wiki · GitHub
  • You can also take a look at the included example and try and figure it out for yourself. It is not difficult!

Known Issues

  • No Controller support as of now.

Update v2.0 introduced the following changes:

All patchnotes can be found on the release page.

  • Completely reworked every single part of the code. Not compatible with prior versions!
  • Basically now acts as a giant UI library for FiveM: All UI elements can now be parented to other UI elements to make positioning and scaling much easier.
  • Better performance while menu is open.
  • Menu background is now a Sprite that can be changed to better fit your own server aesthetics instead of just a grey background.
  • Added Scroll- and PageMenu which both allow for an unlimited number of items without cluttering the screen.
  • Added exports for creating the menu. Several scripts can add items / submenus to the default menu without overlapping each other.
  • Added SpriteUV for controlling the UVs of a sprite directly.

:coffee: Support me

If you want to further support my work, consider taking a look at my Tebex store . Maybe you can find something you would like :smiling_face_with_three_hearts:

9 Likes

looking nice

2 Likes

Best menu ever, I love it!

1 Like

Nice Release

1 Like

Hello Kiminaze ty like for your work ! :slight_smile:
It’s perfect like always !

1 Like

Hello, I would like to know how to add triggers from other scripts to the context menu because I can’t do it

Alright. After the third time of someone trying to sell this menu framework I am done. I really wanted to bring out further updates and keep improving it.

As an effect support for this resource will be dropped immediately. I will not answer any questions unless I somehow feel like it.
There might be further updates in the future, but this just killed any motivation of working on this project.

Raycasting. Check the file Utils/screenToWorld.lua for more specific information.

How can i config Caps to open the menu?
Cause i cant open the original contextmenu

Check for control IDs here: Controls - Cfx.re Docs

And you can edit controls in ContextMenu/Menu/MenuPool.lua line 13-15

okay nice ty and i want to do a menu when you click on another player to example give him cash but i don’t know how can you help me?

Check the included example code for reference.

local ECM = exports["ContextMenu"]

ECM:Register(function(screenPosition, hitSomething, worldPosition, hitEntity, normalDirection)
	if (not DoesEntityExist(hitEntity) or not IsEntityAPed(hitEntity) or not IsPedAPlayer(hitEntity)) then
		return
	end

	local ped = hitEntity

	local itemDoSomething = ECM:AddItem(0, "Do something")
	ECM:OnActivate(itemDoSomething, function()
		-- whatever you want to do
	end)
end)

However I do not give proper support for this resource anymore.
See:

Basically anything you need is explained in the wiki on the github repository.

sorry i didn’t see but thank you i will try !

1 Like

Hello, when I open the menu with ALT, it gives me an in-game message “Command Invalid - /interaction”
do you know how to fix this problem?

That must be coming from another script that maybe uses the ALT key in a RegisterKeyMapping context?

This script still runs on the default IsControlPressed controls and doesn’t use any sort of key mappings and there is no such console print anywhere.

Indeed I had the esx_context in conflict but when I remove the esx_context and I connect to the server it remains stuck on a black screen with “Awaiting Script” written at the bottom right

This menu is not a straight up replacement for esx context and you probably cannot just remove it from esx.
However you can adjust the keys in line 13-15 in menu/MenuPool.lua to your liking. Check here for the ids: Controls - Cfx.re Docs

even after changing the keys, it still tells me the same thing…

Then I’m sorry, but I don’t know what my resource could be causing here :man_shrugging:

1 Like