[Release] GUI Script - v0.8

Hi there !

Just a lil question, if i want to change the menu location on the screen wich args do i need to edit ?

Thank you,
Nathan

Bonjour, excuse moi je nā€™est pas compris ou installer cā€™est deux script

function NameOfMenu()
	MenuTitle = "Title of the menu"
	ClearMenu()
	Menu.addButton("First Button","FunctionName1","arg")	
	Menu.addButton("Second Button","FunctionName2",nil) -- No arg
	-- ...
end
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)

Merci de votre aide.


Hello, excuse me I am not understood or install it is two script

function NameOfMenu()
	MenuTitle = "Title of the menu"
	ClearMenu()
	Menu.addButton("First Button","FunctionName1","arg")	
	Menu.addButton("Second Button","FunctionName2",nil) -- No arg
	-- ...
end
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)

Thank you for your help.

Salut,
il faut que tu fasse un nouveau fichier .lua par exemple ā€œmenu.luaā€ et que tu y mettes ce deux bout de code.
Tu auras donc les fichiers suivants : GUI.lui, __resource.lua, Menu.lua et dans ton fichier __ressource.lua, le code suivant :

resource_manifest_version "77731fab-63ca-442c-a67b-abc70f28dfa5"

client_scripts {
		"GUI.lua",
		"Menu.lua"
} 

Hi, you have to create a new file (for example ā€œMenu.luaā€) and paste in it the code below :

function NameOfMenu()
	MenuTitle = "Title of the menu"
	ClearMenu()
	Menu.addButton("First Button","FunctionName1","arg")	
	Menu.addButton("Second Button","FunctionName2",nil) -- No arg
	-- ...
end
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)

You will have these files : GUI.lua, __resource.lua, Menu.lua
and your __resource.lua will look like this :

resource_manifest_version "77731fab-63ca-442c-a67b-abc70f28dfa5"

client_scripts {
		"GUI.lua",
		"Menu.lua"
} 

[EN]

Hi! I was wondering if it could be possible to set a command to a button (Iā€™m new to LUA).
Suppose that I installed a mod ā€œloadoutsā€ that can change my player model, and the only way to activate it is by command system (writing ā€œ/loadout copā€ in the chat). Can I set a command to a button of my menu, that way we just have to click a button and it change. Thank you

This doesnā€™t exists already ?

Take example here (see the giveJob function)

Just link the function with one of your buttons.
Then inside the function, well trigger some client/server events and it should be itā€¦

(I guess, I have not scripted a menu yet, just sharing what I could have read so far)

Tell me if I was wrong (I also learn with failure XD) Good luck

Where do all the files go?

Hey,
Iā€™m removing the download link as the Keys table still exists and has spread :frowning:
Just remove it and reupload, Otherwise :thumbsup:

Did you release the download please?

Hello,
In order to test a few scripts and menus I had pasted copy
But when I do H nothing happens ā€¦
No errors in console
But in the game console I have this and this as soon as loading the game without even pressing the H key: http://hpics.li/61a0280