Advertisement
Guest User

Arrow real

a guest
Dec 5th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tfm.exec.disableAutoNewGame(true)
  2. tfm.exec.disableAfkDeath(true)
  3. tfm.exec.disableAutoShaman(true)
  4. tfm.exec.disableAutoScore(disable)
  5. tfm.exec.newGame("@6385854")
  6.  
  7.  
  8. tx=0
  9. ty=0
  10. tangle=0
  11. rx=0
  12. ry=0
  13.  
  14. function eventChatCommand(name,message)
  15. if message=="skip" then
  16. tfm.exec.setGameTime (0 , true )
  17. end
  18. if message=="respawn" then
  19. tfm.exec.respawnPlayer(name)
  20. end
  21. if message=="long" then
  22. tfm.exec.setGameTime(9999, true)
  23. end
  24. local IDList = {}
  25. if message=="clear" then
  26. for id, object in pairs(tfm.get.room.objectList) do
  27. table.insert(IDList, id)
  28. end
  29. for i, id in pairs(IDList) do
  30. tfm.exec.removeObject(id)
  31. end
  32. end
  33. end
  34.  
  35.  
  36. function eventNewPlayer(name)
  37. for _, k in pairs({40, 83, 32}) do
  38. tfm.exec.bindKeyboard(name, k, true, true)
  39. end
  40. system.bindMouse(name,true)
  41. tfm.exec.setPlayerScore(name, 100, false)
  42. end
  43.  
  44. function eventKeyboard(player, key, down, x, y)
  45. if key==40 or key==83 then
  46. if tfm.get.room.playerList[player].isFacingRight==true then
  47. tfm.exec.addShamanObject(35, x+15, y, 0, 30, 0, false)
  48. elseif tfm.get.room.playerList[player].isFacingRight==false then
  49. tfm.exec.addShamanObject(35, x-15, y, 180, -30, 0, false)
  50. end
  51. end
  52. if key==32 then
  53. tfm.exec.movePlayer(player,0,0,true,0,-50,false)
  54. end
  55. end
  56.  
  57. function eventMouse(player,x,y)
  58. tx=tfm.get.room.playerList[player].x
  59. ty=tfm.get.room.playerList[player].y
  60. tangle=(180/math.pi)*math.atan2((y-ty),(x-tx))
  61. rx=x-tx
  62. ry=y-ty
  63.  
  64. if math.abs(ry)>=math.abs(rx) then
  65. if ry<0 then
  66. rx=(rx/math.abs(ry))*30
  67. ry=-30
  68. elseif ry>0 then
  69. rx=(rx/math.abs(ry))*30
  70. ry=30
  71. end
  72. elseif math.abs(rx)>math.abs(ry) then
  73. if rx<0 then
  74. ry=(ry/math.abs(rx))*30
  75. rx=-30
  76. elseif rx>0 then
  77. ry=(ry/math.abs(rx))*30
  78. rx=30
  79. end
  80. end
  81.  
  82.  
  83.  
  84.  
  85. if x>tx then
  86. tfm.exec.addShamanObject(35, tx+30, ty, tangle, rx, ry, false)
  87. elseif x<tx then
  88. tfm.exec.addShamanObject(35, tx-30, ty, tangle, rx, ry, false)
  89. elseif x==tx and y>ty then
  90. tfm.exec.addShamanObject(35, tx, ty+30, tangle, 0, 30, false)
  91. elseif x==tx and y<ty then
  92. tfm.exec.addShamanObject(35, tx, ty-30, tangle, 0, -30, false)
  93. end
  94. end
  95.  
  96. function eventPlayerDied(name)
  97. tfm.exec.setPlayerScore(name, -1, true)
  98. tfm.exec.respawnPlayer(name)
  99. end
  100.  
  101.  
  102. for name in pairs(tfm.get.room.playerList) do
  103. eventNewPlayer(name)
  104. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement