Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data={}
- day_cicle = function(object)
- local this = object
- local __init__=function()
- this.id = os.time();
- this.time = os.time();
- this.elapsed = os.time();
- this.dark = 120
- this.next = "night"
- end
- this.eventLoop=function()
- if this.time < os.time()-120000 and this.elapsed < os.time()-12000 and this.dark > 75 and this.next == "night" then
- this.dark = this.dark - 5
- this.elapsed=os.time();
- if this.dark == 75 then
- this.time=os.time();
- this.next = "day"
- end
- end
- if this.time < os.time()-120000 and this.elapsed < os.time()-6000 and this.dark < 120 and this.next == "day" then
- this.dark = this.dark + 5
- this.elapsed=os.time();
- if this.dark == 120 then
- this.time=os.time();
- this.next = "night"
- end
- end
- ui.addTextArea(this.id,"",this.username,-300,-200,9999,9999,1,1,this.dark,true)
- end
- return {main=__init__,loop=this.eventLoop}
- end
- function eventLoop()
- for all in pairs(tfm.get.room.playerList) do
- if data[all] then
- data[all].loop()
- end
- end
- end
- function eventNewPlayer(name)
- data[name]=day_cicle({username=name})
- data[name].main()
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement