Of course sir.
(20 Chars)
Of course sir.
(20 Chars)
How do you cuff please, retrive a shotgun, retrive a m4, do an ad or other things like that
You add the code and buttons in yourself, this is just a base for you to add what you want…
Something like this.
elseif ( data == "m4") then
TriggerClientEvent("chatMessage", -1, '' ..GetPlayerName(id) .. " ^3 Unracks M4 From Their Cruiser!"))
Just an idea not sure if it works.
Well that will just make a message pop up in chat
Check out @BabbaTundaee release, it has the stuff already in, ready to go, cuff, drag etc… [Release] Roleplay Toolbox 2.0
Yeah, of course, I thought that is what he meant. Something like this.
elseif ( data == "m4") then
m4()
function m4()
local ped = PlayerPedId()
GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_CARBINERIFLE"), 1000, false)
TriggerClientEvent("chatMessage", -1, '' ..GetPlayerName(id) .. " ^3 Unracks M4 From Their Cruiser!"))
end)
Just an idea not sure if it works.
How do I open this? As in what keybind
M …
Could Someone Please Send Me There Config, It Doesn’t Want to Close For Me
Discord: Hellcat546#7218
could someone please give me an example of the edits needed to be made in the cl_actions.lua in order to get the buttons to use their desired actions <3
You need to have the buttons call an action so if you are calling a hands up script you do it like this
if ( data == "handsup" ) then --puts your hands up
TriggerEvent("Handsup")
and you trigger whatever your event is named
so here is the hands up i use (i dont know who made this i DID NOT make it)
-----------------------------------------------------------------------------------------
RegisterNetEvent("Handsup")
AddEventHandler("Handsup", function()
local lPed = GetPlayerPed(-1)
if DoesEntityExist(lPed) then
if not IsEntityPlayingAnim(lPed, "mp_arresting", "idle", 3) then
RequestAnimDict("random@mugging3")
while not HasAnimDictLoaded("random@mugging3") do
Citizen.Wait(100)
end
if IsEntityPlayingAnim(lPed, "random@mugging3", "handsup_standing_base", 3) then
ClearPedSecondaryTask(lPed)
SetEnableHandcuffs(lPed, false)
SetCurrentPedWeapon(lPed, GetHashKey("WEAPON_UNARMED"), true)
SetNotificationTextEntry("STRING")
AddTextComponentString('~o~You have put your hands down')
DrawNotification(false, true)
else
TaskPlayAnim(lPed, "random@mugging3", "handsup_standing_base", 8.0, -8, -1, 49, 0, 0, 0, 0)
SetEnableHandcuffs(lPed, true)
SetCurrentPedWeapon(lPed, GetHashKey("WEAPON_UNARMED"), true)
SetNotificationTextEntry("STRING")
AddTextComponentString('~o~You have put your hands up')
DrawNotification(false, true)
end
else
TriggerEvent("chatMessage", "You are handcuffed..")
end
end
end)
As you see RegisterNetEvent("Handsup")
is what my button is calling
how to make a button work with ESX.ShowInventory() ??
Just trigger the event, or better yet don’t use ESX.
You have renamed the resource name without editing the JavaScript.
i fixed the resource name issue xD just a little lua there and js there and it’s fixed.
for anyone wanting to know the code here:
cl_action.lua:
--[[------------------------------------------------------------------------
Resource Rename Fix
------------------------------------------------------------------------]]--
Citizen.CreateThread( function()
Citizen.Wait( 1000 )
local resourceName = GetCurrentResourceName()
SendNUIMessage( { resourcename = resourceName } )
end )
ui.js:
/*--------------------------------------------------------------------------
ActionMenu
Created by WolfKnight
Additional help from lowheartrate, TheStonedTurtle, and Briglair.
--------------------------------------------------------------------------*/
var resourceName = "";
var menuEnabled = false;
window.addEventListener( 'message', function( event ) {
var item = event.data;
if ( item.resourcename ) {
resourceName = item.resourcename;
}
} );
$( function() {
// Adds all of the correct button actions
init();
// Gets the actionmenu div container
var actionContainer = $( "#actionmenu" );
// Listens for NUI messages from Lua
window.addEventListener( 'message', function( event ) {
var item = event.data;
// Show the menu
if ( item.showmenu ) {
ResetMenu()
actionContainer.show();
}
// Hide the menu
if ( item.hidemenu ) {
actionContainer.hide();
}
} );
} )
// Hides all div elements that contain a data-parent, in
// other words, hide all buttons in submenus.
function ResetMenu() {
$( "div" ).each( function( i, obj ) {
var element = $( this );
if ( element.attr( "data-parent" ) ) {
element.hide();
} else {
element.show();
}
} );
}
// Configures every button click to use its data-action, or data-sub
// to open a submenu.
function init() {
// Loops through every button that has the class of "menuoption"
$( ".menuoption" ).each( function( i, obj ) {
// If the button has a data-action, then we set it up so when it is
// pressed, we send the data to the lua side.
if ( $( this ).attr( "data-action" ) ) {
$( this ).click( function() {
var data = $( this ).data( "action" );
sendData( "ButtonClick", data );
} )
}
// If the button has a data-sub, then we set it up so when it is
// pressed, we show the submenu buttons, and hide all of the others.
if ( $( this ).attr( "data-sub" ) ) {
$( this ).click( function() {
var menu = $( this ).data( "sub" );
var element = $( "#" + menu );
element.show();
$( this ).parent().hide();
} )
}
} );
}
// Send data to lua for processing.
function sendData( name, data ) {
$.post( "http://" + resourceName + "/" + name, JSON.stringify( data ), function( datab ) {
if ( datab != "ok" ) {
console.log( datab );
}
} );
}
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