[SOLVED]How to get server time

Anyone know how to get this work?
https://runtime.fivem.net/doc/reference.html#_0x6D03BFBD643B2A02

My script…

Citizen.CreateThread(function()
    while true do
		Citizen.Wait(0)
		if IsControlJustReleased(1, 168) then --F7
		test = NetworkGetServerTime()
			TriggerEvent("chatMessage", "Time", {255, 0, 0}, "Now is" .. test .. "")
		end
	end
end)

Note that this native (if it works) should return 3 values, hours, minutes, seconds.
(Pointers in the Natives are converted to return values in Lua)
Ergo it should be hours, minutes, seconds = NetworkGetServerTime()

Can you give me a sample script?
I have try many time…
Still no work…

Thanks…

Hmm it doesn’t seem like this native does what you would want to.
Why do you even need the server time? It’ll be the same time as yours plus or minus a timezone shift.

nvm, I already solved his problem

For everyone else, looking for a solution

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		if IsControlJustReleased(1, 168) then --F7
			local years, months, days, hours, minutes, seconds = Citizen.InvokeNative(0x50C7A99057A69748, Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt())
			TriggerEvent("chatMessage", "Date", {255, 0, 0}, "Today is the " .. days .. "." .. months .. "." .. years)
			TriggerEvent("chatMessage", "Time", {255, 0, 0}, "Now it is " .. hours .. ":" .. minutes .. ":" .. seconds)
		end
	end
end)
7 Likes