ContextMenu - Create a new kind of menu! [OUTDATED - Check description]

This version is now outdated. Head on over to the new topic to find an updated post!





Showcase Video

:scroll: 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.

Clicking on a player can have a completely different menu than clicking on a vehicle.

:clipboard: Features

  • Create custom menus using LUA.
  • Menu items include:
    • TextItem: Just has text and can be clicked.
    • 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.
    • More to come depending on demand.
  • Use custom sprites on the right side of an item.
  • Fully customizable with width, height and colors (background, highlighted background, text, highlighted text, sprite, menu border, separator lines).
  • Includes the full source code.
  • Compatible with basically everything? Let me know if you find any issues!

: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.
  • The Client side performance of the Advanced Vehicle Interaction menu is around 0.25ms when the main menu is shown.

:open_book: Documentation

ContextMenu | Documentation

: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:

18 Likes

Nice release Kiminaze !

I love u and hate u at the same time, I just finished my bt-target adaptation in all my scripts today and now I need to redo it :crazy_face:

PS: Only question do the checkbox is memorized only on a specific target ? Or for all targets with the same models (I’m reading the script actually not testing :nerd_face:)

2 Likes

No way! Love it!

2 Likes

<3

Well now I’m sooorry :wink:

No. It is only memorized for the menu itself. But e.g. in Advanced Vehicle Interaction the menu is re-generated every time it is opened and thus setting it depending on what you set it to.
If you only generate it once, it is only saved per menu.

2 Likes

is this different from the other ContextMenu ?

I don’t personally know how other context menus work but I would say the core might be the same.

My script only uses natives. I don’t use any HTML / CSS etc. in this :slight_smile:

1 Like

Good job, i think this can change the script Game :wink:

1 Like

Man, this is beautiful! Pure art! Incredible. Tnks for share this free! You are amazing <3

1 Like

dopeeeeeee
good job homie

1 Like

Good job but i will still prefer NUI based instead of native system…why? Its more optimized
But still very nice share

1 Like

how to fuck open it

That is a real nice way to introduce yourself to a community. Thanks for that.

This script does nothing by itself.
If you want to see the example menu, make sure it is active in the fxmanifest.lua and then ingame hold Left Alt and right click things.

how to open menu

Literally the message above you :smiley:

New update adding more functionality.

And as an additional note:
The wiki is now actively being worked on and can be found here:

It would be great If you could have the option of creating job menus! I have more or less done something like that but when I change jobs from police to mechanic I still have the police menu, until I restart the script or reconnect

Well, that depends on how you build the menu.

If you create it once with e.g. police job and then change to another job, you need to change the contents of the menu ofc.
Or create several menus for the jobs, but only the display the one for the job theplayer has.

I have something like that!

itizen.CreateThread(function()
            if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
                local menu_meca = menuPool:AddSubmenu(contextMenu, "Mechanic")
                local itemDelete = menu_meca:AddItem("Eliminar vehiculo")
                itemDelete.OnClick = function()
                    if (vehicle ~= nil and DoesEntityExist(vehicle)) then
                        SetEntityAsMissionEntity(vehicle)
                        DeleteEntity(vehicle)
                    end
                end
            elseif ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
                local menu_taxi = menuPool:AddSubmenu(contextMenu, "Taxi")
                local itemDelete = menu_taxi:AddItem("Bill")
                itemDelete.OnClick = function()
                    if (vehicle ~= nil and DoesEntityExist(vehicle)) then
                        SetEntityAsMissionEntity(vehicle)
                        DeleteEntity(vehicle)
                    end
                end
            end   
        end)  

But until I change jobs and restart the plugin, or reconnect I don’t have the appropriate menu :frowning:

That thread only checks the job once when the script starts. That is your problem.

You also need to use the esx events for setJob etc. (I don’t know them as I don’t use esx, but they are usually in every job script).

2 Likes