Jump to content

CONTAGEM DE HORAS MTA


Recommended Posts

Posted

Bom o LordHenry me ajudou fazendo um script que explicava o log de entrada e saida de determinado estados, iniciar PTR e finalizar PTR.
Agora eu quero saber, como faço pra fazer contagem destas horas? No python existe funções para isso, tem como eu fazer também no MTA?

Posted

Você quer mostrar a hora e data exatamente do inicio do PTR e do final do PTR?

Se sim, você deve usar: GetRealTime

Um exemplo:

function horaReal (thePlayer, cmd)
	local now = getRealTime() -- Recebe os dados do momento atual.
	local hours = now.hour
	local minutes = now.minute
	local days = now.monthday
	local months = now.month
	local years = now.year
	if (hours < 10) then -- Adiciona um 0 na frente, caso seja menor que 10.
		hours = "0"..hours
	end
	if (minutes < 10) then
		minutes = "0"..minutes
	end
	if (days < 10) then
		days = "0"..days
	end
	if (months < 10) then
		months = "0"..months
	end
	outputChatBox ("Data: "..days.."/"..months + 1 .."/"..years + 1900, thePlayer, 0, 255, 0)
	outputChatBox ("Hora: "..hours..":"..minutes, thePlayer, 0, 255, 0)
	outputDebugString ("Data: "..days.."/"..months + 1 .."/"..years + 1900)
	outputDebugString ("Hora: "..hours..":"..minutes)
end
addCommandHandler ("hora", horaReal)

 

  • Other Languages Moderators
Posted

Se você prestar atenção, naquele exemplo que eu dei ele já inclui a hora de cada ação.

 

Posted
On 21/12/2020 at 20:39, Lord Henry said:

Se você prestar atenção, naquele exemplo que eu dei ele já inclui a hora de cada ação.

 

Isso acontece até com as melhores familias :D

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...