Advertisement
Dudugz-Contistente

Untitled

Sep 30th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. local a={}function addTimer(b,c,d,e,...)local f=#a+1;a[f]={callback=b,label=e,arguments={...},time=c,currentTime=0,currentLoop=0,loops=d or 1,isComplete=false}return f end;function removeTimer(f)if a[f]then a[f]=0;return true end;return false end;function clearTimers()a={}end;function eventLoop(g,h)local i={}for f=1,#a do local j=a[f]if type(j)=='table'then if not j.isComplete then j.currentTime=j.currentTime+500;if j.currentTime>=j.time then j.currentTime=0;j.currentLoop=j.currentLoop+1;if j.loops>0 then if j.currentLoop>=j.loops then j.isComplete=true end end;if type(j.callback)=='function'then j.callback(j.currentLoop,table.unpack(j.arguments))end end end;if j.isComplete then if type(eventTimerComplete)=='function'then eventTimerComplete(f,j.label)end;i[#i+1]=f end end end;for k=1,#i do removeTimer(i[k])end
  2. -- Insira seu eventLoop aqui
  3.  
  4. end
  5.  
  6. novaClasse = function(object) -- o novaClasse pode ser renomeado para qualquer coisa
  7. local self = object -- self pode ser renomeado para qualquer coisa
  8.  
  9. --[[
  10. Variáveis já existentes(são auto-adicionadas/elas se auto-atualizam nesse script):
  11. self.community (string)
  12. self.hasCheese (boolean)
  13. self.id (number)
  14. self.inHardMode (boolean)
  15. self.isDead (boolean)
  16. self.isFacingRight (boolean)
  17. self.isJumping (boolean)
  18. self.isShaman (boolean)
  19. self.isVampire (boolean)
  20. self.look (string)
  21. self.movingLeft (boolean)
  22. self.movingRight (boolean)
  23. self.playerName : Tigrounette (string)
  24. self.registrationDate (number)
  25. self.score (number)
  26. self.shamanMode (number)
  27. self.title (number)
  28. self.vx (number)
  29. self.vy (number)
  30. self.x (number)
  31. self.y (number)
  32. ]]--
  33.  
  34. self.eventLoop = function() -- Criada a função dentro da classe
  35. local player = tfm.get.room.playerList[self.playerName]
  36. self.hasCheese = player.hasCheese
  37. self.inHardMode = player.inHardMode
  38. self.isDead = player.isDead
  39. self.isFacingRight = player.isFacingRight
  40. self.isJumping = player.isJumping
  41. self.isShaman = player.isShaman
  42. self.look = player.look
  43. self.movingLeft = player.movingLeft
  44. self.movingRight = player.movingRight
  45. self.score = player.score
  46. self.shamanMode = player.shamanMode
  47. self.title = player.title
  48. self.vx = player.vx
  49. self.vy = player.vy
  50. self.x = player.x
  51. self.y = player.y
  52. end
  53.  
  54. local __init__=function() -- função principal
  55. self.timer = addTimer(self.eventLoop, 50, 0)
  56. end
  57.  
  58. return {main=__init__}
  59. end
  60.  
  61. for name,info in pairs(tfm.get.room.playerList) do
  62. system = novaClasse(info) -- system pode ser alterado para qualquer nome, se novaClasse for alterado lá no começo aqui também deve
  63. system.main() -- se system for alterado aqui também deve ser
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement