Tectoon

[TFM] PopUp em construção

Jun 26th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.73 KB | None | 0 0
  1. room = {}
  2. interface = {}
  3. interface.main = [[
  4. <p align='center'><font size='20' face='Monospace' color='#98E2EB'>Room control</font>
  5. The next groups are available:
  6. <font color='#95D9D6'>
  7. <a href="event:room">Room settings</a>
  8. <a href="event:shaman">shaman settings</a>
  9. <br/>
  10. <a href="event:exit"><b>Close menu</b></a></font></p>
  11. </p>
  12. ]]
  13. interface.shaman = [[
  14. <p align='center'><font size='20' face='Monospace' color='#98E2EB'>Shaman settings</font><br/>
  15. <font color='#95D9D6'>
  16. <a href="event:add_shaman">Add a new shaman</a>
  17. <a href="event:all_shaman">Set everyone as shaman</a>
  18. <br/><a href="event:back"><b>Back to previous menu</b></a></p>
  19. ]]
  20. interface.room = [[
  21. <p align='center'><font size='20' face='Monospace' color='#98E2EB'>Room settings</font>
  22. <font color='#95D9D6'><a href="event:play_map">Play a new map</a>
  23. <a href="event:all_shaman">Enable Snow</a>, <a href="event:all_shaman">Disable Snow</a>
  24. <br/><a href="event:back"><b>Back to previous menu</b></a></p>
  25. ]]
  26.  
  27.  
  28.  
  29. for playerName,player in pairs(tfm.get.room.playerList) do
  30.   ui.addTextArea(18, "<a href='event:openmenu'><font color='#D4CDCD'><b>Open room control</font></b></a>", playerName, 660, 30, 130, 20, "0x274850", "0x98E2EB", 0.1)
  31. end
  32.  
  33. function whisper(to,from,message) tfm.exec.chatMessage('<font color="#F0A78E"><B>></B> [<font color="#e88f4f"><B>'..from..'</B></font>] '..message..'</font>',to) end
  34. function botSay(message) tfm.exec.chatMessage('<font color="#009D9D">[Infobot]</font> '..message..'</font>') end
  35. function split(str) local t = {} for w in str:gmatch("%S+") do table.insert(t,w) end return t end
  36. function eventNewGame()
  37.     room['allshams'] = 0
  38. end
  39.  
  40. function userInRoom(mouse)
  41.     for playerName,player in pairs(tfm.get.room.playerList) do
  42.         if playerName == mouse then
  43.             return true
  44.         else
  45.             return false
  46.         end
  47.     end
  48. end
  49.  
  50. function eventTextAreaCallback(id, playerName, callback)
  51.   if callback == "openmenu" then
  52.     ui.addTextArea(1, interface.main, playerName, 225, 50, 350, 300, "0x274850", "0x98E2EB", 0.8)
  53.   elseif callback == "back" then
  54.     ui.addTextArea(1, interface.main, playerName, 225, 50, 350, 300, "0x274850", "0x98E2EB", 0.8)
  55.   elseif callback == "exit" then
  56.     ui.addTextArea(1, interface.shaman, playerName, 220005, 100060, 350, 125, "0x274850", "0x98E2EB", 0.8)
  57.   elseif id == 1 then
  58.     if callback == "shaman" then
  59.       ui.addTextArea(1, interface.shaman, playerName, 225, 50, 350, 300, "0x274850", "0x98E2EB", 0.8)
  60.     elseif callback == "room" then
  61.       ui.addTextArea(1, interface.room, playerName, 225, 50, 350, 300, "0x274850", "0x98E2EB", 0.8)
  62.     elseif callback == "add_shaman" then
  63.       ui.addTextArea(1, interface.shaman, playerName, 220005, 100060, 350, 125, "0x274850", "0x98E2EB", 0.8)
  64.       ui.addPopup(2, 2, "Enter the name of the shaman you want to add.", playerName, 225, 160, 350)
  65.     elseif callback == "play_map" then
  66.       ui.addTextArea(1, interface.shaman, playerName, 220005, 100060, 350, 125, "0x274850", "0x98E2EB", 0.8)
  67.       ui.addPopup(3, 2, "Enter a map code", playerName, 225, 160, 350)
  68.     elseif callback == "all_shaman" then
  69.       for playerName,player in pairs(tfm.get.room.playerList) do
  70.         tfm.exec.setShaman(playerName)
  71.       end
  72.       botSay("<font color='#95D9D6'>"..playerName.."</font> added everyone as shaman.")
  73.       tfm.exec.setUIShamanName("<ROSE>Everyone! :D")
  74.     end
  75.   end
  76. end
  77.  
  78. function eventPopupAnswer(id, playerName, answer)
  79.   if id == 2 then
  80.       tfm.exec.setShaman(answer)
  81.       botSay("<font color='#95D9D6'>"..playerName.."</font> added <font color='#FF99FF'>"..answer.."</font> as shaman.")
  82.   elseif id == 3 then
  83.       tfm.exec.newGame(answer)
  84.       botSay("<font color='#95D9D6'>"..playerName.."</font> plays map <font color='#EB1D51'>"..answer.."</font>")
  85.   end
  86. end
Advertisement
Add Comment
Please, Sign In to add comment