Brenower

[TFM][Brenower] Modo Reports - Nova versão

Mar 9th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.19 KB | None | 0 0
  1. -- Modo reports
  2. -- Créditos:Brenower
  3. -- Tables
  4. data={};
  5. admins={"Brenower","Laagaadoo"}
  6. -- Functions
  7. function giveData(p)
  8.     if not data[p] then
  9.         data[p]={
  10.             ["p"]=1;
  11.             ["nrps"]=0;
  12.             ["ban"]=0;
  13.             ["v"]=nil;
  14.             ["w"]=0;
  15.             reps={""};
  16.         };
  17.     end
  18. end
  19.  
  20. function viewReports(p,pp,pag)
  21.     if data[p] and tonumber(pag) ~= nil then
  22.         if data[p].p >= pag and pag <= data[p].p then
  23.             ui.addTextArea(1,"<p align='center'><VP><TI><b>M  O  D  O  R  E  P  O  R  T  S</b></p><br /><V><a href='event:close'>Fechar painel</a><br /><font size='12'><J>"..p.."<G> - <V>"..data[p].p.."<BL> [<R><a href='event:ban'>ban</a></a><BL>] - [<R><a href='event:watch'>watch</a></a><BL>] - [<R><a href='event:alert'>alert</a></a><BL>]<br /><N2>"..data[p].reps[pag],pp,20,60,700,260,1,1,0.8,true)
  24.             data[pp].v=p;
  25.         end
  26.     end
  27. end
  28.  
  29. function watch(p)
  30.     if data[p].w == 1 and not tfm.get.room.playerList[data[p].v].isDead then
  31.         ui.addTextArea(3,"",p,tfm.get.room.playerList[data[p].v].x-25,-300,50,1000,0xED67EA,0xED67EA,0.7)
  32.     end
  33.     if data[p].w == 1 and tfm.get.room.playerList[data[p].v].isDead then
  34.         ui.removeTextArea(3,p)
  35.     end
  36. end
  37.  
  38. function report(pr,p,mtv,msg)
  39.     if data[pr] and p and mtv and msg then
  40.         data[pr].nrps=data[pr].nrps+1;
  41.         if data[pr].nrps >= 10 then
  42.             data[pr].p=data[pr].p+1;
  43.             data[pr].nrps=0;
  44.             table.insert(data[pr].reps,"")
  45.         end
  46.         data[pr].reps[data[pr].p]=data[pr].reps[data[pr].p].."<font size='11'><br /><N>[<V>"..p.."<N>]<BL> "..mtv.." : <N>"..msg;
  47.     end
  48. end
  49.  
  50. function isAdm(p)
  51.     for i = #admins,1,-1 do
  52.         if admins[i] == p then
  53.             return true
  54.         end
  55.     end
  56. end
  57. -- Novo jogador entrou na sala
  58. function eventNewPlayer(p)
  59.     giveData(p)
  60.     if isAdm(p) == true then
  61.         ui.addTextArea(0,"<V><a href='event:modo'>Modo Reports</a>",p,15,25,nil,20,1,1,0.8,true)
  62.         tfm.exec.bindKeyboard(p,77,false,true)
  63.     end
  64.     system.disableChatCommandDisplay(nil,true)
  65. end
  66. -- Inicio do script
  67. for i in pairs(tfm.get.room.playerList) do
  68.     eventNewPlayer(i)
  69. end
  70. -- Comandos
  71. system.disableChatCommandDisplay(nil,true)
  72. function eventChatCommand(p,cm)
  73.     local args={};
  74.     for arg in cm:gmatch("[^%,]+") do
  75.         table.insert(args,arg)
  76.     end
  77.     if args[1] == [[report]] or args[1] == [[rep]] and args[3] and args[4] then
  78.         if args[2]:upper() == [[HACK]] or args[2]:upper() == [[OTHER]] or args[2]:upper() == [[FLOOD]] then
  79.             report(args[3],p,args[2]:upper(),args[4])
  80.         end
  81.     end
  82.     if args[1] == [[view]] and args[2] and args[3] and isAdm(p) == true then
  83.         viewReports(args[3],p,tonumber(args[2]))
  84.     end
  85.     if cm == [[watch]] then
  86.         data[p].w=0;
  87.         ui.removeTextArea(3,p)
  88.     end
  89.     if args[1] == [[unban]] and data[args[2]] and isAdm(p) == true then
  90.         data[args[2]].ban=0;
  91.     end
  92. end
  93. -- Callbacks
  94. function eventTextAreaCallback(id,player,link)
  95.     if link == [[close]] then
  96.         ui.removeTextArea(id,player)
  97.     end
  98.     if link == [[modo]] then
  99.         ui.addTextArea(1,"<p align='center'><VP><TI><b>M  O  D  O  R  E  P  O  R  T  S</b></p><br /><V><a href='event:close'>Fechar painel</a><br /><br /><font size='12'><N>Bem vindo ao modo reports.:D<br />Para checar os reports de um jogador fala <V>!view,PÁGINA,JOGADOR<N> troque <J>PÁGINA<N> pelo número da página do report e <J>JOGADOR<N> pelo nome do jogador.<br /><br />Novidades nesta nova versão:<br /><J>Watch melhorado.<br />Novo sistema para reportar.<br />Quando aperta-se <VP>M<J> o modo reports é aberto.<br /><br /><N>Comandos:<br /><V>!watch <N>Desativa o watch.<br /><V>!unban,Jogador <N>Desbane um jogador.<br /><V>!report,Motivo,Jogador,Mensagem <N>Reporta um jogador, motivos que podem ser usados:hack, other, flood",player,20,60,700,260,1,1,0.8,true)
  100.     end
  101.     if link == [[ban]] then
  102.         data[data[player].v].ban=1;
  103.     end
  104.     if link == [[watch]] then
  105.         data[player].w=1;
  106.     end
  107.     if link == [[alert]] then
  108.         ui.addPopup(0,2,"Qual mensagem?",player,300,175,200,true)
  109.     end
  110. end
  111. -- Eventos do teclado
  112. function eventKeyboard(p,key,down,x,y)
  113.     eventTextAreaCallback(0,p,"modo")
  114. end
  115. -- Loop
  116. function eventLoop()
  117.     for i in pairs(tfm.get.room.playerList) do
  118.         if data[i].ban == 1 then
  119.             tfm.exec.killPlayer(i)
  120.         end
  121.         watch(i)
  122.     end
  123. end
  124. -- Respostas de uma popup
  125. function eventPopupAnswer(id,p,r)
  126.     ui.addPopup(0,0,"<B><font color='#ED67EA'>[~Moderação]</font></B> "..r,data[p].v,300,175,200)
  127. end
Advertisement
Add Comment
Please, Sign In to add comment