[Release] ActionMenu [1.0.1] (Updated April 2018)

I am busy with other projects so haven’t gotten round to doing it.

Hi great release! Everything works as it should. However I had a question that may be difficult or even impossible to answer.

How would I use this to trigger another UI?

Let’s say for example I wanted to create a menu button to open ‘mellotrainer’

or any other menu thats out there. Thanks any information would be helpful.

I tried messing around a bit (im pretty new to this), however I could not get it to load when using multiple “ui_pages”. With only one ui_page. The action menu shows, but the second menu does not.

Hi,

can someone direct me to add esx_addoninventory to that?

Quick Question can you make a button call a esx function if so It would be great if someone could show me da way :wink:

Any suggestion how to make this controllabel woth the uparrown and downarrow?

Did you find a solution because I want to change this as well

How can I make it so it doesn’t close the menu once i have selected a button, so the only way to exit is through the button or the ESC key?

I think I found a solution. Under all the options in cl_toolbox.lua remove:

ToggleActionMenu()

Hey!

I would really use functions for such things.

Wil also save’s you adding 2 buttons for ON/OFF

----
instead of calling the handler you would do in the button somthing like this ;

btnToggleVehEngine()

If the players car is on, and it clicks the button it will turn it OFF otherwise ON.



function btnToggleVehEngine()
    player = GetPlayerPed(-1)
    local vehicle = GetVehiclePedIsIn(player, false)
    if IsVehicleEngineOn(vehicle) then
        SetVehicleEngineOn(vehicle, false, false, true)
        SetVehicleUndriveable(vehicle, true)
    else
        SetVehicleEngineOn(vehicle, true, false, true)
        SetVehicleUndriveable(vehicle, false)
    end
end

Goodluck’ :v:

is there a way to make the menus the same as a button? So on the click to open the menu i can do something?

Hey all still learning the menu but really enjoying it just have 1 issue, I have some buttons set to jobs like police etc but for example if a player is a police then they change to mechanic, in order to use the mechanic buttons the script has to be restarted. Any idea?

Hey, where do I find data-actions to put in the menu?? Like an Engine Toggle

Either copy someone’s engine toggle event from a different script into your script and then call the event when the button gets pressed. I might be able to send what I have…

1 Like

how to add additude styles?

If you could send one so I can understand what it is you’re saying aha

This would be an example for the engine toggle and rolling the front windows since one uses a function and the other an event…You can also call events in different scripts like if you had a radar etc. First block is the function and event calls.

RegisterNUICallback( "ButtonClick", function( data, cb ) 
	if ( data == "button1" ) then 
		EngineToggle()
	elseif ( data == "button2" ) then 
		TriggerEvent('frontWindow')

Second block is the event handler for toggling the windows

-- Open Front windows

local windowup = true
RegisterNetEvent("frontWindow")
AddEventHandler('frontWindow', function()
    local playerPed = GetPlayerPed(-1)
    if IsPedInAnyVehicle(playerPed, false) then
        local playerCar = GetVehiclePedIsIn(playerPed, false)
		if ( GetPedInVehicleSeat( playerCar, -1 ) == playerPed ) then 
            SetEntityAsMissionEntity( playerCar, true, true )
		
			if ( windowup ) then
				RollDownWindow(playerCar, 0)
				RollDownWindow(playerCar, 1)
				drawNotification("You rolled down your front windows.")
				windowup = false
			else
				RollUpWindow(playerCar, 0)
				RollUpWindow(playerCar, 1)
				drawNotification("You rolled up your front windows.")
				windowup = true
			end
		end
	end
end )

Third block is the function for toggling the engine

---------------- Engine Vehicle ----------------

function EngineToggle()

    local ped = GetPlayerPed(-1)
    local veh = GetVehiclePedIsIn(ped, false)
	
	if IsPedInAnyVehicle(ped) then
        if IsVehicleEngineOn(veh) then
            SetVehicleEngineOn(veh, false, false, true)
            SetVehicleUndriveable(veh, true)
		    TriggerEvent("chatMessage", "", {255, 0, 0}, "Your engine has been turned off!")
        else
            SetVehicleEngineOn(veh, true, false, true)
            SetVehicleUndriveable(veh, false)
		    TriggerEvent("chatMessage", "", {255, 0, 0}, "Your engine has been turned on!")
        end
	else
	    drawNotification('~r~You are not in a vehicle.')
	end
end

See below. I don’t think I replied to your comment.

how can i add additude styles? walking styles? like move_m@injured

Thank you so much!

1 Like

If you are going to camel casing use it throught your code lmao