I have no lua knowledge, but how do you make a simple text scroll to right? Like in sassilization.
[lua]local multiplier = 5 -- greater multiplier = faster scroll
local width = ScrW() -- the width of hte space which the text will scroll across
local ypos = 500 -- the y pos on the screen, assuming the text scrolls horizontally
local text = "Hello, World!" -- the text to draw
local font = "ScoreboardText" -- the font to draw it in
local textcol = color_white -- the color to draw the font
hook.Add("HUDPaint","DrawScrollText",function()
draw.DrawText(text,font,math.fmod(SysTime() * multiplier,width),ypos,textcol,0)
end)[/lua]
Untested, but a basic example of horizontally scrolling text.
Big thank you.
[editline]03:38AM[/editline]
Also how to make it so it kind of continues from the other side of your monitor. When the text has scrolled, it just teleports to the beginning.
I've never tried this before, but I imagine it would work something like this:
[lua]local multiplier = 5 -- greater multiplier = faster scroll
local width = ScrW() -- the width of hte space which the text will scroll across
local ypos = 500 -- the y pos on the screen, assuming the text scrolls horizontally
local text = "Hello, World!" -- the text to draw
local font = "ScoreboardText" -- the font to draw it in
local textcol = color_white -- the color to draw the font
hook.Add("HUDPaint","DrawScrollText",function()
local x = math.fmod(SysTime() * multiplier,width
surface.SetFont(font)
local w,h = surface.GetTextSize(text)
if x + w > width then
draw.DrawText(text,font,(x + w - width) * -1,ypos,textcol,2)
end
draw.DrawText(text,font,math.fmod(SysTime() * multiplier,width),ypos,textcol,0)
end)[/lua]
Sorry, you need to Log In to post a reply to this thread.