Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- adm = {Sagazgamer = true, Tectoon = true}
- print("<J>#Records <n>carregado com sucesso!")
- module={}
- module.time=os.time()
- module.text={
- info="<b>Gravidade:<v>%s</v>\nVento:<v>%s</v>\nRecords:<j>%s</j>-<v>%s",
- }
- module.addText=function(self,id,txt,p,x,y)
- ui.addTextArea(id,txt,p,x,y,nil,nil,1,1,0)
- end
- function module:start(m,name,t)
- self.data={}
- self.record={}
- self.name=name
- self.mt=t
- self.m=m
- self.NewPlayer=function(self,p)
- self.data[p]=not self.data[p] and {time=os.time()} or self.data[p]
- tfm.exec.bindKeyboard(p,string.byte('X'),true,true)
- tfm.exec.bindKeyboard(p,string.byte('C'),true,true)
- self.data[p].CP=function(self,x,y)
- if self.time<os.time()-1000 then
- self.x=x
- self.y=y
- tfm.exec.displayParticle(9,x,y,0,0,0,0,p)
- self.time=os.time()
- end
- end
- end
- self.PlayerDied=function(self,p)
- tfm.exec.respawnPlayer(p)
- end
- self.Keyboard=function(self,p,k,d,x,y)
- if string.byte('X')==k then
- self.data[p]:CP(x,y)
- elseif string.byte('C')==k then
- if self.data[p].x then
- tfm.exec.movePlayer(p,self.data[p].x,self.data[p].y)
- end
- end
- end
- self.Chat=function(self,p,c)
- clower=c:lower()
- if clower=="mort" then
- tfm.exec.killPlayer(p)
- end
- end
- self.Loop=function(self,a,b)
- if self.carregado then
- if b<=0 then self:np() end
- w,g=0,10
- for a,b in self.xml.xml:gmatch('G="(.-),(.-)"') do
- w,g=a,b
- end
- if #self.record[self.xml.mapCode]>0 then
- table.sort(self.record[self.xml.mapCode],function(a,b) return a.t<b.t end)
- end
- top_tb=self.record[self.xml.mapCode][1] or {p="",t=""}
- self:addText(0,self.text.info:format(g or 10,w or 0,top_tb.p,top_tb.t),nil,5,20)
- end
- end
- self.NewGame=function(self,xml)
- self.xml=xml
- tfm.exec.setGameTime(self.mt)
- self.record[xml.mapCode]=not self.record[xml.mapCode] and {} or self.record[xml.mapCode]
- end
- self.Won=function(self,player,_,time,p)
- table.insert(self.record[self.xml.mapCode],{p=player,t=time/100})
- end
- self.np=function(self)
- local pm=self.m
- tfm.exec.newGame(pm[math.random(#pm)])
- end
- self.config=function()
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- end
- self:config()
- self:np()
- _G.eventLoop=function(a,b) self:Loop(a,b) end
- _G.eventNewPlayer=function(p) self:NewPlayer(p) end
- _G.eventNewGame=function() self:NewGame(tfm.get.room.xmlMapInfo) end
- _G.eventPlayerWon=function(p,_,t) self:Won(p,_,t) end
- _G.eventPlayerDied=function(p) self:PlayerDied(p) end
- _G.eventKeyboard=function(p,k,d,x,y) self:Keyboard(p,k,d,x,y) end
- _G.eventChatCommand=function(p,c) self:Chat(p,c) end
- table.foreach(tfm.get.room.playerList,function(k) self:NewPlayer(k) end)
- self.carregado=true
- end
- s_table={
- {511136,3999991,3547571,3161324,3012311,4317592,3734991,3734997,3750360,3734998,3999979,4390388,4367270,3137929,3547571,3471016,2860211,2967631,2805938,3815568,720672,3849999,3551333,3493490,3136410,842019,3668888,3850000,3264848,2996951,2805938,3815568,720672,3849999,3551333,3493490,3136410,842019,2805938,3815568,720672,3849999,3551333,3493490,3136410,842019,3668888,3850000,3668877,3200001,3483300,3920916,3395605,3386996,3478040,4656973},
- "#Records",
- 121,--Tempo
- }
- module:start(table.unpack(s_table))
- print(("\n<v>%s\n%s"):format(module.name,tostring(os.time()-module.time)))
- function eventChatCommand(p,c)
- local args={}
- for i in c:gmatch('[^%s]+') do
- table.insert(args,i)
- end
- if args[1]=="map" and adm[p] then
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- print("<ch>#Records<n> Mapa carregado com sucesso!")
- if args[2] then
- tfm.exec.newGame(args[2])
- else
- print("<R>O mapa não existe ou não carrega")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment