Advertisement
Guest User

#Chat

a guest
Apr 14th, 2018
2,228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.36 KB | None | 0 0
  1. chat = ""
  2. function Lefut()
  3.     tfm.exec.setUIMapName("#Chat")
  4.     ui.addTextArea(0,chat,nil,7,86,254,235,0x324650,0x212F36,0.8,true)
  5.     ui.addPopup(1,2,"",nil,5,330,258,true)
  6.     tfm.exec.chatMessage("<D>Welcome to in the CHAT^^</D>")
  7.     ui.addTextArea(1,"<font size='20'><D>Készítette: <font color='#80E587'>Weth<font size='14'><font color='#6C77C1'>#9837</font>",nil,510,365,500,200,0x324650,0x212F36,0,true)
  8.     print("<D>\nKészítette: <font color='#80E587'>Weth<font color='#6C77C1'>#9837</font>")
  9. end
  10.  
  11. function teleVan()
  12.     local darab = 0
  13.     for i = 1, #chat do
  14.         local karakter = string.sub(chat,i,i)
  15.         if karakter == "[" then
  16.             darab = darab + 1
  17.         end
  18.     end
  19.     local index = 0
  20.     if darab >= 18 then
  21.         local hanyadik = 0
  22.         for i = 1, #chat do
  23.             local karakter2 = string.sub(chat,i,i)
  24.             if karakter2 == "[" then
  25.                 index = i
  26.                 hanyadik = hanyadik + 1
  27.                 if hanyadik == 2 then
  28.                     break
  29.                 end
  30.             end
  31.         end
  32.         local ujChat = string.sub(chat,index-24,#chat)
  33.         chat = ujChat
  34.     end
  35. end
  36.  
  37. function Frissites(playerName)
  38.     teleVan()
  39.     ui.updateTextArea(0,chat,nil)
  40. end
  41.  
  42. function eventPopupAnswer(popupID, playerName, answer)
  43.     kiirando = ""
  44.     if (popupID == 1) and (answer ~= "") and (#answer <= 35) then
  45.         kiirando = "<font color = '#009D9D'>["..playerName.."] <font color = '#C2C2DA'>"..answer
  46.         if chat == "" then
  47.             chat = chat..kiirando  
  48.         else
  49.             chat = chat.."\n"..kiirando
  50.         end
  51.         Frissites()
  52.             ui.addPopup(1,2,"",playerName,5,330,258,true)
  53.     end
  54.         if answer == "" then
  55.             ui.addPopup(1,2,"",playerName,5,330,258,true)
  56.         end
  57. end
  58.  
  59. function eventNewPlayer(playerName)
  60. tfm.exec.respawnPlayer(playerName)
  61.     tfm.exec.setUIMapName("#Chat")
  62.     ui.addTextArea(0,chat,nil,7,86,254,235,0x324650,0x212F36,0.8,true)
  63.     ui.addPopup(1,2,"",nil,5,330,258,true)
  64.     tfm.exec.chatMessage("<D>Welcome to in the CHAT^^</D>")
  65.     ui.addTextArea(1,"<font size='20'><D>Készítette: <font color='#80E587'>Weth<font size='14'><font color='#6C77C1'>#9837</font>",nil,510,365,500,200,0x324650,0x212F36,0,true)
  66.     print("<D>\nKészítette: <font color='#80E587'>Weth<font color='#6C77C1'>#9837</font>")
  67. end
  68.  
  69. Lefut()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement