Advertisement
Bolodefchoco_LUAXML

[Script] Checkpoint

Nov 6th, 2016
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 06/11/2016
  3. --Last update: 06/11/2016
  4. --[[ Notes:
  5.     Does:
  6.         Sistema de checkpoint
  7.     Keys
  8.         Space --> Cria o checkpoint (Revive nas coordenadas dele após a morte)
  9.         Shift --> Deleta o último checkpoint e retorna ao anterior
  10. ]]--
  11.  
  12. mice = {}
  13. eventNewPlayer = function(n)
  14.     mice[n] = {
  15.         coord = {{0,0}},
  16.     }
  17.     for k,v in next,{32,16} do
  18.         system.bindKeyboard(n,v,true,true)
  19.     end
  20. end
  21. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  22.  
  23. eventNewGame = function()
  24.     for k,v in next,tfm.get.room.playerList do
  25.         mice[k].coord = {{0,0}}
  26.     end
  27. end
  28.  
  29. eventKeyboard = function(n,k,d,x,y)
  30.     if k == 32 then
  31.         table.insert(mice[n].coord,{x,y})
  32.     end
  33.     if k == 16 then
  34.         local c = mice[n].coord
  35.         if #c > 1 then
  36.             table.remove(c)
  37.         end
  38.     end
  39. end
  40.  
  41. eventLoop = function(time)
  42.     if time > 2999 then
  43.         for k,v in next,tfm.get.room.playerList do
  44.             local c = mice[k].coord
  45.             c = c[#c]
  46.             tfm.exec.displayParticle(11,c[1],c[2],0,0,0,0,k)
  47.         end
  48.     end
  49. end
  50.  
  51. eventPlayerDied = function(n)
  52.     local c = mice[n].coord
  53.     c = c[#c]
  54.     tfm.exec.respawnPlayer(n)
  55.     tfm.exec.movePlayer(n,c[1],c[2])
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement