Unlocker001_TFM

deathmatch by unlocker001

Feb 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. tfm.exec.disableAutoNewGame(true)
  2. tfm.exec.disableAutoShaman(true)
  3. players={}
  4. toDespawn={}
  5. maps={521833,401421,541917,541928,541936,541943,527935,559634,559644,888052,878047,885641,770600,770656,772172,891472,589736,589800,589708,900012,901062,754380,901337,901411,907870,910078,1190467,1252043,1124380,1016258,1252299,1255902,1256808,986790,1285380,1271249,1255944,1255983,1085344,1273114,1276664,1279258,1286824,1280135,1280342,1284861,1287556,1057753,1196679,1288489,1292983,1298164,1298521,1293189,1296949,1308378,1311136,1314419,1314982,1318248,1312411,1312589,1312845,1312933,1313969,1338762,1339474,1349878,1297154,644588,1351237,1354040,1354375,1362386,1283234,1370578,1306592,1360889,1362753,1408124,1407949,1407849,1343986,1408028,1441370,1443416,1389255,1427349,1450527,1424739,869836,1459902,1392993,1426457,1542824,1533474,1561467,1563534,1566991,1587241,1416119,1596270,1601580,1525751,1582146,1558167,1420943,1466487,1642575,1648013,1646094,1393097,1643446,1545219,1583484,1613092,1627981,1633374,1633277,1633251,1585138,1624034,1616785,1625916,1667582,1666996,1675013,1675316,1531316,1665413,1681719,1699880,1688696,623770,1727243,1531329,1683915,1689533,1738601,3756146,912118,3326933,3722005,3566478,1456622,1357994,1985670,1884075,1708065,1700322,2124484,3699046,2965313,4057963,4019126,3335202,2050466}
  6.  
  7. function eventNewPlayer(name)
  8. for i,key in ipairs({32,40,83}) do
  9. tfm.exec.bindKeyboard(name,key,true,true)
  10. end
  11. players[name]={
  12. timestamp=os.time(),
  13. offsets={x=2, y=10}
  14. }
  15. end
  16.  
  17. function eventKeyboard(name,key,down,x,y)
  18. if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started then
  19. if players[name].timestamp < os.time()-1000 then
  20. local id=tfm.exec.addShamanObject(17, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, tfm.get.room.playerList[name].isFacingRight and 90 or 270)
  21. players[name].timestamp=os.time()
  22. table.insert(toDespawn,{os.time(),id})
  23. end
  24. end
  25. end
  26.  
  27. function eventChatCommand(name,command)
  28. local arg={}
  29. for argument in command:gmatch("[^%s]+") do
  30. table.insert(arg,argument)
  31. end
  32. if arg[1]=="off" then
  33. if tonumber(arg[2]) and tonumber(arg[3]) then
  34. players[name].offsets.x=tonumber(arg[2])
  35. players[name].offsets.y=tonumber(arg[3])
  36. else
  37. players[name].offsets.x=2
  38. players[name].offsets.y=10
  39. end
  40. tfm.exec.chatMessage("Offsets changed to X:"..players[name].offsets.x.." Y:"..players[name].offsets.y,name)
  41. end
  42. end
  43.  
  44. function eventNewGame()
  45. started=false
  46. end
  47.  
  48. function eventLoop(time,remaining)
  49. if time >= 3000 and not started then
  50. started=true
  51. end
  52. if remaining<=0 then
  53. tfm.exec.newGame(maps[math.random(#maps)])
  54. end
  55. for i,cannon in ipairs(toDespawn) do
  56. if cannon[1] <= os.time()-3000 then
  57. tfm.exec.removeObject(cannon[2])
  58. table.remove(toDespawn,i)
  59. end
  60. end
  61. end
  62.  
  63. function eventPlayerDied(name)
  64. local i=0
  65. local n
  66. for pname,player in pairs(tfm.get.room.playerList) do
  67. if not player.isDead then
  68. i=i+1
  69. n=pname
  70. end
  71. end
  72. if i==0 then
  73. tfm.exec.newGame(maps[math.random(#maps)])
  74. elseif i==1 then
  75. tfm.exec.giveCheese(n)
  76. tfm.exec.playerVictory(n)
  77. tfm.exec.setGameTime(5)
  78. end
  79. end
  80.  
  81. for name,player in pairs(tfm.get.room.playerList) do
  82. eventNewPlayer(name)
  83. end
  84.  
  85. tfm.exec.newGame(maps[math.random(#maps)])
Add Comment
Please, Sign In to add comment