Creating a "block-type" menu?

Excuse me from last response, I forgot to put in the $('.btn-group').css('display', 'none') in it. The menu actually does close but the cursor still remains on the screen as usual.

1 Like

Well the cursor remaining and you being able to move it around is the SetNuiFocus, which needs to go back to being false with the RegisterNuiCallback

1 Like

Yes which I have not changed. It still looks like the following:

RegisterNUICallback('closeMenu', function()
	print("Cursor should go now...")
	SetNuiFocus(false, false)
end)

but nothing from the Callback function is actually happening (not even the print("Cursor should go now...")).

This is exactly how I have it setup and it works on mine. Maybe try it with the .click thing too, like I have. Try removing the data, cb from the Registercallback thing and just use ().

</body>

<script type="text/javascript">

$("#subby").click(function(){
    $.post('http://rpp/NUIFocusOff', JSON.stringify({}));
});

document.onkeyup = function (data) {
    if (data.which == 27) { // Escape key
        $.post('http://rpp/NUIFocusOff', JSON.stringify({}));
    }
};

</script>

RegisterNUICallback('NUIFocusOff', function()
    SetNuiFocus(false, false)
end)

1 Like

wait :no_mouth: the RegisterNUICallback function is supposed to be in the client.lua file isn’t it?!

Yes.

Another thing… instead of that jquery script header you use, try this one

<script src="nui://game/ui/jquery.js" type="text/javascript"></script>

Updated the script src and everything but continues to leave the cursor on the screen when the menu exits.

I just downloaded ur github stuff and tried it on my server. I got it working. All I had to do was fix the __resource.lua.

File names are wrong :yum:

1 Like

Wow awesome thanks so much. Can you please send me a .zip of it when you get a moment? :slight_smile:

http://www.mediafire.com/file/mm098sb69q7tli3/testy.rar

1 Like

Awesome, :heart_eyes: thank you so much!

I am trying to make it so whenever a user enters a vehicle they have buttons that allow them to toggle the engine on/off but for some reason can’t get it to work right. I added an eventListener in my UI.html file and everything needed in the client.lua file but I am having the following issues at the moment:

  1. Upon server start, when I enter a vehicle the vehicle controls do not show up in the menu most of the time.
  2. If I restart menu in the F8 Console and then enter a vehicle again the menu will show up.

do you have that menu? if so can you sent it to me? xd

Not at the moment, but I will probably end up turning it into a base resource for everyone to download and customise.

1 Like

ohh :frowning: ok i will be waiting for that then xd

It could be that when you first start the script, it sets that ped variable to something weird, because that will run when you’re not even spawned in it. Try just using GetPlayerPed(-1) inside the iscontrolpressed if statement.

1 Like

That did the trick, thanks a lot!

awesome dude keep up the great work! If you plan on releasing it to the public, which i don’t assume but if you do, would this be something that will work for vRP?

can you try to put car stuff like engine off open trunk like dojrp?

This is not a resource so I don’t think anyone will be creating / updating any sort of script for that here but maybe you can check @WolfKnight179’s resource he released that also uses this type of menu; [Release] ActionMenu [1.0.1] (Updated April 2018).