Bolodefchoco_LUAXML

[Script] Possessor de Bolos

Mar 19th, 2016
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.76 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 19/03/2016
  3. --Last update: 15/05/2016
  4. --[[ Notes:
  5.     Does:
  6.         Seja um bolo pelo mapa.
  7.     Commands:
  8.         !
  9.             move --> Altera o(s) valor(es) de velocidade
  10.                 1 --> Esquerda (Negativo)
  11.                 2 --> Para cima (Negativo)
  12.                 3 --> Direita
  13.                 4 --> Para baixo
  14.                     Value -- Valor
  15.             r --> Reviver
  16.     Keys:
  17.         Teclas Direcionais / WASD --> Controlam o bolo
  18.         Espaço --> Faz com que você se transforme num bolo grande (como eu haha)
  19. ]]--
  20.  
  21. table.foreach({"AutoNewGame","AutoTimeLeft","AutoShaman"},function(_,f) tfm.exec["disable"..f]() end)
  22. tfm.exec.newGame(math.random(100))
  23. mice = {}
  24. respawnPoint = {}
  25. transform = function(n,x,y)
  26.     if not mice[n] then
  27.         mice[n] = {
  28.             id = nil,
  29.             object = 104,
  30.             currentTitle = "Little Cake",
  31.             move = {-40,-30,40,30}
  32.         }
  33.     end
  34.     if respawnPoint[1] == nil and (T and T/1000 > 1) then respawnPoint = {(not tfm.get.room.playerList[n].isDead and tfm.get.room.playerList[n].x or 400),(not tfm.get.room.playerList[n].isDead and tfm.get.room.playerList[n].y or 100)} end
  35.     x = (not x and (tfm.get.room.playerList[n].isDead and l.x or tfm.get.room.playerList[n].x) or x or 400)
  36.     y = (not y and (tfm.get.room.playerList[n].isDead and l.y or tfm.get.room.playerList[n].y) or y or 200)
  37.     local vx,vy = tfm.get.room.playerList[n].isDead and l.vx or 0,tfm.get.room.playerList[n].isDead and l.vy or 0
  38.     tfm.exec.killPlayer(n)
  39.     mice[n].id = tfm.exec.addShamanObject(mice[n].object,x,y,ANGLE,vx,vy)
  40.     ui.addTextArea(mice[n].id,"<p align='center'><font color='#FFF3CE' size='12' face='verdana'>"..n.."\n<font size='11'>«"..mice[n].currentTitle.."»",nil,x-43,y-67,nil,30,1,1,.4,true)
  41. end
  42.  
  43. eventNewGame=function()
  44.     respawnPoint = {}
  45.     table.foreach(tfm.get.room.playerList,tfm.exec.respawnPlayer)
  46.     don = false
  47. end
  48.  
  49. eventNewPlayer=function(n)
  50.     eventLoop(1,1)
  51.     transform(n)
  52. end
  53.  
  54. eventKeyboard=table.foreach({0,1,2,3,32},function(_,k) table.foreach(tfm.get.room.playerList,function(n) system.bindKeyboard(n,k,true,true) end) end) or function(n,k)
  55.     if mice[n] then
  56.         if k < 5 then
  57.             k = k + 1
  58.             if k == 1 or k == 3 then
  59.                 tfm.exec.moveObject(mice[n].id,0,0,true,mice[n].move[k])
  60.             end
  61.             if k == 2 or k == 4 then
  62.                 tfm.exec.moveObject(mice[n].id,0,0,false,0,mice[n].move[k],true)
  63.             end
  64.         end
  65.         if k == 32 then
  66.             tfm.exec.removeObject(mice[n].id)
  67.             ui.removeTextArea(mice[n].id,nil)
  68.             if mice[n].object == 104 then
  69.                 mice[n].object = 207
  70.                 mice[n].currentTitle = "Big Cake"
  71.             else
  72.                 mice[n].object = 104
  73.                 mice[n].currentTitle = "Little Cake"
  74.             end
  75.             transform(n)
  76.         end
  77.         eventLoop(1,1)
  78.     end
  79. end
  80.  
  81. local don = false
  82. eventLoop=function(T,R,REVIVE) _G.T = T;_G.R = R
  83.     if T>1000 then
  84.         if not don then
  85.             if math.floor(T/1000) == 2 then
  86.                 don = true
  87.                 table.foreach(tfm.get.room.playerList,function(n)
  88.                     tfm.exec.respawnPlayer(n);if mice[n] then ui.removeTextArea(mice[n].id,nil) end;transform(n)
  89.                 end)
  90.             end
  91.         end
  92.         for n,v in next,mice do
  93.             if tfm.get.room.playerList[n] then
  94.                 l = tfm.get.room.objectList[mice[n].id]
  95.                 ANGLE = l.angle or 0
  96.                 ui.addTextArea(mice[n].id,"<p align='center'><font color='#FFF3CE' size='12' face='verdana'>"..n.."\n<font size='11'>«"..mice[n].currentTitle.."»",nil,l.x-43,l.y-67,nil,30,1,1,.4,true)
  97.                 if l.x > 820 or l.x < -30 or l.y > 390 or REVIVE then
  98.                     tfm.exec.removeObject(mice[n].id)
  99.                     ui.removeTextArea(mice[n].id,nil)
  100.                     transform(n,respawnPoint[1],respawnPoint[2])
  101.                 end
  102.             end
  103.         end
  104.     end
  105. end
  106.  
  107. eventChatCommand=function(n,c)
  108.     local p = {}
  109.     for v in c:gmatch('[^%s]+') do
  110.         table.insert(p,v)
  111.     end
  112.     p[1]=p[1]:lower()
  113.     if p[1] == "move" then
  114.         if p[2] and p[3] then
  115.             mice[n].move[tonumber(p[2])] = tonumber(p[3])
  116.         else
  117.             mice[n].move = {-40,-30,40,30}
  118.         end
  119.     end
  120.     if p[1] == "r" then
  121.         eventLoop(T,R,true)
  122.     end
  123. end
Advertisement
Add Comment
Please, Sign In to add comment