Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- db={}
- owner="Nettoork"
- admins={owner,"Sufp","Detonachu#0000"}
- menuPrincipal={"Jogadores", "Sala", "Configurações", "Ajuda"}
- function pageMenu(name)
- db[name].menuOpened="menu"
- local localMenu="<p align='center'>"
- for i=1,#menuPrincipal do
- localMenu=localMenu.."\n<a href='event:"..menuPrincipal[i].."'>"..menuPrincipal[i].."</a>\n"
- end
- ui.addTextArea(2,localMenu,name,5,52,200,200,0x224D60,0x224D60,0.8,true)
- ui.addTextArea(1,"<p align='center'><font size='17'><D>Mod Menu</D></font></p>",name,5,26,200,25,0x1E4658,0x1E4658,1,true)
- end
- function pagePlayers(name)
- local localPlayers="<p align='center'>"
- local playerCont=0
- local haveAPlayer=false
- db[name].menuOpened="players"
- for i,v in pairs (tfm.get.room.playerList) do
- if db[name].isOnline == true then
- playerCont=playerCont+1
- local cont = 5
- if db[name].page > 1 then
- cont=6
- end
- if playerCont <= db[name].page*cont and playerCont >= (db[name].page-1)*cont then
- haveAPlayer=true
- localPlayers=localPlayers.."\n<a href='event:player_"..i.."'>"..i.."</a>\n"
- end
- end
- end
- if haveAPlayer then
- if db[name].page == 1 then
- ui.addTextArea(2,"\n<p align='center'><a href='event:player_ALL'>Selecionar Todos</a></p>"..localPlayers.."\n<D><a href='event:back'>←</a></D> <a href='event:backMenu'><R>Voltar</R></a> <D><a href='event:next'>→</a></D></p>",name,5,52,200,200,0x224D60,0x224D60,0.8,true)
- else
- ui.addTextArea(2,localPlayers.."\n<D><a href='event:back'>←</a></D> <a href='event:backMenu'><R>Voltar</R></a> <D><a href='event:next'>→</a></D></p>",name,5,52,200,200,0x224D60,0x224D60,0.8,true)
- end
- ui.addTextArea(1,"<p align='center'><font size='17'><D>Mod Menu</D></font></p>",name,5,26,200,25,0x1E4658,0x1E4658,1,true)
- else
- db[name].page=db[name].page-1
- pagePlayers(name)
- end
- end
- function loadPlayer(player, name)
- db[name].menuOpened="SelectedPlayer"
- ui.addTextArea(2,"<p align='center'>\nUsuario: "..(tfm.get.room.playerList[player].playerName).."\nComunidade: "..(tfm.get.room.playerList[player].community).."\nAdministrador: <a href='event:isAdmin_"..player.."'>"..tostring(db[player].isAdmin).."</a>\nCor do Nick: <a href='event:nickColor_"..player.."'>Alterar</a>\n<a href='event:toca_"..player.."'>Toca</a>\nScore: <a href='event:score_"..player.."'>"..tfm.get.room.playerList[player].score.."</a>\nQueijo: <a href='event:hasCheese_"..player.."'>"..tostring(tfm.get.room.playerList[player].hasCheese).."</a>\nVampiro: <a href='event:isVampire_"..player.."'>"..tostring(tfm.get.room.playerList[player].isVampire).."</a>\nMorto: <a href='event:isDead_"..player.."'>"..tostring(tfm.get.room.playerList[player].isDead).."</a>\nShaman: <a href='event:isShaman_"..player.."'>"..tostring(tfm.get.room.playerList[player].isShaman).."</a>\nCoordenada X: <a href='event:x_"..player.."'>"..tfm.get.room.playerList[player].x.."</a>\nCoordenada Y: <a href='event:y_"..player.."'>"..tfm.get.room.playerList[player].y.."</a>\n<a href='event:player_"..player.."'><BV>Atualizar</BV></a> | <a href='event:Jogadores'><R>Voltar</R></a></p>",name,5,52,200,200,0x224D60,0x224D60,0.8,true)
- ui.addTextArea(1,"<p align='center'><font size='17'><D>Mod Menu</D></font></p>",name,5,26,200,25,0x1E4658,0x1E4658,1,true)
- end
- function loadRoom(name)
- db[name].menuOpened="SelectedPlayer"
- ui.addTextArea(2,"<p align='center'>\nSala: "..tfm.get.room.name.."\nComunidade: "..tfm.get.room.community.."\nMáximo de Jogadores: <a href='event:maxPlayers'>"..tfm.get.room.maxPlayers.."</a>\nMapa Code: <a href='event:mapCode'>"..tfm.get.room.currentMap.."</a>\n<a href='event:activeSnow'>Ativar neve</a>\n\n<a href='event:roomLoad_"..name.."'><BV>Atualizar</BV></a> | <a href='event:backMenu'><R>Voltar</R></a></p>",name,5,52,200,200,0x224D60,0x224D60,0.8,true)
- ui.addTextArea(1,"<p align='center'><font size='17'><D>Mod Menu</D></font></p>",name,5,26,200,25,0x1E4658,0x1E4658,1,true)
- end
- function loadALLPlayer(name)
- db[name].menuOpened="SelectedPlayer"
- ui.addTextArea(2,"<p align='center'>\nUsuario: Todos\nCor do Nick: <a href='event:nickColor_ALL'>Alterar</a>\n<a href='event:toca_ALL'>Toca</a>\nScore: <a href='event:score_ALL'>Alterar</a>\n<a href='event:hasCheese_ALL'>Dar queijo</a>\n<a href='event:isVampire_ALL'>Vampiro</a>\n<a href='event:isDead_ALL'>Matar</a>\n<a href='event:isShaman_ALL'>Transformar em Shaman</a>\nCoordenada X: <a href='event:x_ALL'>Alterar</a>\nCoordenada Y: <a href='event:y_ALL'>Alterar</a>\n<a href='event:Jogadores'><R>Voltar</R></a></p>",name,5,52,200,200,0x224D60,0x224D60,0.8,true)
- ui.addTextArea(1,"<p align='center'><font size='17'><D>Mod Menu</D></font></p>",name,5,26,200,25,0x1E4658,0x1E4658,1,true)
- end
- function eventPlayerLeft(name)
- db[name].isOnline=false
- for i,v in pairs(admins) do
- if db[v].menuOpened == "players" then
- pagePlayers(v)
- end
- end
- end
- function eventTextAreaCallback(id, name, ref)
- if db[name].isAdmin then
- if ref == "back" then
- if db[name].page > 1 then
- db[name].page=db[name].page-1
- pagePlayers(name)
- end
- elseif ref == "next" then
- db[name].page=db[name].page+1
- pagePlayers(name)
- end
- if string.find(ref, 'player_', 1, true) then
- ref = ref:gsub("player_","")
- if ref == "ALL" then
- loadALLPlayer(name)
- else
- loadPlayer(ref, name)
- end
- end
- if string.find(ref, 'roomLoad_', 1, true) then
- ref = ref:gsub("roomLoad_","")
- loadRoom(ref)
- end
- if ref == "Jogadores" then
- pagePlayers(name)
- end
- if ref == "Sala" then
- loadRoom(name)
- end
- if ref == "backMenu" then
- pageMenu(name)
- end
- if string.find(ref, 'isDead_', 1, true) then
- ref = ref:gsub("isDead_","")
- if ref ~= "ALL" then
- if tfm.get.room.playerList[ref].isDead then
- tfm.exec.respawnPlayer(ref)
- tfm.get.room.playerList[ref].isDead=false
- else
- tfm.exec.killPlayer(ref)
- tfm.exec.setPlayerScore(ref, -1, true)
- tfm.get.room.playerList[ref].isDead=true
- end
- loadPlayer(ref, name)
- else
- for all in pairs(tfm.get.room.playerList) do
- tfm.exec.killPlayer(all)
- end
- end
- end
- if string.find(ref, 'hasCheese_', 1, true) then
- ref = ref:gsub("hasCheese_","")
- if ref ~= "ALL" then
- if tfm.get.room.playerList[ref].hasCheese then
- tfm.exec.killPlayer(ref)
- tfm.exec.respawnPlayer(ref)
- tfm.exec.movePlayer(ref, tfm.get.room.playerList[ref].x, tfm.get.room.playerList[ref].y, false, 0, 1, false)
- tfm.exec.setPlayerScore(ref, -1, true)
- tfm.get.room.playerList[ref].hasCheese=false
- else
- tfm.exec.giveCheese(ref)
- tfm.get.room.playerList[ref].hasCheese=true
- end
- loadPlayer(ref, name)
- else
- for all in pairs(tfm.get.room.playerList) do
- tfm.exec.giveCheese(all)
- end
- end
- end
- if string.find(ref, 'isVampire_', 1, true) then
- ref = ref:gsub("isVampire_","")
- if ref ~= "ALL" then
- if tfm.get.room.playerList[ref].isVampire then
- tfm.exec.killPlayer(ref)
- tfm.exec.respawnPlayer(ref)
- tfm.exec.movePlayer(ref, tfm.get.room.playerList[ref].x, tfm.get.room.playerList[ref].y, false, 0, 1, false)
- tfm.exec.setPlayerScore(ref, -1, true)
- tfm.get.room.playerList[ref].isVampire=false
- else
- tfm.exec.setVampirePlayer(ref)
- tfm.get.room.playerList[ref].isVampire=true
- end
- loadPlayer(ref, name)
- else
- for all in pairs(tfm.get.room.playerList) do
- tfm.exec.setVampirePlayer(all)
- end
- end
- end
- if string.find(ref, 'isAdmin_', 1, true) then
- ref = ref:gsub("isAdmin_","")
- if db[ref].isAdmin and ref ~= owner then
- for i,v in pairs(admins) do
- print(v.." "..ref)
- if v == ref then
- for i=1,5 do
- ui.removeTextArea(i, ref)
- db[ref]={isAdmin=false, isOnline=true}
- end
- table.remove(admins, i)
- break;
- end
- end
- else
- table.insert(admins, ref)
- db[ref]={
- isAdmin=true,
- isOnline=true,
- page=1,
- pageP=1,
- popupID=0,
- playerSelected="",
- menuOpened="menu"
- }
- db[ref].isAdmin=true
- pageMenu(ref)
- end
- if db[name].isAdmin then
- loadPlayer(ref, name)
- end
- end
- if string.find(ref, 'score_', 1, true) then
- ref = ref:gsub("score_","")
- db[name].playerSelected=ref
- db[name].popupID=1
- ui.addPopup(1, 2, "Digite o valor para Score:", name, 220, 30, nil, true)
- end
- if string.find(ref, 'nickColor_', 1, true) then
- ref = ref:gsub("nickColor_","")
- db[name].playerSelected=ref
- ui.showColorPicker(1, name,"0xFFFFFF","Cor do Nick:")
- end
- if string.find(ref, 'x_', 1, true) then
- ref = ref:gsub("x_","")
- db[name].playerSelected=ref
- db[name].popupID=2
- ui.addPopup(2, 2, "Digite o valor para X:", name, 220, 30, nil, true)
- end
- if string.find(ref, 'toca_', 1, true) then
- ref = ref:gsub("toca_","")
- if ref ~= "ALL" then
- if tfm.get.room.playerList[ref].hasCheese then
- tfm.exec.playerVictory(ref)
- end
- loadPlayer(ref, name)
- else
- for all in pairs(tfm.get.room.playerList) do
- if tfm.get.room.playerList[all].hasCheese then
- tfm.exec.playerVictory(all)
- end
- end
- end
- end
- if string.find(ref, 'y_', 1, true) then
- ref = ref:gsub("y_","")
- db[name].playerSelected=ref
- db[name].popupID=3
- ui.addPopup(3, 2, "Digite o valor para Y:", name, 220, 30, nil, true)
- end
- if ref == "maxPlayers" then
- db[name].popupID=4
- ui.addPopup(4, 2, "Altere o Máximo de Jogadores:", name, 220, 30, nil, true)
- end
- if ref == "mapCode" then
- db[name].popupID=5
- ui.addPopup(5, 2, "Altere o Mapa:", name, 220, 30, nil, true)
- end
- if ref == "activeSnow" then
- db[name].popupID=6
- ui.addPopup(6, 2, "Tempo:", name, 220, 30, nil, true)
- end
- if string.find(ref, 'isShaman_', 1, true) then
- ref = ref:gsub("isShaman_","")
- if ref == "ALL" then
- for all in pairs(tfm.get.room.playerList) do
- tfm.exec.setShaman(all)
- end
- else
- if tfm.get.room.playerList[ref].isShaman == false then
- tfm.exec.setShaman(ref)
- tfm.get.room.playerList[ref].isShaman=true
- loadPlayer(ref, name)
- end
- end
- end
- end
- end
- function eventColorPicked(id, name, color)
- if id == 1 then
- if db[name].playerSelected=="ALL" then
- for all in pairs(tfm.get.room.playerList) do
- tfm.exec.setNameColor(all, "0x"..string.format("%x", color))
- end
- else
- tfm.exec.setNameColor(db[name].playerSelected, "0x"..string.format("%x", color))
- end
- db[name].playerSelected=""
- end
- end
- function comandosBasicos(id, name, resp, player)
- if id == 1 and tonumber(resp) then
- if db[name].playerSelected == "ALL" then
- tfm.exec.setPlayerScore(player, resp, false)
- else
- tfm.exec.setPlayerScore(db[name].playerSelected, resp, false)
- tfm.get.room.playerList[db[name].playerSelected].score=resp
- loadPlayer(db[name].playerSelected, name)
- end
- end
- if id == 2 and tonumber(resp) then
- if db[name].playerSelected == "ALL" then
- tfm.exec.movePlayer(player, resp, 0, false, 0, 1, false)
- else
- tfm.exec.movePlayer(db[name].playerSelected, resp, 0, false, 0, 1, false)
- loadPlayer(db[name].playerSelected, name)
- end
- end
- if id == 3 and tonumber(resp) then
- if db[name].playerSelected == "ALL" then
- tfm.exec.movePlayer(player, 0, resp, false, 0, 1, false)
- else
- tfm.exec.movePlayer(db[name].playerSelected, 0, resp, false, 0, 1, false)
- loadPlayer(db[name].playerSelected, name)
- end
- end
- if id == 4 and tonumber(resp) then
- tfm.exec.setRoomMaxPlayers(resp)
- loadRoom(name)
- end
- if id == 5 then
- tfm.exec.newGame(resp)
- loadRoom(name)
- end
- if id == 6 and tonumber(resp) then
- tfm.exec.snow(resp)
- end
- db[name].playerSelected=""
- db[name].popupID=0
- end
- function eventPopupAnswer(id, name, resp)
- if db[name].popupID == id and db[name].isAdmin then
- if db[name].playerSelected == "ALL" then
- for all in pairs(tfm.get.room.playerList) do
- if db[all].isOnline then
- db[name].playerSelected="ALL"
- comandosBasicos(id, name, resp, all)
- end
- end
- else
- comandosBasicos(id, name, resp)
- end
- end
- end
- function eventNewPlayer(name)
- if db[name] == nil then
- db[name]={isAdmin=false, isOnline=true}
- for i,v in pairs(admins) do
- if db[v] and db[v].menuOpened == "players" then
- pagePlayers(v)
- end
- if v == name then
- db[v]={
- isAdmin=true,
- isOnline=true,
- page=1,
- pageP=1,
- popupID=0,
- playerSelected="",
- menuOpened="menu"
- }
- pageMenu(v)
- end
- end
- end
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement