GetRealMonthH

From Multi Theft Auto: Wiki
Revision as of 12:50, 9 November 2016 by N3xT (talk | contribs) (Created page with "==Syntax== <syntaxhighlight lang="lua"> getRealMonthH ( ) </syntaxhighlight> ==Returns== This function returns a string containing the real month name ==Code== <section name...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Syntax

getRealMonthH ( )

Returns

This function returns a string containing the real month name

Code

Click to collapse [-]
Function source
monthTable = { -- table
	["1"] = "January",
	["2"] = "February",
	["3"] = "March",
	["4"] = "April",
	["5"] = "May",
	["6"] = "June",
	["7"] = "July",
	["8"] = "August",
	["9"] = "September",
	["10"] = "October",
	["11"] = "November",
	["12"] = "December"
}

function getRealMonthM()
	local time = getRealTime()
	local month = time.month + 1
	for i, v in pairs ( monthTable ) do -- loop
		if string.find ( i , month ) then -- find the month
			if v ~= "" then -- check if there is a name
				m = v
			end
		end
	end
	return m
end

Example

Click to collapse [-]
Clientside example

This example output the real month.

addCommandHandler("month",
function ()
	local month = getRealMonthH()
	outputChatBox(month,255,0,0,true)
end	)