[HELP][SOLVED] GUI script problem

I tried to config the GUI menu of @Ideo (seen here)
for a simple test menu : day /night. But it’s not working.

function day()
	Citizen.InvokeNative(0x47C3B5848C3E45D8 (12, 00, 00))
end
function night()
	Citizen.InvokeNative(0x47C3B5848C3E45D8 (00, 00, 00))
end

function NameOfMenu()
	MenuTitle = "Day / night"
	ClearMenu()
	Menu.addButton("Jour","day", nil)	
	Menu.addButton("Nuit","night", nil)	
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)

that’s my code

The native i used come from here and it’s the “SET_CLOCK_TIME” native.

Waiting for help :wink:

Try this…

SetClockTime(12,  00,  00)

It’s better, the menu show up when i press H.
But it’s not working… :confused:

NetworkOverrideClockTime(12, 00, 00)

:snail:

1 Like

Nope it’s not working

Just tested it and it works, could you post your new code here?

function day()
	Citizen.InvokeNative(NetworkOverrideClockTime(12, 00, 00))
end
function night()
	Citizen.InvokeNative(NetworkOverrideClockTime(00, 00, 00))
end

function NameOfMenu()
	MenuTitle = "Day / night"
	ClearMenu()
	Menu.addButton("Jour","day", nil)	
	Menu.addButton("Nuit","night", nil)	
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)

Get rid of the Citizen.InvokeNative.

function day()
	NetworkOverrideClockTime(12, 00, 00)
end
function night()
	NetworkOverrideClockTime(00, 00, 00)
end

:snail:

1 Like

Oh yes it’s work now :joy:
i dont know why i wasn’t working before, so thanks all :wink:

@europium and @beryllium you solved my problem with

NetworkOverrideClockTime(12, 00, 00)

but how did you know the code ? where did you find it ?

Here https://wiki.fivem.net/wiki/List_of_native_functions (but actually you can’t see the arguments needed …)

There is a DB here too http://www.dev-c.com/nativedb/ in case you need

1 Like

They’re developers of Five:M I believe, I’m sure that’s what elements are.