Advertisement
thatparadox

deathCount

Nov 25th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. chat = peripheral.wrap("bottom")
  2. command = peripheral.wrap("back")
  3.  
  4. while true do
  5.     event, player = os.pullEvent()
  6.     if event == "chat_death" then
  7.         if fs.exists(player) then
  8.             file = io.open(player, "r")
  9.             deaths = file.read()
  10.             deaths = deaths + 1
  11.             file:close()
  12.             file = fs.open(player, "w")
  13.             file.write(deaths)
  14.             file:close()
  15.         else
  16.             file = fs.open(player, "w")
  17.             file.write("1")
  18.             file:close()
  19.             deaths = 1
  20.         end
  21.         if deaths == 1 then
  22.             command.setCommand("/say "..player.." has died. Be more careful, peasant")
  23.             chat.say(player.." has died. Be more careful, peasant")
  24.         elseif deaths > 30 then
  25.             command.setCommand("/say "..player.." has died "..deaths.." times... I'm not even surprised any more...")
  26.         elseif deaths > 25 then
  27.             command.setCommand("/say "..player.." has died "..deaths.." times. Stop dying you cowards!")
  28.         elseif deaths > 20 then
  29.             command.setCommand("/say "..player.." has died "..deaths.." times!?!? What are you doing down there, peasants?")
  30.         elseif deaths > 15 then
  31.             command.setCommand("/say "..player.." has died "..deaths.." times. Why do you keep dying!?")
  32.         elseif deaths > 10 then
  33.             command.setCommand("/say "..player.." has died "..deaths.." times. It better be worth my while resurrecting you.")
  34.         elseif deaths > 3 then
  35.             command.setCommand("/say "..player.." has died "..deaths.." times now. I'll revive them, I guess.")
  36.         elseif deaths > 2 then
  37.             command.setCommand("/say "..player.." has died again! Klutz.")             
  38.         end
  39.         command.runCommand()
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement