Hi here, i just did a simple Menu system who can be easily configurable.
Installation :
Add GUI.lua on your Script folder
Add GUI.lua on your __resource.lua (client)
Utilisation :
To add a Menu add this function to your client side script :
function NameOfMenu()
MenuTitle = "Title of the menu"
ClearMenu()
Menu.addButton("First Button","FunctionName1","arg")
Menu.addButton("Second Button","FunctionName2",nil) -- No arg
-- ...
end
Next add this on your keypress event loop :
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(1,Keys["H"]) then
NameOfMenu() -- Menu to draw
Menu.hidden = not Menu.hidden -- Hide/Show the menu
end
Menu.renderGUI() -- Draw menu on each tick if Menu.hidden = false
end
end)
Keys:
Up : Up Arrow Key Down : Down Arrow key Select : Enter key
Warningâ:warning:
Maybe you dont have the same keybinding of me, so check the wiki to see what is the value of your keybinding
You can edit the GUI.lua to change keys table or simply modify like this IsControlJustPressed(1--[[input group]], 51--[[control index]])
Hello thanks i a new dev and i donât how where to install GUI.lua, where is script folder and __resource.lua ?
Can you help me with more installation details please ?
Do oas function i create a file with the resource + GUI
In the resoucre I have added client_script âGUI.luaâ a liver in the game H touches and nothing goes ???
Thx for the script, Do you know how can i add a button in a button. Exemple: When i press E, the menu show. I have 2 Button first : Weapon, second : Ammo. When i press button weapon i have a button pistol, riffle etc ⌠Thx
function NewMenu()
MenuTitle = "Title of the new menu"
ClearMenu()
Menu.addButton("First Button","FunctionName1","arg")
Menu.addButton("Second Button","FunctionName2",nil) -- No arg
end