NoorTFM

Chat

Jun 1st, 2023
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local chatTable = {}
  2. local messages = 0
  3. ui.addTextArea(1, "", nil, 200, 100, 400, 300, 0x6E4720, 0x6E4720, 0.8, true)
  4.  
  5. function updateTheChat()
  6.     if chatTable then
  7.         table.sort(chatTable, function(p1,p2) return p1.id > p2.id end)
  8.         local text = ""
  9.         for n,log in next, chatTable do
  10.             text  = text .. "<v>["..log.player.."]</v><n> " .. log.msg.. "</n>\n"
  11.         end
  12.         ui.updateTextArea(1,text)
  13.     end
  14. end
  15.  
  16. function eventChatMessage(name, msg)
  17.     messages = messages + 1
  18.     chatTable[#chatTable + 1] = {player = name, msg = msg, id = messages}
  19.     updateTheChat()
  20. end
  21.  
Add Comment
Please, Sign In to add comment