Advertisement
Tectoon

[TFM] Untitled

Dec 18th, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.73 KB | None | 0 0
  1. --Bolodefchoco << Criador da Script!
  2. --02/11/2015
  3.  
  4. --[[ Um chat básico com alguns comandos para adm (Linha 1).
  5.     /clear
  6.     /cor (html)
  7.     /flood número texto
  8. ]]--
  9.  
  10. adm = {Sagazgamer=true}
  11. mice={}
  12. add = ui.addTextArea
  13. chat=function(message,title,player,x,y,w,h,p)
  14.         message = message or ""
  15.         _G.message = message
  16.         title = title or "Chat"
  17.         title = "</B></S></I><font face='Lucida Console'><p align='center'><V>"..title
  18.         if player == nil then
  19.                 for i in pairs (tfm.get.room.playerList) do
  20.                         i = player
  21.                 end
  22.         end
  23.         x = x or 300-150/2
  24.         y = y or 80
  25.         w = w or 349
  26.         h = h or 200
  27.         ui.addPopup(0,2,'',p,x-1,y+200,w+1,true)
  28.         add(0,'',player,x,y,w,h,0x324650,0x212E35,1,true)
  29.         add(1,message,player,x+4,y+5,w-9,h-10,1,1,0,true)
  30.         add(2,title,n,x-1,y-20,w+1,h-185,0x212E35,0x212E35,1,true)
  31.         add(3,"<R><font size='15'><a href='event:chat_Close'><B>x</B></a></font></R>",player,x+325,y-25,25,25,1,1,0,true)
  32. end
  33. eventNewPlayer=function(n)
  34.         chat(message,title,player,x,y,w,h,p)
  35.         if not mice[n] then
  36.                 mice[n]={
  37.                         on = true,
  38.                         messagesoff = 0,
  39.                 }
  40.         end
  41. end
  42. for n in pairs (tfm.get.room.playerList) do
  43.         eventNewPlayer(n)
  44. end
  45. eventTextAreaCallback = function(i,n,c)
  46.         if c=="chat_Close" then
  47.                 mice[n].on=false
  48.                 ui.addPopup(0,2,'',n,1e7,1e7,1,false)
  49.                 add(0,"<VP><p align='center'><a href='event:chat_Open'>Chat <J>"..mice[n].messagesoff,n,745,378,50,h,0x324650,0x212E35,1,true)
  50.                 add(1,"<VP><p align='center'><a href='event:chat_Open'>Chat <J>"..mice[n].messagesoff,n,745,378,50,h,0x324650,0x212E35,1,true)
  51.                 add(2,"<VP><p align='center'><a href='event:chat_Open'>Chat <J>"..mice[n].messagesoff,n,745,378,50,h,0x324650,0x212E35,1,true)
  52.                 add(3,"<VP><p align='center'><a href='event:chat_Open'>Chat <J>"..mice[n].messagesoff,n,745,378,50,h,0x324650,0x212E35,1,true)
  53.         end
  54.         if c=="chat_Open" then
  55.                 mice[n].on=true
  56.                 chat(message,title,player,x,y,w,h,p)
  57.         end
  58. end
  59. eventPopupAnswer=function(i,n,a)
  60.         if i == 0 then
  61.                 a=a:gsub("http","*")
  62.                 a=a:gsub('<','&lt;')
  63.                 a=a:gsub("://","*")
  64.                 if adm[n] then
  65.                         cmd = {"/BLUE","/RED","/BL","/YELLOW","/N","/V","/GREEN","/PURPLE","/ROSE","/CH","/T","/ORANGE","/CEP","/CS","/N2","/PT","/S","/G"}
  66.                         html = {"<BV>","<R>","<BL>","<J>","<N>","<V>","<VP>","<VI>","<ROSE>","<CH>","<T>","<CE>","<CEP>","<CS>","<N2>","<PT>","<S>","<G>"}
  67.                         for k,v in pairs (cmd) do
  68.                                 for i = 1,#html do
  69.                                         a = a:gsub(v,html[k])
  70.                                 end
  71.                         end
  72.                         if a == "/clear" then
  73.                                 message = ""
  74.                                 message = "<ROSE>[Chat] <VP>Clear #Admin"
  75.                                 chat(message,title,player,x,y,w,h,n)
  76.                         end
  77.                         if a:sub(0,6) == "/flood" and type(tonumber(a:sub(8,9)))=='number' and a:sub(11)~="" then
  78.                                 for v = 1,tonumber(a:sub(8,9)) do
  79.                                         message = '<V>['..n..'] <N>' .. a:sub(11) .. '\n' .. message
  80.                                 end
  81.                                 chat(message,title,player,x,y,w,h,n)
  82.                         end
  83.                 end                      
  84.                 if a ~= "" and a ~= "/clear" and a:sub(0,6) ~= "/flood" then
  85.                         chat('<V>['..n..'] <N>'..a..'\n'..message,title,nil,x,y,w,h,n)
  86.                 else
  87.                         chat(message,title,player,x,y,w,h,n)
  88.                 end
  89.                 if #message > 1999 then
  90.                         message = ""
  91.                         message = "<ROSE>[Chat] <VP>Clear #2000"
  92.                         chat(message,title,player,x,y,w,h,n)
  93.                 end
  94.                 for n in pairs (tfm.get.room.playerList) do
  95.                         if mice[n].on == false then
  96.                                 mice[n].messagesoff=mice[n].messagesoff+1
  97.                                 add(0,"<VP><p align='center'><a href='event:chat_Open'>Chat <J>"..mice[n].messagesoff,n,745,378,50,20,0x324650,0x212E35,1,true)
  98.                         else
  99.                                 mice[n].messagesoff=0
  100.                         end
  101.                 end
  102.         end
  103. end
  104. eventLoop=function()
  105.     for n in pairs (tfm.get.room.playerList) do
  106.         if mice[n].on==false then
  107.             eventTextAreaCallback(i,n,"chat_Close")
  108.         end
  109.     end
  110. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement