• print( os.time() ) Variable for HUD
    12 replies, posted
Hello, I make a HUD for my server and i want add a Time and Date in ... But i have this draw.DrawText("test: ".. Wallet, "Arial", HUD.PosX - (wallettextsize /2) + 140, HUD.PosY + 60, Color(0, 255, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) for [IMG]https://i.gyazo.com/8f10ed37fa24745e3210ccb5c8627772.png[/IMG] How to place this ? print( os.time() ) Thank man
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/os/date]os.date[/url]
Format it, put it in a var, draw it.
[QUOTE=whitestar;48878700]Format it, put it in a var, draw it.[/QUOTE] Thank but i don't unterstand ? code ?
[QUOTE=Pink3vil;48885187]Thank but i don't unterstand ? code ?[/QUOTE] Read this: [url]http://www.lua.org/pil/22.1.html[/url]
[QUOTE=Pink3vil;48885187]Thank but i don't unterstand ? code ?[/QUOTE] Welcome to the Development discussion forum, where people help you understand and dont serve you code on a plate.
[QUOTE=AIX-Who;48885229]Read this: [url]http://www.lua.org/pil/22.1.html[/url][/QUOTE] Thank ! [editline]12th October 2015[/editline] [QUOTE=tzahush;48885688]Welcome to the Development discussion forum, where people help you understand and dont serve you code on a plate.[/QUOTE] Thank but Format it, put it in a var, draw it. it's not reply ...
[QUOTE=Pink3vil;48885741]Thank ! [editline]12th October 2015[/editline] Thank but Format it, put it in a var, draw it. it's not reply ...[/QUOTE] Thats how basic lua works - formating it, putting it in a var, and then drawing it/using the var. Format the UNIX time of os.time() to an actualy "Dateish" time, put it inside a local var, and draw it, not that hard.
To draw the time (using your example) [CODE] local time = os.date( '%I:%M %p' ) -- Returns something like 04:40 pm draw.DrawText("Time: ".. time, "Arial", HUD.PosX - (wallettextsize /2) + 140, HUD.PosY + 60, Color(0, 255, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) [/CODE]
[QUOTE=MPan1;48891053]To draw the time (using your example) [CODE] local time = os.date( '%I:%M %p' ) -- Returns something like 04:40 pm draw.DrawText("Time: ".. time, "Arial", HUD.PosX - (wallettextsize /2) + 140, HUD.PosY + 60, Color(0, 255, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) [/CODE][/QUOTE] Okay i have included ! Thank , now i make this for Mouth Thank man !
For people that rated my post dumb, I forgot to add that you could change the string to whatever you want using [URL="http://www.lua.org/pil/22.1.html"]the website AIX-Who linked[/URL].
[QUOTE=MPan1;48898581]For people that rated my post dumb, I forgot to add that you could change the string to whatever you want using [URL="http://www.lua.org/pil/22.1.html"]the website AIX-Who linked[/URL].[/QUOTE] I rated it dumb because you spoonfeed him :/
[QUOTE=whitestar;48899045]I raped it dumb because you spoonfeed him :/[/QUOTE] [QUOTE=Pink3vil;48885187]Thank but i don't unterstand ? code ?[/QUOTE] He kinda asked for it, and it's not really spoonfeeding if it's just adapting stuff from other examples into his code-he would've done that kinda thing anyway
Sorry, you need to Log In to post a reply to this thread.