[Release] RadialMenu - Configurable menu for chat commands using Wheelnav.js

that’s weird when im on chra selection the pointer won’t show up to chose the char :S

I get this error. Why I get this error. Have an any idea?

Did you change resource’s name? It has to stay original

Resource name = ‘radialmenu’
Exactly, If player in any car then I want show another menu.

Code
            Citizen.Wait(0) 		
	if IsPedInAnyVehicle(playerPed,  false) then
		if	menuConfig.wheels[1].name == "wheelInner" then	
			menuConfig.wheels = {
				{
					name = "inCar",
					navAngle = 270,
					minRadiusPercent = 0.3,
					maxRadiusPercent = 0.6,
					labels = {"CANCEL", "NO"},
					commands = {"e cancel", "e no"}
				} 
			} 
			  SendNUIMessage({
				type = 'init',
				data = menuConfig,
				resourceName = GetCurrentResourceName()
			})
			
		end 
	elseif	menuConfig.wheels[1].name == "inCar" then		
			menuConfig.wheels = {
				{
					name = "wheelInner",
					navAngle = 270,
					minRadiusPercent = 0.3,
					maxRadiusPercent = 0.6,
					labels = {"CANCEL", "NO", "CHEER", "CLAP", "FOLDARMS", "LEAN"},
					commands = {"e cancel", "e no", "e cheer", "e slowclap", "e foldarms", "e leanwall"}
				},
				{
					name = "wheelOuter",
					navAngle = 285,
					minRadiusPercent = 0.6,
					maxRadiusPercent = 0.9,
					labels = {"SALUTE", "FINGER", "PEACE", "FACEPALM", "DAMN", "FAIL", "DEAD", "GANG1", "GANG2", "COP", "HOLSTER", "CROWDS"},
					commands = {"e salute", "e finger", "e peace", "e palm", "e damn", "e fail", "e dead", "e gang1", "e gang2", "e copidle", "e holster", "e copcrowd2"}
				}
			} 
			  SendNUIMessage({
				type = 'init',
				data = menuConfig,
				resourceName = GetCurrentResourceName()
			})
	end
    -- When F6 key is pressed toggle UI
    if IsControlPressed(0, keybindControl) then
        -- Show UI
        showMenu = true
        SetCursorLocation(0.5, 0.5)
        SendNUIMessage({
            type = 'show'
        })
        SetNuiFocus(true, true)

        -- Bootleg way to prevent menu from showing again until key is released
        while showMenu == true do Citizen.Wait(100) end
        Citizen.Wait(100)
        while IsControlPressed(0, keybindControl) do Citizen.Wait(100) end
    end
end
2 Likes

Updated the release with a ton of new features based on feedback, if you see any issues please let me know :slight_smile:

VERSION_V1_10

  • Moved configuration options to separate config.lua file
  • Changed menu to use init/destroy on the fly to support multiple menus
  • Changed Javascript to auto-center menu in the middle of the screen
  • Added config function to enable/disable menu based on player context
  • Added sound effects for opening and clicking menu

Good to hear, I updated the release with a bunch of changes to support multiple menus, easier customization and ability to enable/disable menus based on player context (e.g. only show when in a vehicle). The example config shows you how to add multiple menus as well as how you can put multiple menus on the same key using the enableMenu function.

See the latest release and above info, should be what you’re looking for (just so happened to already be working on it :stuck_out_tongue:)

1 Like

hello ma friend , i download your script today , But im facing a problem , the MENU works but i dont get any animations , http://prntscr.com/nv4oey Do you have any solution for this problem ?

Do i need any other animation script or something like that?

thanks :slight_smile:

Yes, from the main post:

Looks really good. Are you planning to add something like this down the road? (forgot where this is from)

25

7 Likes

The cancel button does not seem to work for me.
I even tried registering my own command and still nothing. Am I doing something wrong.
Other then this its a great script. The community Im with loves it we just cant seem to fix this.

RegisterNetEvent("cancelemote")
AddEventHandler("cancelemote", function()
  ClearPedTasksImmediately(PlayerPedId())
	end
end)
RegisterCommand("cancel", function(source, args, raw)
    TriggerEvent("cancelemote")
end, false)

Edit: Also does not seem to work for multiple people. Gets stuck on loading.

1 Like

press again the button that starts the animation, it works fine

Awesome release! anyway to stop the animations from doing a loop instead of clicking the animation again? Also would love a smoke cigarette emote rather than just having one in the mouth is that at all possible as well. Again thanks for the sick resource !

1 Like

Anyone else getting stuck with the wheel open and no emotes playing ?

Also I have an issue when I disconnect and reconnect, i get a message in chat saying ERROR: Invalid emote name, and have to restart the emote script in order to bypass this each time? https://gyazo.com/6d928b01e40247af7c3f7b147b2242b8

@Brent_Peterson
Can you add a button to cancle the animation?

1 Like

The script itself is more of a dev tool to add a physical button bound to a chat command. Add your own cancel emote button, it’s not hard.

haaaaaaaaaa OK , thanks , Im new at this , thanks for the help :slight_smile: great job !!! keep doing what you are doing :slight_smile:

This theme very nice.

I hope this design is implemented.

me too

1 Like

Thank you. You can already design a similar looking menu by using icons instead of text labels and changing the slice style settings:

Edit config.lua to change style settings and use icon labels:

-- Menu configuration, array of menus to display
menuConfigs = {
    ['emotes'] = {
        enableMenu = function()
            return true
        end,
        data = {
            keybind = "F6",
            style = {
                sizePx = 500,
                slices = {
                    default = { 
                        ['fill'] = '#000000', 
                        ['stroke'] = '#000000', 
                        ['stroke-width'] = 2, 
                        ['opacity'] = 0.60 
                    },
                    hover = { 
                        ['fill'] = '#ff8000', 
                        ['stroke'] = '#000000', 
                        ['stroke-width'] = 2, 
                        ['opacity'] = 0.80 
                    },
                    selected = { 
                        ['fill'] = '#000000', 
                        ['stroke'] = '#000000', 
                        ['stroke-width'] = 2, 
                        ['opacity'] = 0.60 
                    }
                },
                titles = {
                    default = { 
                        ['fill'] = '#ffffff'
                    },
                    hover = { 
                        ['fill'] = '#ffffff'
                    },
                    selected = { 
                        ['fill'] = '#ffffff'
                    }
                }
            },
            wheels = {
                {
                    navAngle = 270,
                    minRadiusPercent = 0.4,
                    maxRadiusPercent = 0.9,
                    labels = {
                        "imgsrc:cancel.png", 
                        "imgsrc:car.png", 
                        "imgsrc:home.png", 
                        "imgsrc:money.png", 
                        "imgsrc:phone.png"
                    },
                    commands = {
                        "", 
                        "", 
                        "", 
                        "", 
                        ""
                    }
                }
            }
        }
    }
}

Add icons to __resource.lua:

resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"

client_script {
    "config.lua",
    "radialmenu.lua"
}

ui_page "html/menu.html"

files {
	"html/menu.html",
	"html/raphael.min.js",
	"html/wheelnav.js",
    "html/wheelnav.min.js",
    "html/cancel.png",
    "html/car.png",
    "html/home.png",
    "html/phone.png",
    "html/money.png"
}

note: this is just a quick example to show how to use icons and change the style, you need to source your own images and design your own layout based on what commands you want.

@AbdulkadirAktas

6 Likes