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

dm me if you fixed the kneelHU part

See how both commands are registered as Trunk? You can’t do that

Try this instead

--trunk
RegisterNetEvent("trunkOpen")
AddEventHandler("trunkOpen", function()
    local Veh = GetVehiclePedIsUsing(GetPlayerPed(-1))
    SetVehicleDoorOpen(Veh, 5, false, false)
end)

RegisterNetEvent("trunkClose")
AddEventHandler("trunkClose", function()
    local Veh = GetVehiclePedIsUsing(GetPlayerPed(-1))
    SetVehicleDoorShut(Veh, 5, false)
end)

	elseif ( data == "trunkopen" ) then
   	 TriggerEvent( 'trunkOpen' )

	elseif ( data == "trunkclose" ) then
   	 TriggerEvent( 'trunkClose' )

I bet that works for you.

If you look at who i gave credit to. He has 2 versions the other one allows for the car to turn on 3.5 seconds after you get in. Just copy the function from the client.lua and replace the one i gave you w that. Currently using it. Works fine.

I made a version to delete vehicle just add delete vehicle event and now should delete vehicle I will post code when I get back home.

still doesn’t work i even edited the nui and still nothing

Yeah its not working for me either

Alright, I’m gonna try to clear up as much confusion as possible. Once you guys see how it all triggers you can setup tons of scripts on this resource, so its definitely worth taking a moment to learn this stuff.

First things first, get Notepad++ so you can easily edit any .lua script.

Now, we’re going to use the KneelHU script as an example.

Open the cl_action.lua file and scroll down to line #49 this is what it looks like default

RegisterNUICallback( "ButtonClick", function( data, cb ) 
	if ( data == "button1" ) then 
		chatPrint( "Button 1 pressed!" )
	elseif ( data == "button2" ) then 
		chatPrint( "Button 2 pressed!" )
	elseif ( data == "button3" ) then 
		chatPrint( "Button 3 pressed!" )
	elseif ( data == "button4" ) then 
		chatPrint( "Button 4 pressed!" )
	elseif ( data == "exit" ) then 
		-- We toggle the ActionMenu and return here, otherwise the function 
		-- call below would be executed too, which would just open the menu again 
		ToggleActionMenu()
		return 
	end 

	-- This will only be called if any button other than the exit button is pressed
	ToggleActionMenu()
end )

So what this line means RegisterNUICallback( “ButtonClick”, function( data, cb ) is when you hit button1 its going to trigger a command. The default command triggered is going to be chatPrint( “Button 1 pressed!” )

So instead of tirggering a chat text command that says “button 1 pressed” we want this to trigger our KneelHU script on/off.
So we have to edit the following line

RegisterNUICallback( "ButtonClick", function( data, cb ) 
	if ( data == "button1" ) then 
		chatPrint( "Button 1 pressed!" )

Lets remove chatPrint and replace it with the TriggerEvent command so pressing button1 will trigger a lua script

RegisterNUICallback( "ButtonClick", function( data, cb ) 
	if ( data == "button1" ) then 
		TriggerEvent( 'KneelHU' )

Now pressing button1 in the actionmenu will trigger my .lua KneelHU script.
We’re not quite done cause we gotta clean up the menu and rename the button so keep reading.

Go back to where you have the resource installed and go to serverfiles\wk_actionmenu\nui folder
open the ui.html script in notepad++
We want to look around line 26, it looks like this

        	<div id="mainmenu">
	            <button class="menuoption" data-sub="examplesubmenu">Example Submenu</button>
	            <button class="menuoption" data-action="button1">Example Button 1</button>
	            <button class="menuoption" data-action="button2">Example Button 2</button>
			</div>

see how it says data-action=“button1” <— this is the man in the middle for triggering lua scripts from the actionmenu
Look at the part of the script we just edited for the Kneel command.

RegisterNUICallback( "ButtonClick", function( data, cb ) 
	if ( data == "button1" ) then 
		TriggerEvent( 'KneelHU' )
if ( data == "button1" ) then -- cl_action.lua script
data-action="button1">Example Button 1</button> -- UI.html script

If those lines are not using a matching keyword such as: button1 THE SCRIPT WILL NOT EXECUTE!

Now to fully complete the script and make the menu properly display the button name "Kneel with Hands Up"

cl_action.lua

RegisterNUICallback( "ButtonClick", function( data, cb ) 
	if ( data == "kneel" ) then 
		TriggerEvent( 'KneelHU' )

Ui.html

        	<div id="mainmenu">
	            <button class="menuoption" data-sub="examplesubmenu">Example Submenu</button>
	            <button class="menuoption" data-action="kneel">Kneel with Hands Up</button>
	            <button class="menuoption" data-action="button2">Example Button 2</button>
			</div>

Instead of button1 being our keyword we replaced it with kneel

This will now tell actionmenu to trigger the KneelHU script and we renamed the button to Kneel with Hands Up
That’s it for adding KneelHU to the action menu!

Now if you are wondering what other scripts work for this, it’s a ton of them lets take a look at the KneelHU code and I’ll show you why we used KneelHU in our TriggerEvent( ‘KneelHU’ ) command.

Paste this code into the very bottom of our cl_action.lua script scroll allllllll the way down beyond any other code already written in there.

--Kneel Handsup Start
 
function loadAnimDict( dict )
    while ( not HasAnimDictLoaded( dict ) ) do
        RequestAnimDict( dict )
        Citizen.Wait( 5 )
    end
end
 
RegisterNetEvent( 'KneelHU' )
AddEventHandler( 'KneelHU', function()
    local player = GetPlayerPed( -1 )
    if ( DoesEntityExist( player ) and not IsEntityDead( player )) then
        loadAnimDict( "random@arrests" )
        loadAnimDict( "random@arrests@busted" )
        if ( IsEntityPlayingAnim( player, "random@arrests@busted", "idle_a", 3 ) ) then
            TaskPlayAnim( player, "random@arrests@busted", "exit", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (3000)
            TaskPlayAnim( player, "random@arrests", "kneeling_arrest_get_up", 8.0, 1.0, -1, 128, 0, 0, 0, 0 )
        else
            TaskPlayAnim( player, "random@arrests", "idle_2_hands_up", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (4000)
            TaskPlayAnim( player, "random@arrests", "kneeling_arrest_idle", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (500)
            TaskPlayAnim( player, "random@arrests@busted", "enter", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (1000)
            TaskPlayAnim( player, "random@arrests@busted", "idle_a", 8.0, 1.0, -1, 9, 0, 0, 0, 0 )
        end    
    end
end )
 
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests@busted", "idle_a", 3) then
            DisableControlAction(1, 140, true)
            DisableControlAction(1, 141, true)
            DisableControlAction(1, 142, true)
            DisableControlAction(0,21,true)
        end
    end
end)

--Kneel Handsup End

Look at the script where it says

RegisterNetEvent( 'KneelHU' )
AddEventHandler( 'KneelHU', function()

RegisterNetEvent( ‘KneelHU’ ) that is our keyword to execute the rest of the code.
You can setup pretty much any script you want as long you know what the keyword the server calls to execute that block of code. So again, in this situation its KneelHU

That should be it, if I messed up or its too confusing then I’ll edit this. I see your pm’s and I like helping you guys but I prefer to give help in public so other people with similar issues can get the answers as well.

If you need to add a back button add this line in your ui.html script

<button onclick="ResetMenu()">Home</button>

to this part of the code near the bottom

<!-- Do not remove this or you will not be able to exit the menu --> 
			<button class="menuoption" data-action="exit">Exit</button>
			<button onclick="ResetMenu()">Home</button>
        </div>

3 Likes

Does the trunk events work for you? I have mine fine. I have many buttons working except for trunk. I added everything exactly how you said in that. and double checked.

Just need some quick help im totally lost here on what to do
this is my cl_action.lua

–[[------------------------------------------------------------------------

ActionMenu 
Created by WolfKnight
Additional help from lowheartrate, TheStonedTurtle, and Briglair. 

------------------------------------------------------------------------]]–

– Define the variable used to open/close the menu
local menuEnabled = false

–[[------------------------------------------------------------------------
ActionMenu Toggle
Calling this function will open or close the ActionMenu.
------------------------------------------------------------------------]]–
function ToggleActionMenu()
– Make the menuEnabled variable not itself
– e.g. not true = false, not false = true
menuEnabled = not menuEnabled

if ( menuEnabled ) then 
	-- Focuses on the NUI, the second parameter toggles the 
	-- onscreen mouse cursor. 
	SetNuiFocus( true, true )

	-- Sends a message to the JavaScript side, telling it to 
	-- open the menu. 
	SendNUIMessage({
		showmenu = true 
	})
else 
	-- Bring the focus back to the game
	SetNuiFocus( false )

	-- Sends a message to the JavaScript side, telling it to
	-- close the menu.
	SendNUIMessage({
		hidemenu = true 
	})
end 

end

–[[------------------------------------------------------------------------
ActionMenu HTML Callbacks
This will be called every single time the JavaScript side uses the
sendData function. The name of the data-action is passed as the parameter
variable data.
------------------------------------------------------------------------]]–
RegisterNUICallback( “ButtonClick”, function( data, cb )
if ( data == “button1” ) then
chatPrint( “Button 1 pressed!” )
elseif ( data == “button2” ) then
chatPrint( “Button 2 pressed!” )
elseif ( data == “button3” ) then
chatPrint( “Button 3 pressed!” )
elseif ( data == “button4” ) then
chatPrint( “Button 4 pressed!” )
elseif ( data == “exit” ) then
– We toggle the ActionMenu and return here, otherwise the function
– call below would be executed too, which would just open the menu again
ToggleActionMenu()
return
end

-- This will only be called if any button other than the exit button is pressed
ToggleActionMenu()

end )

–[[------------------------------------------------------------------------
ActionMenu Control and Input Blocking
This is the main while loop that opens the ActionMenu on keypress. It
uses the input blocking found in the ES Banking resource, credits to
the authors.
------------------------------------------------------------------------]]–
Citizen.CreateThread( function()
– This is just in case the resources restarted whilst the NUI is focused.
SetNuiFocus( false )

while true do 
	-- Control ID 20 is the 'Z' key by default 
	-- Use https://wiki.fivem.net/wiki/Controls to find a different key 
	if ( IsControlJustPressed( 1, 20 ) ) then 
		ToggleActionMenu()
	end 

    if ( menuEnabled ) then
        local ped = GetPlayerPed( -1 )	

        DisableControlAction( 0, 1, true ) -- LookLeftRight
        DisableControlAction( 0, 2, true ) -- LookUpDown
        DisableControlAction( 0, 24, true ) -- Attack
        DisablePlayerFiring( ped, true ) -- Disable weapon firing
        DisableControlAction( 0, 142, true ) -- MeleeAttackAlternate
        DisableControlAction( 0, 106, true ) -- VehicleMouseControlOverride
    end

	Citizen.Wait( 0 )
end 

end )

function chatPrint( msg )
TriggerEvent( ‘chatMessage’, “ActionMenu”, { 255, 255, 255 }, msg )
end

if anyone could help here is my ui.HTML

<body>
    <div id="actionmenu" style="display: none;">
    	<!-- 
    		This mainmenu div should be left as it is, you should change the buttons though.

    		If you want to make a submenu, then you must create a new div, with the ID of the 
    		div being the data-sub attribute of the button that will open it. For example, the 
    		below button Example Submenu, has the data-sub attribute of "examplesubmenu", which
    		is the same id as the div below. All submenus must also have a data-parent attribute. 
    	 -->
    	        <div id="mainmenu">
        <button class="menuoption" data-sub="vehicle">Vehicle</button>
        <button class="menuoption" data-sub="leo">LEO</button>
        <button class="menuoption" data-sub="civ">Civilian</button>
	</div>
	
	<div id="vehicle" data-parent="mainmenu" style="display: none;">
		<button class="menuoption" data-action="engine">Turns Engine On/Off</button>
		<button class="menuoption" data-action="trunk">Opens Trunk</button>
		<button class="menuoption" data-action="windows">Rolls Down Window</button>
		<button class="menuoption" data-action="doors">Opens Doors</button>
	</div>
		
	<div id="leo" data-parent="mainmenu" style="display: none;">
		<button class="menuoption" data-action="stun_gun">Equips Stun Gun</button>
		<button class="menuoption" data-action="cuff">Cuffs Player</button>
		<button class="menuoption" data-action="drag">Drags Player</button>
		<button class="menuoption" data-action="seat">Puts Player In Vehicle</button>
		<button class="menuoption" data-action="unseat">Takes Player Out Of Vehicle</button>
	</div>
	
	<div id="civ" data-parent="mainmenu" style="display: none;">
		<button class="menuoption" data-action="assault_rifle">Equips Assault Rifle</button>
		<button class="menuoption" data-action="pistol">Equips Pistol</button>
		<button class="menuoption" data-action="handsup">Puts Hands Up</button>
		<button class="menuoption" data-action="handsup_knees">Gets On Knees With Hands Up</button>
    </div>
		<!-- Do not remove this or you will not be able to exit the menu --> 
		<button class="menuoption" data-action="exit">Exit</button>
    </div>
</body>

just need help making the buttons actually work and a back button thanks everyone

For all of those you need functions. Some can be found within this chat. Others you can find within scripts. Or make by yourself. Also place that code below after the last button in every menu example would be

<div id="civ" data-parent="mainmenu" style="display: none;">
	<button class="menuoption" data-action="assault_rifle">Equips Assault Rifle</button>
	<button class="menuoption" data-action="pistol">Equips Pistol</button>
	<button class="menuoption" data-action="handsup">Puts Hands Up</button>
	<button class="menuoption" data-action="handsup_knees">Gets On Knees With Hands Up</button>
            <button onclick="ResetMenu()">Back</button> 
</div>

For some reason code looks different button should be aligned with the others. Not sure if it makes a difference but thats how mine is.

It does work mate. Tried and tested. :smiley:

Anyways now or pehaps in the future where we can only show a submenu to a set of people using a identifier? (Liscense, essentialmode group whatnot)

Doesn’t work for me either ;(

anyway to disable controller?

i fixed my issue with the trunk script at the end of your cl_client.lua rename TrunkOpen to just Trunk and TrunkClose should be the same :slight_smile:

here is my cl_client.lua:

--Trunk start

RegisterNetEvent("Trunk")
AddEventHandler("Trunk", function()
	local Veh = GetVehiclePedIsUsing(GetPlayerPed(-1))
	SetVehicleDoorOpen(Veh, 5, false, false)
end)

RegisterNetEvent("TrunkClose")
AddEventHandler("TrunkClose", function()
	local Veh = GetVehiclePedIsUsing(GetPlayerPed(-1))
	SetVehicleDoorShut(Veh, 5, false)
end)

--Trunk End

my nui.html:

<button class="menuoption" data-action="trunk">Opens Trunk</button>
<button class="menuoption" data-action="trunkclose">Closes Trunk</button>

that should fix it it fixed it for me

i will go ahead and share my nui and cl_client.lua for you guys!

nui.html:

<!-- 

	ActionMenu 
	Created by WolfKnight
	Additional help from lowheartrate, TheStonedTurtle, and Briglair. 

 -->

<html>
    <head>
        <script src="nui://game/ui/jquery.js" type="text/javascript"></script>
        <script src="ui.js" type="text/javascript"></script>
        <link href="ui.css" rel="stylesheet" type="text/css"/>
    </head>

    <body>
        <div id="actionmenu" style="display: none;">
        	<!-- 
        		This mainmenu div should be left as it is, you should change the buttons though.

        		If you want to make a submenu, then you must create a new div, with the ID of the 
        		div being the data-sub attribute of the button that will open it. For example, the 
        		below button Example Submenu, has the data-sub attribute of "examplesubmenu", which
        		is the same id as the div below. All submenus must also have a data-parent attribute. 
        	 -->
        <div id="mainmenu">
            <button class="menuoption" data-sub="vehicle">Vehicle</button>
            <button class="menuoption" data-sub="leo">LEO</button>
            <button class="menuoption" data-sub="civ">Civilian</button>
		</div>
		
		<div id="vehicle" data-parent="mainmenu" style="display: none;">
			<button class="menuoption" data-action="engine">Turns Engine On/Off</button>
			<button class="menuoption" data-action="trunk">Opens Trunk</button>
<button class="menuoption" data-action="trunkclose">Closes Trunk</button>
			<button class="menuoption" data-action="windows">Rolls Down Window</button>
			<button class="menuoption" data-action="doors">Opens Doors</button>
		</div>
			
		<div id="leo" data-parent="mainmenu" style="display: none;">
			<button class="menuoption" data-action="stun_gun">Equips Stun Gun</button>
			<button class="menuoption" data-action="cuff">Cuffs Player</button>
			<button class="menuoption" data-action="drag">Drags Player</button>
			<button class="menuoption" data-action="seat">Puts Player In Vehicle</button>
			<button class="menuoption" data-action="unseat">Takes Player Out Of Vehicle</button>
		</div>
		
		<div id="civ" data-parent="mainmenu" style="display: none;">
			<button class="menuoption" data-action="assault_rifle">Equips Assault Rifle</button>
			<button class="menuoption" data-action="pistol">Equips Pistol</button>
			<button class="menuoption" data-action="handsup">Puts Hands Up</button>
			<button class="menuoption" data-action="handsup_knees">Gets On Knees With Hands Up</button>
        </div>

<!-- Do not remove this or you will not be able to exit the menu --> 
			<button class="menuoption" data-action="exit">Exit</button>
			<button onclick="ResetMenu()">Back</button>
        </div>
    </body>
</html>

cl_client.lua:

--[[------------------------------------------------------------------------

	ActionMenu 
	Created by WolfKnight
	Additional help from lowheartrate, TheStonedTurtle, and Briglair. 

------------------------------------------------------------------------]]--

-- Define the variable used to open/close the menu 
local menuEnabled = false 
--[[------------------------------------------------------------------------
	ActionMenu Toggle
	Calling this function will open or close the ActionMenu. 
------------------------------------------------------------------------]]--
function ToggleActionMenu()
	-- Make the menuEnabled variable not itself 
	-- e.g. not true = false, not false = true 
	menuEnabled = not menuEnabled

	if ( menuEnabled ) then 
		-- Focuses on the NUI, the second parameter toggles the 
		-- onscreen mouse cursor. 
		SetNuiFocus( true, true )

		-- Sends a message to the JavaScript side, telling it to 
		-- open the menu. 
		SendNUIMessage({
			showmenu = true 
		})
	else 
		-- Bring the focus back to the game
		SetNuiFocus( false )

		-- Sends a message to the JavaScript side, telling it to
		-- close the menu.
		SendNUIMessage({
			hidemenu = true 
		})
	end 
end 

--[[------------------------------------------------------------------------
	ActionMenu HTML Callbacks
	This will be called every single time the JavaScript side uses the
	sendData function. The name of the data-action is passed as the parameter
	variable data. 
------------------------------------------------------------------------]]--
RegisterNUICallback( "ButtonClick", function( data, cb ) 
	if ( data == "handsup" ) then 
		handsUp()

	elseif ( data == "trunk" ) then
   	 TriggerEvent( 'Trunk' )

	elseif ( data == "trunkclose" ) then
   	 TriggerEvent( 'TrunkClose' )

	elseif ( data == "engine" ) then 
		 TriggerEvent( 'Engine' )

	elseif ( data == "handsup_knees" ) then
                 TriggerEvent( 'KneelHU' )

	elseif ( data == "exit" ) then 
		-- We toggle the ActionMenu and return here, otherwise the function 
		-- call below would be executed too, which would just open the menu again 
		ToggleActionMenu()
		return 
	end 

	-- This will only be called if any button other than the exit button is pressed
	ToggleActionMenu()
end )


--[[------------------------------------------------------------------------
	ActionMenu Control and Input Blocking 
	This is the main while loop that opens the ActionMenu on keypress. It 
	uses the input blocking found in the ES Banking resource, credits to 
	the authors.
------------------------------------------------------------------------]]--
Citizen.CreateThread( function()
	-- This is just in case the resources restarted whilst the NUI is focused. 
	SetNuiFocus( false )

	while true do 
		-- Control ID 20 is the 'Z' key by default 
		-- Use https://wiki.fivem.net/wiki/Controls to find a different key 
		if ( IsControlJustPressed( 1, 244 ) ) then 
			ToggleActionMenu()
		end 

	    if ( menuEnabled ) then
            local ped = GetPlayerPed( -1 )	

            DisableControlAction( 0, 1, true ) -- LookLeftRight
            DisableControlAction( 0, 2, true ) -- LookUpDown
            DisableControlAction( 0, 24, true ) -- Attack
            DisablePlayerFiring( ped, true ) -- Disable weapon firing
            DisableControlAction( 0, 142, true ) -- MeleeAttackAlternate
            DisableControlAction( 0, 106, true ) -- VehicleMouseControlOverride
        end

		Citizen.Wait( 0 )
	end 
end )

function chatPrint( msg )
	TriggerEvent( 'chatMessage', "ActionMenu", { 255, 255, 255 }, msg )
end 

--handsup
local handsup = false

function handsUp()
    local dict = "missminuteman_1ig_2"
    
	RequestAnimDict(dict)
	while not HasAnimDictLoaded(dict) do
		Citizen.Wait(0)
	end
	if not handsup then
		TaskPlayAnim(GetPlayerPed(-1), dict, "handsup_enter", 8.0, 8.0, -1, 50, 0, false, false, false)
		handsup = true
	else
		handsup = false
		ClearPedTasks(GetPlayerPed(-1))
	end
end

TriggerClientEvent('Trunk')

--engine
RegisterNetEvent('Engine')
 
local vehicles = {}
local State = {}
 
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if GetSeatPedIsTryingToEnter(GetPlayerPed(-1)) == -1 and not table.contains(vehicles, GetVehiclePedIsTryingToEnter(GetPlayerPed(-1))) then
            table.insert(vehicles, GetVehiclePedIsTryingToEnter(GetPlayerPed(-1)))
            table.insert(State, IsVehicleEngineOn(GetVehiclePedIsTryingToEnter(GetPlayerPed(-1))))
        elseif IsPedInAnyVehicle(GetPlayerPed(-1), false) and not table.contains(vehicles, GetVehiclePedIsIn(GetPlayerPed(-1), false)) then
            table.insert(vehicles, GetVehiclePedIsIn(GetPlayerPed(-1), false))
            table.insert(State, IsVehicleEngineOn(GetVehiclePedIsIn(GetPlayerPed(-1), false)))
        end
        for i = 1, tablelength(vehicles) do
            if (GetPedInVehicleSeat(vehicles[i], -1) == GetPlayerPed(-1)) or IsVehicleSeatFree(vehicles[i], -1) then
                SetVehicleEngineOn(vehicles[i], State[i], State[i], State[i])
            end
        end
    end
end)
 
TriggerClientEvent('Engine')

AddEventHandler('Engine', function()
    local veh
    local StateIndex
    for i = 1, tablelength(vehicles) do
        if vehicles[i] == GetVehiclePedIsIn(GetPlayerPed(-1), false) then
            veh = vehicles[i]
            StateIndex = i
        end
    end
    if IsPedInAnyVehicle(GetPlayerPed(-1), false) then
        if (GetPedInVehicleSeat(veh, -1) == GetPlayerPed(-1)) then
            if IsVehicleEngineOn(veh) then
                State[StateIndex] = false
            else
                State[StateIndex] = true
            end
        end
    end
end)
 
function drawNotification(text) --Just Don't Edit!
    SetNotificationTextEntry("STRING")
    AddTextComponentString(text)
    DrawNotification(false, false)
end
 
function tablelength(T) --Just Don't Edit!
    local count = 0
    for _ in pairs(T) do count = count + 1 end
    return count
end
 
function table.contains(table, element)
  for _, value in pairs(table) do
    if value == element then
      return true
    end
  end
  return false
end


--Kneel Handsup Start
 
function loadAnimDict( dict )
    while ( not HasAnimDictLoaded( dict ) ) do
        RequestAnimDict( dict )
        Citizen.Wait( 5 )
    end
end
 
RegisterNetEvent( 'KneelHU' )
AddEventHandler( 'KneelHU', function()
    local player = GetPlayerPed( -1 )
    if ( DoesEntityExist( player ) and not IsEntityDead( player )) then
        loadAnimDict( "random@arrests" )
        loadAnimDict( "random@arrests@busted" )
        if ( IsEntityPlayingAnim( player, "random@arrests@busted", "idle_a", 3 ) ) then
            TaskPlayAnim( player, "random@arrests@busted", "exit", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (3000)
            TaskPlayAnim( player, "random@arrests", "kneeling_arrest_get_up", 8.0, 1.0, -1, 128, 0, 0, 0, 0 )
        else
            TaskPlayAnim( player, "random@arrests", "idle_2_hands_up", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (4000)
            TaskPlayAnim( player, "random@arrests", "kneeling_arrest_idle", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (500)
            TaskPlayAnim( player, "random@arrests@busted", "enter", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
            Wait (1000)
            TaskPlayAnim( player, "random@arrests@busted", "idle_a", 8.0, 1.0, -1, 9, 0, 0, 0, 0 )
        end    
    end
end )
 
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests@busted", "idle_a", 3) then
            DisableControlAction(1, 140, true)
            DisableControlAction(1, 141, true)
            DisableControlAction(1, 142, true)
            DisableControlAction(0,21,true)
        end
    end
end)

--Kneel Handsup End

--Trunk start

RegisterNetEvent("Trunk")
AddEventHandler("Trunk", function()
	local Veh = GetVehiclePedIsUsing(GetPlayerPed(-1))
	SetVehicleDoorOpen(Veh, 5, false, false)
end)

RegisterNetEvent("TrunkClose")
AddEventHandler("TrunkClose", function()
	local Veh = GetVehiclePedIsUsing(GetPlayerPed(-1))
	SetVehicleDoorShut(Veh, 5, false)
end)

--Trunk End
2 Likes

kneelHU still wont work for me

Maybe check the formatting of your cl_action it looks like some parts might be off, not sure if thats just from copy pasting things though.

still doesn’t work whats your cl_client and nui.html look like maybe i can compare to see what’s wrong

Is there a good emote and animation script where I can put it in action menu?