Bolodefchoco_LUAXML

[Script] Map Listener

Mar 6th, 2016
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.74 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 06/03/2016
  3. --Last update: 12/04/2017
  4. --[[ Notes:
  5.     Does:
  6.         Lista todos os seus mapas
  7.     Commands:
  8.         !count --> Conta quantos mapas você tem em cada categoria, mapas totais e mapas high perm
  9.         !list --> Lista a categoria com todos os mapas respectivos
  10.         !bbcode --> Cria um bbcode com spoiler com o !list, porém aperfeiçoado
  11.             high --> O bbcode será feito apenas para os mapas high perm (3-9)
  12. ]]--
  13.  
  14. maps = [[
  15.  
  16. Insert your lsmap here
  17.  
  18. ]]
  19.  
  20. admin = maps:match("(.*)'s maps:")
  21.  
  22. P = {}
  23.  
  24. for code,cat in maps:gmatch("@(%d+) .-%% %- P(%d+)\n") do
  25.     cat = tonumber(cat)
  26.     if not P[cat] then
  27.         P[cat] = {}
  28.     end
  29.  
  30.     P[cat][#P[cat] + 1] = code
  31. end
  32. for k,v in next,P do
  33.     table.sort(v)
  34. end
  35.  
  36. eventChatCommand = function(n,c)
  37.     if n == admin then
  38.         if c == "count" then
  39.             local text = "<BV>Total : <V>%s\n"
  40.             local total = 0
  41.             local high = 0
  42.             for k = 1,41 do
  43.                 if P[k] then
  44.                     local v = P[k]
  45.                     text = text .. "<BV>P" .. k .. " : <V>" .. #v .. "\n"
  46.                     total = total + #v
  47.                     if k > 2 and k < 10 then
  48.                         high = high + #v
  49.                     end
  50.                 end
  51.             end
  52.             text = text:format(total) .. (high>0 and "<BV>High perm : <V>"..high or "")
  53.             print(text)
  54.             ui.addTextArea(0,text,n)
  55.         end
  56.         if c:sub(1,4) == "list" then
  57.             for k = 1,41 do
  58.                 if P[k] and k ~= 22 then
  59.                     local v = P[k]
  60.                     print("<BV>P"..k.." : <V>@" .. table.concat(v,(c:sub(5)~="" and c:sub(5) or ", ") .. "@"))
  61.                 end
  62.             end
  63.         end
  64.         if c:sub(1,6) == "bbcode" then
  65.             local cat = {
  66.                 [1] = {"qUHhRxy","Permanent","BABD2F"},
  67.                 [3] = {"XmYA7E8","Bootcamp","30BA76"},
  68.                 [4] = {"3EbPie0","Shaman","98E2EB"},
  69.                 [5] = {"TlH3Mdp","Art","CB546B"},
  70.                 [6] = {"l587DC9","Mechanism","8FA8BB"},
  71.                 [7] = {"5xzLi58","No Shaman","C2C2DA"},
  72.                 [8] = {"xIPNzGC","Dual [color=#FEB1FC]Shaman[/color]","98E2EB"},
  73.                 [9] = {"cnz08X2","Miscellaneous","EDCC8D"},
  74.                 [10] = {"UytFMU1","Survivor","606090"},
  75.                 [11] = {"VDsuQTx","Vampire","EB1D51"},
  76.                 [13] = {"3ZMej","Bootcamp","92CF91"},
  77.                 [17] = {"ouplMc9","Rac[color=#CB546B]ing[/color]","C2C2DA"},
  78.                 [18] = {"8bEFPBE","Defilante","6C77C1"},
  79.                 [19] = {"exheHJR","Music","7A8E9E"},
  80.                 [24] = {"UytFMU1","Dual [color=#FEB1FC]Shaman[/color] [color=#606090]Survivor[/color]","98E2EB"},
  81.                 [41] = {"3ZMej","Module","009D9D"},
  82.             }
  83.             local spoil = "[spoiler=[color=#%s]&lt;%s> %s[/color] [img]http://i.imgur.com/%s.png[/img]][size=13]@%s[/size][/spoiler]"
  84.             for k = 1,41 do
  85.                 if P[k] then
  86.                     local v = P[k]
  87.                     if c:sub(8) == "" or (c:sub(8) == "high" and k > 2 and k < 10) then
  88.                         if cat[k] then
  89.                             local category = cat[k]
  90.                             print(spoil:format(category[3],#v,category[2],category[1],table.concat(v,"\n@")))
  91.                         end
  92.                     end
  93.                 end
  94.             end
  95.         end
  96.     end
  97. end
Advertisement
Add Comment
Please, Sign In to add comment