-
Notifications
You must be signed in to change notification settings - Fork 4
/
Admin.ttslua
51 lines (46 loc) · 1.58 KB
/
Admin.ttslua
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
50
51
ADMIN_ID = '76561197995280695'
SPECIAL_COLORS = {
{id = '76561197995280695', color = {73/255,213/255,253/255}},
{id = '76561198043437629', color = {215/255,81/255,49/255}}
}
function gradient(str, color1, color2)
local len = string.len(str)
local r_step = (color2[1]-color1[1]) / (len-1)
local g_step = (color2[2]-color1[2]) / (len-1)
local b_step = (color2[3]-color1[3]) / (len-1)
local out = ""
local r, g, b = color1[1], color1[2], color1[3]
for i = 1, len do
out = out .. nums_to_bbc({r * 255, g * 255, b * 255}) .. string.sub(str, i, i)
r = r + r_step
g = g + g_step
b = b + b_step
end
return out
end
function nums_to_bbc(color)
local r = string.format("%02x", math.floor(color[1]))
local g = string.format("%02x", math.floor(color[2]))
local b = string.format("%02x", math.floor(color[3]))
return "[" .. r .. g .. b .. "]"
end
function randomColor()
return {math.random(), math.random(), math.random()}
end
function checkAdmin(player, message)
for k,v in pairs(SPECIAL_COLORS) do
if player.steam_id == v.id then
color = getPlayer(player)
if not color then
color = 'Grey'
end
name = player.steam_name
if playersExIds['Cyan'] == ADMIN_ID then
name = gradient('Cyanar', {73/255,213/255,253/255}, {1,1,1})
end
message = gradient(message, v.color, {1,1,1})
printToAll( COLORS_BBC[color] .. name .. ':[-] [i]' .. message .. '[/i]')
return false
end
end
end