Simple lua clock problem

Were making a game mode that I’ll post later in the forums. We are just getting the basics down on this game mode. One of the things we want is a clock inside the game mode. We have a script but when we put it into cl_init.lua it does not work. Here’s the code.

function clockhud()
draw.RoundedBox( 0, ScrW()*0.01, ScrH()*0.01, 128, 46, Color( 25, 25, 25, 255 ) )
draw.RoundedBox( 20, ScrW()*0.01, ScrH()*0.01, 128, 46, Color( 125, 125, 125, 125 ) )
draw.SimpleText( “%a, %I:%M:%S %p” ), “Default”, ScrW()*0.024, ScrH()*0.02, Color( 255, 104, 86, 255 ),0,0)
draw.SimpleText( “%m/%d/20%y” ), “Default”, ScrW()*0.035, ScrH()*0.04, Color( 255, 104, 86, 255 ),0,0)

hook.Add("HUDPaint", "clockhud", clockhud)

end [/lua]

Any idea’s why this did not work? Please help whenever you get a chance! Thanks

You can post your code in a nice syntax highlighter, you just have to put [noparse][lua] [/lua][/noparse] around you code. Do you get any errors relating to that code?


Also, you don’t need to hook into HUDPaint, because you are making a gamemode. Just put that into the GM.HUDPaint function.

Done, sorry.

No need to apologise.

No idea whats wrong. Though I am only good at scripting weapons, I am not much help here… sorry…

The code works fine here by using lua_openscript_cl. It looks like you put it in an if condition, are you sure the code is actually running?

I hope you didn’t register just to post you have no idea what the problem is.

Ok, I found it. Thanks, I went back at the folder to find that one of the other people working on it put it in its own lua and forgot to add the file name to init.lua, so it wouldn’t load. Thanks for helping me out.

By the way, what do you mean

? Just because someone posts a stupid post does not mean I am trying to bump or some shit. Let a monitor get him, he did not post anything that could have helped this form atleast… Anyways, thanks for the help

He was talking to DragionsRus.

Yeah, posted what I said before I read that he was talking about Dragion. Edited my post. Thanks though…