-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.lua
More file actions
64 lines (61 loc) · 1.71 KB
/
functions.lua
File metadata and controls
64 lines (61 loc) · 1.71 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
56
57
58
59
60
61
62
63
64
function setTime(Split, Player)
if Split[2] == 'on' then
Root:ForEachWorld(
function (World)
local thisWorld = World:GetName()
isStopped[thisWorld] = true
savedTime[thisWorld] = nil
if Split[3] ~= nil then
World:SetTimeOfDay(Split[3])
end
print( thisWorld .. ": time stopped at " .. World:GetTimeOfDay() )
end
)
elseif Split[2] == 'off' then
Root:ForEachWorld(
function(World)
local thisWorld = World:GetName()
if isStopped[thisWorld] == true then
isStopped[thisWorld] = false
print(thisWorld .. ": time resumed" )
end
end
)
elseif Split[2] == "overview" and Split[3] == nil then
Player:SendMessage( "------------------------------------------" )
Root:ForEachWorld(
function(World)
local thisWorld = World:GetName()
if isStopped[thisWorld] then
Player:SendMessage( thisWorld .. ": " .. cChatColor.Rose .. "stopped at " .. savedTime[thisWorld] )
else
Player:SendMessage( thisWorld .. ": " .. cChatColor.Green .. "running at " .. World:GetTimeOfDay() )
end
end
)
Player:SendMessage( "------------------------------------------" )
else
setTimeWorld(Split, Player)
end
return true
end
function setTimeWorld(Split, Player)
Root:ForEachWorld(
function(World)
local thisWorld = World:GetName()
if thisWorld == Split[2] then
if Split[3] == 'on' then
isStopped[Split[2]] = true
savedTime[Split[2]] = nil
if Split[4] ~= nil then
World:SetTimeOfDay(Split[4])
end
print(Split[2] .. ": time stopped at " .. World:GetTimeOfDay() )
end
if Split[3] == 'off' then
isStopped[thisWorld] = false
end
end
end
)
end