Bolodefchoco_LUAXML

[Script] Manipulador de TextAreas

Mar 6th, 2016
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 06/03/2016
  3. --Last update: 26/05/2016
  4. --[[ Notes:
  5.     Does:
  6.         Lista todos os seus mapas (Em número)
  7.     Commands:
  8.         !
  9.             x --> Valor da posição horizontal
  10.             y --> Valor da posição vertical
  11.             w --> Valor da largura
  12.             h --> Valor da altura
  13.                 Int --> Muda o valor para int
  14.     Keys:
  15.         Teclas direcionais / WASD --> Movem a textarea
  16.         Espaço --> Aumenta a largura da textarea
  17.         M --> Diminui a largura da textarea
  18.         J --> Diminui a altura da textarea
  19.         H --> Aumenta a altura da textarea
  20.     Mouse:
  21.         Clicar fará com que você possa adicionar um texto na textarea
  22. ]]--
  23.  
  24.  
  25. adm = "Bolodefchoco"
  26.  
  27. x,y,w,h,text = 50,50,50,50,""
  28.  
  29. ui.addTextArea(0,"",adm,x,y,w,h)
  30. eventKeyboard = table.foreach({0,1,2,3,string.byte(" MHJ",1,4)},function(_,k)
  31.     system.bindKeyboard(adm,k,true,true)
  32. end) or function(n,k)
  33.     x,y,w,h = (k==0 and x-1 or k==2 and x+1 or x),(k==1 and y-1 or k==3 and y+1 or y),(k==32 and w+1 or k==("M"):byte() and w-1 or w),(k==("H"):byte() and h+1 or k==("J"):byte() and h-1 or h)
  34.     ui.addTextArea(0,text,adm,x,y,w,h)
  35.     print('\t'..table.concat({x,y,w,h},', '))
  36. end
  37. eventChatCommand=function(n,c)
  38.     if n == adm and #c>2 then
  39.         for _,v in next,{'x','y','w','h'} do
  40.             if c:sub(1,1):lower() == v then
  41.                 k = v;break
  42.             end
  43.         end
  44.         if k then _G[k] = tonumber(c:sub(3)) end
  45.         ui.addTextArea(0,text,adm,x,y,w,h)
  46.         print('\t'..table.concat({x,y,w,h},', '))
  47.     end
  48. end
  49.  
  50. eventMouse=system.bindMouse(adm,true) or function(n,x,y)
  51.     ui.addPopup(0,2,"Text:",adm,x,y,100,true)
  52. end
  53.  
  54. eventPopupAnswer=function(i,n,a)
  55.     text = a
  56. end
Advertisement
Add Comment
Please, Sign In to add comment