Tectoon

[TFM] Rotação com Senha

Jun 11th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 KB | None | 0 0
  1. tfm.exec.disableAutoShaman(true)
  2. tfm.exec.disableAutoNewGame(true)
  3. senha="Gameplay"
  4. lock=true
  5. data={}
  6. np= tfm.exec.disableAutoNewGame(true) or {1054567, 47, 48};
  7.  
  8. function eventLoop(a, b)
  9.     local c= 0;
  10.     table.foreach(tfm.get.room.playerList, function(i,v) c= not v.isDead and c+1 or c end)
  11.     c= (c == 0 or b <=0) and tfm.exec.newGame(np[math.random(#np)]) or nil;
  12. end
  13.  
  14. eventLoop(0, 0)
  15. system.disableChatCommandDisplay("senha")
  16. system.disableChatCommandDisplay("lock")
  17. function eventNewPlayer(name)
  18.     newData={
  19.     ["s"]=10;
  20.     }
  21.     data[name]=newData;
  22.     if lock == true then
  23.         ui.addTextArea(8359,"<font size='48'><font face='Comic Sans MS'><font color='#0000ff'>Este cafofo está protegido por senha. Digite para entrar:",name,000,010,800,400,0x0040ff,0x0040ff,1.0,true)
  24.         ui.addPopup(0,2,"",name,350,175,200,true)
  25.     end
  26. end
  27. for name,player in pairs(tfm.get.room.playerList) do
  28.     eventNewPlayer(name)
  29. end
  30. function eventPlayerDied(name)
  31.     tfm.exec.respawnPlayer(name)
  32. end
  33. function eventChatCommand(name,message)
  34.     if message == "senha" then
  35.         ui.addPopup(1,2,"Insira a nova senha","name",350,175,200,true)
  36.     end
  37.     if message == "lock" then
  38.         if lock == true then
  39.             lock=false
  40.             ui.addPopup(10,0,"A sala foi desbloqueada com sucesso",name,350,175,200,true)
  41.         else
  42.             lock=true
  43.             ui.addPopup(10,0,"A sala foi bloqueada com sucesso, digite !senha para mudar a senha",name,350,175,200,true)
  44.         end
  45.     end
  46. end
  47. function eventPopupAnswer(id,name,answer)
  48.     if id == 0 then
  49.         if senha == answer then
  50.             ui.removeTextArea(8359,name)
  51.             tfm.exec.respawnPlayer(name)
  52.         else
  53.             data[name].s=data[name].s-1
  54.             if data[name].s >= 1 then
  55.                 ui.addPopup(0,2,"Senha incorreta, tente novamente!<br><br>Você ainda pode tentar mais <b>"..data[name].s.." vezes",name,350,175,200,true)
  56.             else
  57.                 ui.addTextArea(8359,"<font size='48'><font face='Comic Sans MS'><font color='#ff0000'>Você errou muitas senhas e não está autorizado a entrar no cafofo.",name,000,010,800,400,0xffff00,0xffff00,1.0,true)
  58.             end
  59.         end
  60.     end
  61.     if id == 1 then
  62.         senha=answer
  63.         ui.addPopup(10,0,"A senha foi mudada para: "..answer.."",name,350,175,200,true)
  64.     end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment