Time Spell

Descrição

Conte o tempo da magia na tela apos usar.

Autor:

                
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
52
53
54
55
-- Configuração xtela,ytela = 300, 200 -- posição na tela timemagia = "kai" -- nome da magia laranja ( letra minuscula ) tempo1 = 5000 -- cooldown da magia tempo2 = 1000 -- tempo da magia ativa texto = "Nome:" -- Nome que vai aparecer na tela -- local widget = setupUI([[ Panel height: 400 width: 900 ]], g_ui.getRootWidget()) local timespell = g_ui.loadUIFromString([[ Label color: white background-color: black opacity: 0.85 text-horizontal-auto-resize: true ]], widget) macro(1, function() if not storage.time.t or storage.time.t < now then timespell:setText(texto) timespell:setColor('green') elseif storage.time.a >= now then timespell:setColor('blue') timespell:setText(texto .. string.format("%.0f",(storage.time.a-now)/1000).. "s ") else timespell:setColor('red') timespell:setText(texto .. string.format("%.0f",(storage.time.t-now)/1000).. "s ") end end) onTalk(function(name, level, mode, text, channelId, pos) if name ~= player:getName() then return end if text:lower() == timemagia and storage.time.t < now then storage.time.t = now + tempo1 storage.time.a = now + tempo2 end end) if type(storage.time) ~= 'table' or (storage.time.t - now) > 60000 then storage.time = {t = 0, a = 0} end timespell:setPosition({y = ytela+40, x = xtela+10})