Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Modo reports
- -- Créditos:Brenower
- -- Tables
- data={};
- admins={"Brenower","Laagaadoo"}
- -- Functions
- function giveData(p)
- if not data[p] then
- data[p]={
- ["p"]=1;
- ["nrps"]=0;
- ["ban"]=0;
- ["v"]=nil;
- ["w"]=0;
- reps={""};
- };
- end
- end
- function viewReports(p,pp,pag)
- if data[p] and tonumber(pag) ~= nil then
- if data[p].p >= pag and pag <= data[p].p then
- 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)
- data[pp].v=p;
- end
- end
- end
- function watch(p)
- if data[p].w == 1 and not tfm.get.room.playerList[data[p].v].isDead then
- ui.addTextArea(3,"",p,tfm.get.room.playerList[data[p].v].x-25,-300,50,1000,0xED67EA,0xED67EA,0.7)
- end
- if data[p].w == 1 and tfm.get.room.playerList[data[p].v].isDead then
- ui.removeTextArea(3,p)
- end
- end
- function report(pr,p,mtv,msg)
- if data[pr] and p and mtv and msg then
- data[pr].nrps=data[pr].nrps+1;
- if data[pr].nrps >= 10 then
- data[pr].p=data[pr].p+1;
- data[pr].nrps=0;
- table.insert(data[pr].reps,"")
- end
- data[pr].reps[data[pr].p]=data[pr].reps[data[pr].p].."<font size='11'><br /><N>[<V>"..p.."<N>]<BL> "..mtv.." : <N>"..msg;
- end
- end
- function isAdm(p)
- for i = #admins,1,-1 do
- if admins[i] == p then
- return true
- end
- end
- end
- -- Novo jogador entrou na sala
- function eventNewPlayer(p)
- giveData(p)
- if isAdm(p) == true then
- ui.addTextArea(0,"<V><a href='event:modo'>Modo Reports</a>",p,15,25,nil,20,1,1,0.8,true)
- tfm.exec.bindKeyboard(p,77,false,true)
- end
- system.disableChatCommandDisplay(nil,true)
- end
- -- Inicio do script
- for i in pairs(tfm.get.room.playerList) do
- eventNewPlayer(i)
- end
- -- Comandos
- system.disableChatCommandDisplay(nil,true)
- function eventChatCommand(p,cm)
- local args={};
- for arg in cm:gmatch("[^%,]+") do
- table.insert(args,arg)
- end
- if args[1] == [[report]] or args[1] == [[rep]] and args[3] and args[4] then
- if args[2]:upper() == [[HACK]] or args[2]:upper() == [[OTHER]] or args[2]:upper() == [[FLOOD]] then
- report(args[3],p,args[2]:upper(),args[4])
- end
- end
- if args[1] == [[view]] and args[2] and args[3] and isAdm(p) == true then
- viewReports(args[3],p,tonumber(args[2]))
- end
- if cm == [[watch]] then
- data[p].w=0;
- ui.removeTextArea(3,p)
- end
- if args[1] == [[unban]] and data[args[2]] and isAdm(p) == true then
- data[args[2]].ban=0;
- end
- end
- -- Callbacks
- function eventTextAreaCallback(id,player,link)
- if link == [[close]] then
- ui.removeTextArea(id,player)
- end
- if link == [[modo]] then
- 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)
- end
- if link == [[ban]] then
- data[data[player].v].ban=1;
- end
- if link == [[watch]] then
- data[player].w=1;
- end
- if link == [[alert]] then
- ui.addPopup(0,2,"Qual mensagem?",player,300,175,200,true)
- end
- end
- -- Eventos do teclado
- function eventKeyboard(p,key,down,x,y)
- eventTextAreaCallback(0,p,"modo")
- end
- -- Loop
- function eventLoop()
- for i in pairs(tfm.get.room.playerList) do
- if data[i].ban == 1 then
- tfm.exec.killPlayer(i)
- end
- watch(i)
- end
- end
- -- Respostas de uma popup
- function eventPopupAnswer(id,p,r)
- ui.addPopup(0,0,"<B><font color='#ED67EA'>[~Moderação]</font></B> "..r,data[p].v,300,175,200)
- end
Advertisement
Add Comment
Please, Sign In to add comment