suxonov

Halloween 2010 TFM parody

Jun 7th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. ------------- Halloween 2010 TFM parody -----------------
  2. ------------------- by Aviener --------------------------
  3. started = false
  4.  
  5. tfm.exec.disableAutoShaman(true)
  6. tfm.exec.disableAutoTimeLeft(true)
  7. tfm.exec.disableAutoNewGame(true)
  8. tfm.exec.newGame(6705833)
  9.  
  10. for name,player in pairs(tfm.get.room.playerList) do
  11.     system.bindKeyboard(name, 32, true, true)
  12. end
  13.  
  14. function eventKeyboard(name, key, down, x, y)
  15.     if key == 32 then
  16.         tfm.exec.movePlayer(name,0,0,true,0,-50,false)
  17.     end
  18. end
  19.  
  20. function addCheese(x, y)
  21.     ui.addTextArea(0, "<p align='center'><J>Сыр</p>", nil, x, y, 48, 22)
  22. end
  23.  
  24. function pythag(x1,y1,x2,y2)
  25.     return math.sqrt((y2-y1)^2+(x2-x1)^2)
  26. end
  27.  
  28. function eventNewGame()
  29.     tfm.exec.setGameTime(0)
  30. end
  31.  
  32. function eventPlayerWon(n)
  33.     tfm.exec.respawnPlayer(n)
  34. end
  35.  
  36. function eventPlayerDied(n)
  37.     tfm.exec.respawnPlayer(n)
  38. end
  39.  
  40. seconds = 2
  41. function eventLoop(time, rem)
  42.     if time >= 5000 then
  43.         started = true
  44.     end
  45.     seconds = seconds - 0.5
  46.     if seconds == 0 then
  47.         x = math.random(100, 650)
  48.         y = math.random(50, 350)
  49.         seconds = 2
  50.         addCheese(x, y)
  51.         return x,y
  52.     end
  53.     for name,player in pairs(tfm.get.room.playerList) do
  54.         px = tfm.get.room.playerList[name].x
  55.         py = tfm.get.room.playerList[name].y
  56.         if started == true then
  57.             if pythag(x+20,y+5,px,py) <= 20 and not player.hasCheese then
  58.                 tfm.exec.giveCheese(name)
  59.                 ui.removeTextArea(0)
  60.             end
  61.         end
  62.     end
  63. end
Add Comment
Please, Sign In to add comment