forked from slime73/vendettarelay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
executable file
·46 lines (41 loc) · 1.23 KB
/
main.lua
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
-- credit to a1k0n, firsm, and jexkerome for their codes
local buffer = {
["CHANNEL"] = {timer=Timer(), active=false},
["SECTOR"] = {timer=Timer(), active=false},
["GROUP"] = {timer=Timer(), active=false},
["GUILD"] = {timer=Timer(), active=false},
["PRIVATE"] = {timer=Timer(), active=false},
["SYSTEM"] = {timer=Timer(), active=false},
["STATION"] = {timer=Timer(), active=false},
}
local function sendchat(str, chan, name)
chan = chan:upper()
chan = chan == "SAY" and "SECTOR" or chan
if not buffer[chan].active then
buffer[chan].active = true
SendChat(str, chan, name)
buffer[chan].timer:SetTimeout(360, function()
if buffer[chan][1] then
local tosend = table.remove(buffer[chan], 1)
SendChat(tosend[1], tosend[2], tosend[3])
buffer[chan].timer:SetTimeout(360)
else
buffer[chan].active = false
end
end)
else
table.insert(buffer[chan], {str, chan, name})
end
end
function SendChat2(str, chan, name) -- buffered SendChat function
chan = chan:upper()
local num = 1
for i = 1, 50 do -- don't want to spam chat TOO much
local newstr = str:sub(num, num+256)
if not newstr or newstr == "" then break end
sendchat(newstr, chan, name)
num = num+256
end
end
dofile("relay.lua")
dofile("ui.lua")