Jump to content

Problem with getRealTime


Overkillz

Recommended Posts

Hey everyone, I hope u can help me with this little help :D

Im trying to transform the number of the month to the name of the month

For example 1 = January.

I tried to do this

month = { 
    1 = "January", 
    2 = "February", 
    3 = "March", 
    4 = "April", 
    5 = "May", 
    6 = "June", 
    7 = "July", 
    8 = "August", 
    9 = "September", 
    10 = "October", 
    11 = "November", 
    12 = "December", 
    } 
  
local month = time.month[month] 
  
-- And after my code using dxDraw ... 
  

What is the problem ?

Debugscript 3

fe414dd16f.jpg

Regards,

Link to comment
month = { 
    [1] = "January", 
    [2] = "February", 
    [3] = "March", 
    [4] = "April", 
    [5] = "May", 
    [6] = "June", 
    [7] = "July", 
    [8] = "August", 
    [9] = "September", 
    [10] = "October", 
    [11] = "November", 
    [12] = "December" 
    } 
  
local month = time.month[month] 

Link to comment
dxDrawText("#ff8800".. month,0,110,screenWidth,screenHeight,tocolor(0,0,0,alpha),2,"default-bold","center","top",false,false,true,true) 

Thanks, anyway I get other problem:

a68045b917.jpg

month = { 
    [1] = "January", 
    [2] = "February", 
    [3] = "March", 
    [4] = "April", 
    [5] = "May", 
    [6] = "June", 
    [7] = "July", 
    [8] = "August", 
    [9] = "September", 
    [10] = "October", 
    [11] = "November", 
    [12] = "December" 
    } 

Line 38

local month = time.month[month] 

Link to comment
Change table name to months and use that

nonth = time.months[month]

month = { 
    [1] = "January", 
    [2] = "February", 
    [3] = "March", 
    [4] = "April", 
    [5] = "May", 
    [6] = "June", 
    [7] = "July", 
    [8] = "August", 
    [9] = "September", 
    [10] = "October", 
    [11] = "November", 
    [12] = "December" 
    } 
local nonth = time.month[month] 
  
dxDrawText("#ff8800"..month,0,110,screenWidth,screenHeight,tocolor(0,0,0,alpha),2,"default-bold","center","top",false,false,true,true) 

Doesnt work

abb6935603.jpg

Link to comment
local tMonths = { 
    [0] = "January", 
    [1] = "February", 
    [2] = "March", 
    [3] = "April", 
    [4] = "May", 
    [5] = "June", 
    [6] = "July", 
    [7] = "August", 
    [8] = "September", 
    [9] = "October", 
    [10] = "November", 
    [11] = "December" 
} 
  
function getMonth() 
    local month = getRealTime()["month"] 
    return tMonths[month] 
end 
  
dxDrawText("#ff8800"..getMonth(),0,110,screenWidth,screenHeight,tocolor(0,0,0,alpha),2,"default-bold","center","top",false,false,true,true) 

Link to comment

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...