Safwanrockz

Lives System

Mar 16th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. img = {"fbASScD.png",
  2.        x={5,-5,-15},
  3.        y=-30}
  4. players = {}
  5.  
  6. tfm.exec.disableAutoNewGame(true)
  7. tfm.exec.disableAutoShaman(true)
  8. tfm.exec.newGame(0)
  9.  
  10. for name in pairs(tfm.get.room.playerList) do
  11.      players[name]={}
  12.      players[name].life = 3
  13.      for i=1,3 do
  14.           tfm.exec.addImage(img[1],"$"..name,img.x[i],img.y)
  15.      end
  16. end
  17. function eventPlayerRespawn(name)
  18.      if players[name].life ~= 0 then
  19.          for i=1,players[name].life do
  20.              tfm.exec.addImage(img[1],"$"..name,img.x[i],img.y)
  21.          end
  22.      end
  23. end
  24. function eventPlayerDied(name)
  25.      if players[name].life ~= 1 then
  26.              players[name].life = players[name].life - 1
  27.          tfm.exec.respawnPlayer(name)
  28.      else
  29.          tfm.exec.chatMessage("<R>You ran out of lives!", name)
  30.      end
  31. end
Add Comment
Please, Sign In to add comment