Thetroz

Untitled

Jan 8th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. -- TABLAS --
  2. players={}
  3. life=3
  4.  
  5. -- FUNCIONES --
  6. function eventNewPlayer(name)
  7. if not players[name] then
  8. players[name]={life=3}
  9. elseif players[name] then
  10. players[name]={life=3}
  11. end
  12. end
  13. function eventNewGame(name)
  14. for k,_ in pairs(tfm.get.room.playerList) do
  15. eventNewPlayer(k)
  16. end
  17. end
  18. function eventPlayerDied(name)
  19. players[name].life=players[name].life-1
  20. if players[name].life > 0 then
  21. tfm.exec.respawnPlayer(name)
  22. end
  23. end
  24.  
  25. function eventLoop()
  26. for name,p in pairs(players) do
  27. for player in pairs(tfm.get.room.playerList) do
  28. player_x=tfm.get.room.playerList[player].x
  29. player_y=tfm.get.room.playerList[player].y
  30. name_x=tfm.get.room.playerList[name].x
  31. name_y=tfm.get.room.playerList[name].y
  32. if players[name].life == 3 then
  33. tfm.exec.displayParticle(5,name_x-50, name_y-50,0,0, 0, 0, name)
  34. tfm.exec.displayParticle(5,name_x-50, name_y-50,0,0, 0, 0, name)
  35. tfm.exec.displayParticle(5,name_x-50, name_y-50,0,0, 0, 0, name)
  36. elseif players[name].life == 2 then
  37. tfm.exec.displayParticle(5,name_x-50, name_y-50,0,0, 0, 0, name)
  38. tfm.exec.displayParticle(5,name_x-50, name_y-50,0,0, 0, 0, name)
  39. elseif players[name].life == 1 then
  40. tfm.exec.displayParticle(5,name_x-50, name_y-50,0,0, 0, 0, name)
  41. end
  42. end
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment