1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
News = {}
--Configuration--
News.Delay = 10 -- Delay between command uses (in seconds), default 10 secs. Note that you'll have to wait this time if someone else uses the command.--
News.Color = "255255255" -- News message color (on RGB), default white.--
News.Bar_Color = "100200100" -- News bar color (on RGB), deafult green.--
News.Id = 48 -- News message hudtxt id (0-49), change it if you get hud errors, default 48.--
News.Sound = 1 -- Sound that will be heard when using the command, values over 3 and under 1 will mute it.--
News.Tlex_Rank = 4 -- Set the tlex rank on which a player can use the say commands of this script on tlex ( 4 = moderator by default). --
News.Admin_List = {} -- List of usgn ids of the admins, separated by comma (,). This list only works if the script is not used with tlex. --
News.Start = "News" -- The word (between double quotes) witch the message will start, default "News", the longer this text is, the shorter the message can be.--
News.Counter = 0
addhook("second","News.Second")
function News.Bard(news)
tween_alpha(news,News.Delay*100,0.0)
end
function News.Main(news)
news,r,g,b = News.Start..": "..news..".",tonumber(News.Bar_Color:sub(1,3)),tonumber(News.Bar_Color:sub(4,6)),tonumber(News.Bar_Color:sub(7,9))
parse("hudtxt "..News.Id.." \"©"..News.Color..string.gsub(news,'"',"'").."\" "..((news:len()*7)+640)..' 4 1')
parse('hudtxtmove 0 '..News.Id..' '..(News.Delay*1000)..' '..(news:len()*(-8))..' 4')
News.Bar=image("gfx/news_bar.png",320,12,2)
imagecolor(News.Bar,r,g,b)
imagealpha(News.Bar,0.0)
imagescale(News.Bar,640,1)
imageblend(News.Bar,1)
tween_alpha(News.Bar,News.Delay*100,0.7)
timer(News.Delay*1000,'freeimage',News.Bar)
timer((News.Delay*1000)-(News.Delay*100),'News.Bard',News.Bar)
timer(News.Delay*1000,'parse','hudtxt '..News.Id..' ""')
if News.Sound>0 and News.Sound<=3 then
parse("sv_sound \"news/news_sound"..News.Sound..".ogg\"")
end
end
function l.news(id,news)
if News.Counter == 0 then
News.Main(news)
News.Counter = News.Delay
end
end
function News.Second()
if News.Counter > 0 then
News.Counter = News.Counter - 1
end
end