-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrainWorld-host.lua
More file actions
55 lines (55 loc) · 1.27 KB
/
Copy pathrainWorld-host.lua
File metadata and controls
55 lines (55 loc) · 1.27 KB
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
rednet.open("top")
local exshelt = 1
while os.time("ingame") < 19 do
sleep(5)
end
function split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
commands.exec('tellraw @a ["The rain is starting..."]')
sleep(0.1)
commands.exec('tellraw @a ["Find shelter."]')
commands.exec('weather rain')
sleep(60)
commands.exec('weather thunder')
sleep(30)
rednet.broadcast("rainstartsense")
local safetbl = {}
for i=1,exshelt do
local _, th = rednet.receive()
local goodol = textutils.unserialize(th)
for k,v in pairs(goodol) do
safetbl[k] = true
end
end
local _, plist = commands.exec("list")
local pstr = ""
for k,v in ipairs(plist) do
pstr = pstr..v
end
plist = split(pstr)
for i=1,10 do
table.remove(plist,1)
end
for k,v in ipairs(plist) do
plist[k] = string.gsub(v,"%,","")
end
for k,v in ipairs(plist) do
if not safetbl[v] then
commands.exec("clear "..v)
commands.exec("kill "..v)
commands.exec("scoreboard players remove karma 1")
else
commands.exec("scoreboard players add karma 1")
end
end
commands.exec("time add 7000")
commands.exec("weather clear")
os.reboot()