GetRealMonthM: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Blanked the page)
Tag: Blanking
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
{{Useful Function}}
This function returns the month name.


'''Author:''' N3xT
==Syntax==
<syntaxhighlight lang="lua">
getRealMonthH ( )
</syntaxhighlight>
==Returns==
This function returns a string containing the real month name
==Code==
<section name="Function source" class="both" show="true">
<syntaxhighlight lang="lua">
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
</syntaxhighlight>
</section>
==Example==
<section name="Clientside example" class="client" show="true">
This example output the real month.
<syntaxhighlight lang="lua">
addCommandHandler("month",
function ()
local month = getRealMonthM()
outputChatBox(month,255,0,0,true)
end
)   
</syntaxhighlight>
</section>
==See also==
{{Useful_Functions}}

Latest revision as of 14:28, 23 May 2021