Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- #Murder
- Created by Brenower
- To-do list:
- Murder:
- - A cada 8 jogadores é +1 murer
- - Faca com cooldown de x segundos
- - Flashbang com cooldown de x segundos
- - Deixar o rato assassinado como um cadaver
- Inocente:
- - A cada 2 murders selecionar um inocente como arma
- - Implantar os objetos brilhantes e verde no mapa
- - Quando colocar 5 objetos recebe ...
- Mapa:
- - "Modo Noite": a cada 30 segundos os jogadores podem ter uma área de visão melhor
- - Quando algum time ganhar aparecer uma textarea tipo a do murder (gmod)
- Pontuações:
- - Ganhar o round +10 pontos
- - Matar um inocente +1 pontos
- - Matar um murder +5 pontos
- - Ser o melhor jogador quando acabarem os rounds +30 pontos
- Perfil:
- Geral:
- - Rounds jogados
- - Vitórias / Derrotas
- - Pontos
- Murder:
- - Rounds como murder
- - Vitórias / Derrotas
- - Inocentes assassinados
- - Perk atual
- Inocente:
- - Rounds jogados
- - Vitórias / Derrotas
- - Murders assassinados
- - Perk atual
- Loja de habilidades:
- - A cada 150 pontos libera uma perk de inocente
- - A cada 300 pontos libera uma perk de murder
- Inocente:
- - Perk 1: Você começa com uma área de visão maior (nivel 2)
- - Perk 2: Você pode colocar um clone falso no mapa, se um murder tentar matar-ló deixara seu rastro por 10 segundos
- - Perk 3: Você já começa com um objeto coletado
- - Perk 4: O tempo que você é afetado por flashbangs é diminuido em 50%
- Murder:
- - Perk 1: Verifica se tem jogadores a uma área quadrada de ypx
- - Perk 2: Os jogadores deixam pegadas de onde passam
- - Perk 3: Suas flashbangs duram +1 segundo
- - Perk 4: Você pode coletar objetos e quando chega em 5 pode trocar o seu corpo pelo de um cadaver
- Lojas de death note:
- - A cada 50 pontos uma death note é liberada
- - Death note é mostrada ao jogador quando ele morre
- ]]
- -- class
- local dataHandler = {}
- dataHandler.__index = dataHandler
- function dataHandler.construct(moduleID, dataModel)
- local self = setmetatable({}, dataHandler)
- self.model = dataModel
- self.moduleID = moduleID
- self.moduleData = {}
- self.recordedPlayers = {}
- self.higherIndex = 0
- for key, valueTable in pairs(self.model) do
- if valueTable.index > self.higherIndex then
- self.higherIndex = valueTable.index
- end
- end
- return self
- end
- function dataHandler:insert(player, key, value)
- local data = self.recordedPlayers[player]
- if data then
- data = data[key]
- if data and type(data) == "table" then
- table.insert(data, value)
- end
- end
- end
- function dataHandler:remove(player, key, value)
- local data = self.recordedPlayers[player]
- if data then
- data = data[key]
- if data and type(data) == "table" then
- for i,v in pairs(data) do
- if value == v then
- table.remove(data, i)
- break;
- end
- end
- end
- end
- end
- function dataHandler:recordPlayer(player, streamData)
- local moduleData = string.split(streamData, "?")
- local j
- for i = 1, #moduleData do
- if moduleData[i]:find(self.moduleID) then
- j = i
- break
- end
- end
- local streamData = j and string.split(moduleData[j]:gsub(self.moduleID..'=', ''), ",") or {}
- if j then table.remove(moduleData, j) end
- self.moduleData[player] = table.concat(moduleData, '?')
- self.recordedPlayers[player] = {}
- for key, valueTable in pairs(self.model) do
- if valueTable.index and valueTable.type then
- local value = streamData[valueTable.index] or valueTable.default or "null"
- streamData[valueTable.index] = "{"..tostring(key).."}"
- if valueTable.type == "boolean" then
- self.recordedPlayers[player][key] = value == 1
- elseif valueTable.type == "number" then
- self.recordedPlayers[player][key] = tonumber(value) or 0
- elseif valueTable.type == "string" then
- self.recordedPlayers[player][key] = value or ""
- elseif valueTable.type == "table" then
- self.recordedPlayers[player][key] = string.split(value, "#") or table.copy(valueTable.default) or string.split(valueTable.default, "#")
- elseif valueTable.type == "ctable" then
- if type(value) == 'string' then
- local values = string.split(value, "#")
- self.recordedPlayers[player][key] = {}
- for _, v in pairs(values) do
- local data = string.split(v, "&")
- if data[1] and data[2] then
- self.recordedPlayers[player][key][data[1]] = data[2] or "null"
- end
- end
- elseif type(value) == 'table' then
- self.recordedPlayers[player][key] = table.copy(valueTable.default)
- end
- else
- return false
- end
- else
- return false
- end
- end
- self.recordedPlayers[player].stringData = self:normalizeData(streamData)
- return true
- end
- function dataHandler:query(player, key)
- local data = self.recordedPlayers[player]
- data = data and data[key] or false
- return data, type(data)
- end
- function dataHandler:queryAll(key)
- local queryData = {}
- for player in pairs(self.recordedPlayers) do
- table.insert(queryData, {player, key or false, type(key)})
- end
- return queryData
- end
- function dataHandler:set(player, key, value)
- local data = self.recordedPlayers[player]
- if data then
- data = data[key]
- if data then
- if type(data) == type(value) then
- self.recordedPlayers[player][key] = value
- return true, self.recordedPlayers[player][key]
- else
- return false
- end
- else
- return false
- end
- else
- return false
- end
- return false
- end
- function dataHandler:setAll(key, value)
- for player, streamData in pairs(self.recordedPlayers) do
- local success = self:set(player, key, value)
- if not success then
- return false, player
- end
- end
- return true
- end
- function dataHandler:normalizeData(data)
- for i = 1, self.higherIndex do
- data[i] = data[i] or "0"
- end
- return table.concat(data, ",")
- end
- function dataHandler:retrievePlayer(player)
- local data = self.recordedPlayers[player].stringData
- data = string.gsub(data, "\{(.-)\}", function(key)
- local value = self.recordedPlayers[player][key]
- local valueType = self.model[key].type or ""
- if valueType == "boolean" then
- value = tostring(value and 1 or 0)
- elseif valueType == "table" then
- value = table.concat(value, "#") or "#"
- elseif valueType == "ctable" then
- local stringValue = {}
- if type(value) == "table" then
- for k, v in pairs(value) do
- if k and v then
- table.insert(stringValue, tostring(k).."&"..tostring(v))
- end
- end
- stringValue = table.concat(stringValue, "#")
- value = stringValue
- else
- value = "#"
- end
- else
- value = tostring(value)
- end
- return value
- end)
- return self.moduleID..'='..data..(self.moduleData[player] ~= '' and '?'..self.moduleData[player] or '')
- end
- function string.split(s, pattern, n)
- local st = {}
- for sb in string.gmatch(s, "[^"..pattern.."]+") do
- if not n or n > -1 then
- table.insert(st,sb)
- else
- st[#st] = st[#st]..pattern..sb
- end
- n = n and n-1 or false
- end
- return st
- end
- function table.copy(t)
- if type(t) == 'table' then
- local nt = {}
- for k, v in pairs(t) do
- nt[k] = v
- end
- return nt
- else
- return false
- end
- end
- local timerList = {}
- function addTimer(callback, ms, loops, label, ...)
- local id = #timerList+1
- timerList[id] = {
- callback = callback,
- label = label,
- arguments = {...},
- time = ms,
- currentTime = 0,
- currentLoop = 0,
- loops = loops or 1,
- isComplete = false
- }
- return id
- end
- function removeTimer(id)
- if timerList[id] then
- timerList[id] = 0
- return true
- end
- return false
- end
- function clearTimers() timerList = {} end
- -- arrays
- local translations = {
- ["EN"] = {
- ["help-1"]= "<p align=\"center\"><b><font size=\"18\" face=\"Arial\"><VP>#murder</VP></font></b></p>Welcome to <j><b>#murder</b>!</j> Created by <j><b>Brenower</b></j>.<br><br><BV><b>• Innocent:</b></BV><br>As innocent your objective is get way from <r><b>murder</b></r> and find <vp><b>green</b></vp>,</vp> when you got <j><b>5 objects</b></j> you get <j><b>a gun</b></j>, but be carefful the <r><b>murder</b></r> will try to stop you from collecting.<br><br><bv><b>• Innocent with a gun:</b></bv><br>For every <j><b>3</b></j><r> <b>murders</b></r> a <bv><b>innocent</b></bv> is select to have a gun and kill the <b><r>murders</b> by <ch><b>clicking on the player.</b></ch><br><br><r><b>• Murder:</b></r><br>The <r><b>murder</b></r> have a <r><b>knife</b>,</r> it takes <j><b>1 second</b></j> to use it (in that tim the knife is visible to everyone) and you can kill a player pressing <ch><b>space</b></ch> next to your target.",
- ["teamWin"] = "<p align='center'><font size=\"18\"><VP><b>The team of %s win the round!</b></VP></font><br><br><font size=\"12\"><b><J>Best scores:</J></b></font><br>",
- ["profile"] = "<p align=\"center\"><J><font size=\"18\"><b>%s</b></font></J></p><br><font face=\"Verdana\"><ch><b>• General stats:</b></ch><br>Rounds played: <vp><b>%i</b></vp><br>Wins: <vp><b>%i</b></vp><br>Points:<vp><b>%i</b></vp><br><br><bv><b>• As innocent:</b></bv><br>Murders slaughtered: <vp><b>%i</b></vp><br><br><r><b>• As murder:</b></r><br>Innocents slaughtered: <vp><b>%i</b></vp><br><br><ch><b>• Medals:</b></ch><br><v><b>[???]</b></v>",
- ["welcome"] = "<VP><b>Send your maps:</b></VP>\n<v>http://atelier801.com/topic?f=745381&t=892082</v>\n<ROSE>Welcome to <r><b>#murder</b></r>! If you need help say <j><b>!help</b>",
- ["prepKnife"] = "You can now use your <r><b>knife</b></r>! Press <ch><b>space</b></ch> next of a player.",
- ["colKnife"] = "Your <r><b>knife</b></r> is on countdown of <j><b>%i second(s).</b></j>",
- ["mrK"] = "You killed <v><b>%s</b> (+1)</v>, you need to wait <j><b>11 seconds.</b></j> to use your knife again.",
- ["prepGun"] = "You can now use your <j><b>gun</b></j>!<ch><b>Click on your target</b></ch> to kill him.",
- ["colGun"] = "Your <j><b>gun</b></j> is on countdown of <j><b>%i seconds(s).</b></j>",
- ["obj"] = "You collected <vp><b>one object</b></vp><v> (+1)</v>, total: <v><b>%i / 5</b></v>",
- ["obj-5"] = "Now you have a <j><b>gun!</b></j> Press <ch><b>space</b></ch> to wield it.",
- ["flb"] = "Your <n2><b>flashbang</b></n2> is on countdown of <j><b>%i second(s).</b></j>",
- --["useGun"] = "Your knife <j><b>arma</b></j> entrou em cooldown de <j><b>1 segundo</b></j>",
- ["suicide"] = "The <ch><b>%s</b></ch> commited suicide for killing the <bv><b>innocent</b></bv> <ch><b>%s</b></ch>!",
- ["inK"] = "The <r><b>murder</b></r> <ch><b>%s</b></ch> was killed by <ch><b>%s</b></ch><v> (+5)</v>!",
- ["inK-2"] = "It was your last bullet! Go and collect other weapon",
- ["map"] = "<J>%s</J> <BL>| <N>Murders alive: </N><R>%i <BL>| <N>Innocents alive:</BV> <V>%i",
- ["team1Win"] = "The <bv><b>innocents</b></bv> won the round!",
- ["team2Win"] = "The <r><b>murders</b></r> won the round!",
- ["draw"] = "The round ended in a draw!",
- ["newGameI"] = "You're a <bv><b>innocent</b></bv>, collect <vp><b>green</b></vp> objects by map pressing <ch><b>space</b></ch>, try to get away from murder.",
- ["newGameIG"] = "You're a <bv><b>innocent with a gun</b></bv>, press <ch><b>space</b></ch> to wield it and after <ch><b>click on your target</b></ch> to kill him.",
- ["newGameM"] = "You're a <r><b>murder</b></r>, press <ch><b>space</b></ch> to wield your <r><b>knife</b></r> and press kill other players.",
- ["newGameM-2"] = "Say with other murders using <j>!tc <bl>[text]</bl></j>\nYou have acess to the <n2><b>flashbang</b></n2> press <ch><b>H</b></ch> to use it.",
- ["team-1"] = "<bv>innocents</bv>",
- ["team-2"] = "<r>murders</r>"
- },
- ["BR"] = {
- ["help-1"] = "<p align=\"center\"><b><font size=\"18\" face=\"Arial\"><VP>Murder</VP></font></b></p>Bem vindo ao <j><b>#murder</b>!</j> Criado por <j><b>Brenower</b></j>.<br><br><BV><b>• Inocente:</b></BV><br>Como inocente seu objetivo é escapar do <r><b>assassino</b></r> e procurar por objetos com brilho <vp><b>verde</b>,</vp> quando você obtém <j><b>5 objetos</b></j> você ganha <j><b>uma arma</b></j> para tornar o jogo mais fácil, mas cuidado <r><b>assassino</b></r> vai tentar interromper a coleta desses objetos.<br><br><bv><b>• Inocente com arma:</b></bv><br>A cada <j><b>3</b></j><r> <b>assassinos</b></r> um jogador inocente é selecionado para ter uma arma especial e pode usar-lá para matar outros <b><r>assassinos</r></b> <ch><b>clicando no jogador.</b></ch><br><br><r><b>• Assassino:</b></r><br>O assassino tem uma <r><b>faca</b>,</r> ele demora <j><b>1 segundo</b></j> para empunhar-lá (nesse tempo a faca fica visível aos jogadores) e então pode usar-lá em um jogador apertando <ch><b>espaço</b></ch> proxima ao jogador alvo. Ele também tem pode usar uma granada de flashbang que pode cegar a sua visão por <j><b>1 segundo</b></j> e cada vez que ele mata alguém a granada é jogada automaticamente cegando sua visão por mais tempo!",
- ["teamWin"] = "<p align='center'><font size=\"18\"><VP><b>O time dos %s ganhou a partida!</b></VP></font><br><br><font size=\"12\"><b><J>Melhores pontuações:</J></b></font><br>",
- ["profile"] = "<p align=\"center\"><J><font size=\"18\"><b>%s</b></font></J></p><br><font face=\"Verdana\"><ch><b>• Estatísticas Gerais:</b></ch><br>Rounds jogados: <vp><b>%i</b></vp><br>Vitórias: <vp><b>%i</b></vp><br>Pontos:<vp><b>%i</b></vp><br><br><bv><b>• Como inocente:</b></bv><br>Assassinos abatidos: <vp><b>%i</b></vp><br><br><r><b>• Como assassino:</b></r><br>Inocentes abatidos: <vp><b>%i</b></vp><br><br><ch><b>• Medalhas:</b></ch><br><v><b>[Em Breve]</b></v>",
- ["welcome"] = "<VP><b>Envie seus mapas:</b></VP>\n<v>http://atelier801.com/topic?f=745381&t=892082</v>\n<ROSE>Bem vindo ao <r><b>#murder</b></r>! Se precisar de ajuda use <j><b>!help</b>",
- ["prepKnife"] = "Você empunhou a sua <r><b>faca</b></r>! Aperte <ch><b>espaço</b></ch> de um jogador para mata-ló.",
- ["colKnife"] = "A sua <r><b>faca</b></r> está em countdown de <j><b>%i segundos.</b></j>",
- ["mrK"] = "Você matou <v><b>%s</b> (+1)</v>, sua faca entrou em countdown de <j><b>11 segundos.</b></j>",
- ["prepGun"] = "Sua <j><b>arma</b></j> foi empunhada!<ch><b>Clique em um jogador</b></ch> para atirar em alguém.",
- ["colGun"] = "Sua <j><b>arma</b></j> está em countdown de <j><b>%i segundos.</b></j>",
- ["obj"] = "Você coletou <vp><b>um objeto</b></vp><v> (+1)</v>, você tem no total: <v><b>%i / 5</b></v>",
- ["obj-5"] = "Agora você tem uma <j><b>arma!</b></j> Aperte <ch><b>espaço</b></ch> para empunhar ela.",
- ["flb"] = "A sua <n2><b>flashbang</b></n2> está em countdown de <j><b>%i segundos.</b></j>",
- --["useGun"] = "A sua <j><b>arma</b></j> entrou em cooldown de <j><b>1 segundo</b></j>",
- ["suicide"] = "O(A) <ch><b>%s</b></ch> suicidou-se por ter matado o(a) <bv><b>inocente</b></bv> <ch><b>%s</b></ch>!",
- ["inK"] = "O(A) <r><b>assassino</b></r> <ch><b>%s</b></ch> foi morto por <ch><b>%s</b></ch><v> (+5)</v>!",
- ["inK-2"] = "Era a última bala restante! Vá coletar outra arma.",
- ["map"] = "<J>%s</J> <BL>| <N>Assassinos vivos: </N><R>%i <BL>| <N>Inocentes vivos:</BV> <V>%i",
- ["team1Win"] = "Os <bv><b>inocentes</b></bv> ganharam a partida!",
- ["team2Win"] = "Os <r><b>assassinos</b></r> ganharam a partida!",
- ["draw"] = "O round acabou em empate!",
- ["newGameI"] = "Você é um <bv><b>inocente</b></bv>, colete objetos <vp><b>verdes</b></vp> e brilhantes espalhados pelo mapa apertando <ch><b>espaço</b></ch>, tente escapar do assassino.",
- ["newGameIG"] = "Você é um <bv><b>inocente com arma</b></bv>, aperte <ch><b>espaço</b></ch> para empunhar a sua <j><b>arma</b></j> e em seguida <ch><b>clique em um jogador</b></ch> para atirar.",
- ["newGameM"] = "Você é um <r><b>assassino</b></r>, aperte <ch><b>espaço</b></ch> para empunhar a sua <r><b>faca</b></r> e use-a para matar outros jogadores.",
- ["newGameM-2"] = "Fale com outros assassinos usando <j>!tc <bl>[text]</bl></j>\nVocê tem acesso a <n2><b>flashbang</b></n2> aperte <ch><b>H</b></ch> para usar-lá.",
- ["team-1"] = "<bv>inocentes</bv>",
- ["team-2"] = "<r>murders</r>"
- }
- }
- local skelet = {
- points = {index = 1, type = "number", default = 0},
- victories = {index = 2, type = "number", default = 0},
- rounds = {index = 3, type = "number", default = 0},
- asK = {index = 4, type = "number", default = 0},
- inK = {index = 5, type = "number", default = 0}
- }
- local handler = dataHandler.construct("murder", skelet)
- local playerData = {};
- local room = {
- ["timers"] = {
- ["resetOnNewGame"] = {};
- },
- ["txtNames"] = 0;
- ["imgNi"] = 0;
- ["objs"] = {};
- ["newGameTimer"] = false;
- ["currentObjs"] = {};
- ["murders"] = {};
- }
- local maps = {"@6983192", "@6930472", "@6793860", "@6949300", "@6983699", "@6984074", "@6842313", "@6984402", "@6849540", "@6984339", "@6843395", "@6984781", '@6984643', '@6984930', '@6985881', '@6984979', '@6986325', '@6986486', '@6987451', '@6988840'}
- local imgs = {
- ["objs"] = {"15937381d5c.png", "159373a6025.png", "159373b56e1.png"};
- ["flashID"] = 1000;
- }
- local skeletFile = {
- ranking = {
- index = 1,
- type = "string",
- default = ""
- }
- }
- local fileHandler = dataHandler.construct("mur", skeletFile)
- fileHandler:recordPlayer("Jarvis", "")
- local fileLoaded = false;
- local globalRanking = {};
- -- functions
- function translate(p, text)
- local trans = tfm.get.room.playerList[p] and translations[tfm.get.room.playerList[p].community:upper()] or translations[tfm.get.room.community] or translations["EN"];
- return trans[text] or "nil";
- end
- function message(p, text, ...)
- local text = text or "close";
- if p then
- if tfm.get.room.playerList[p] then
- tfm.exec.chatMessage(string.format(translate(p, text), ...) or "nil", p)
- end
- else
- for pname in pairs(tfm.get.room.playerList) do
- message(pname, text, ...)
- end
- end
- end
- function ui.addWindow(id, text, player, x, y, width, height, alpha, corners, closeButton, buttonText)
- id = tostring(id)
- ui.addTextArea(id, "000000000", player, x, y, width, height, 0x573926, 0x573926, alpha, true)
- ui.addTextArea(id.."0", "", player, x+1, y+1, width-2, height-2, 0x8a583c, 0x8a583c, alpha, true)
- ui.addTextArea(id.."00", "", player, x+3, y+3, width-6, height-6, 0x2b1f19, 0x2b1f19, alpha, true)
- ui.addTextArea(id.."000", "", player, x+4, y+4, width-8, height-8, 0xc191c, 0xc191c, alpha, true)
- ui.addTextArea(id.."0000", "", player, x+5, y+5, width-10, height-10, 0x2d5a61, 0x2d5a61, alpha, true)
- ui.addTextArea(id.."00000", text, player, x+5, y+6, width-10, height-12, 0x142b2e, 0x142b2e, alpha, true)
- local imageId = {}
- if corners then
- table.insert(imageId, tfm.exec.addImage("155cbe97a3f.png", "&1", x-7, (y+height)-22, player))
- table.insert(imageId, tfm.exec.addImage("155cbe99c72.png", "&1", x-7, y-7, player))
- table.insert(imageId, tfm.exec.addImage("155cbe9bc9b.png", "&1", (x+width)-20, (y+height)-22, player))
- table.insert(imageId, tfm.exec.addImage("155cbea943a.png", "&1", (x+width)-20, y-7, player))
- end
- if closeButton then
- ui.addTextArea(id.."000000", "", player, x+14, y+height-24, width-27, 13, 0x7a8d93, 0x7a8d93, alpha, true)
- ui.addTextArea(id.."0000000", "", player, x+15, y+height-23, width-27, 13, 0xe1619, 0xe1619, alpha, true)
- ui.addTextArea(id.."00000000", "", player, x+15, y+height-23, width-28, 12, 0x314e57, 0x314e57, alpha, true)
- ui.addTextArea(id.."", buttonText, player, x+15, y+height-26, width-28, nil, 0x314e57, 0x314e57, 0, true)
- end
- return imageId
- end
- function deepcopy(orig)
- local orig_type = type(orig)
- local copy
- if orig_type == 'table' then
- copy = {}
- for orig_key, orig_value in next, orig, nil do
- copy[deepcopy(orig_key)] = deepcopy(orig_value)
- end
- setmetatable(copy, deepcopy(getmetatable(orig)))
- else -- number, string, boolean, etc
- copy = orig
- end
- return copy
- end
- function shuffle(a)
- if type(a) ~= "table" or #a < 2 then
- return a;
- end
- local a = a;
- local rnd,trem,getn,ins = math.random,table.remove,table.getn,table.insert;
- local r = {};
- while #a > 0 do
- local k = rnd(#a)
- r[#r+1] = a[k]
- trem(a, k)
- end
- return r;
- end
- function help(p)
- local ids = ui.addWindow(50, translate(p, "help-1"), p, 75, 50, 650, 300, 1, true, true, "<p align='center'><a href='event:closeWindow'>Close<br></a></p>")
- --tfm.exec.chatMessage("<VP>Com:</VP> <v>!p <bl>[jogador] |</bl> !help</v>", p)
- for i = 1,#ids do
- table.insert(playerData[p].imagesIDS, ids[i])
- end
- end
- function win(team)
- local textTeam = team == 0 and translate(nil, "team-1") or translate(nil, "team-2");
- local scoreTxt = {};
- local pls = {};
- for i,v in pairs(tfm.get.room.playerList) do
- if #pls < 10 then
- table.insert(pls, {["name"] = i, ["team"] = playerData[i].team == 0 and "<bv>Innocent</bv>" or "<r>Murder</r>"; ["points"] = playerData[i].points})
- end
- handler:set(i, "points", handler:query(i, "points") + playerData[i].points)
- if playerData[i].team == team and tfm.get.room.uniquePlayers > 6 then
- handler:set(i, "victories", handler:query(i, "victories") + 1)
- end
- end
- table.sort(pls, function(a, b) return a.points > b.points end)
- for i,v in pairs(pls) do
- table.insert(scoreTxt, "<b><BL>"..v.name.." - "..v.team.." - </BL><V>"..v.points)
- end
- local ids = ui.addWindow(51, string.format(translate(nil, "teamWin"), textTeam)..table.concat(scoreTxt, "<br>"), nil, 200, 75, 400, 250, 1, true, true, "<p align='center'><a href='event:closeWindow'>Close<br></a></p>")
- for i = 1,#ids do
- for p in pairs(tfm.get.room.playerList) do
- table.insert(playerData[p].imagesIDS, ids[i])
- end
- end
- end
- function profile(p, p2)
- local p2 = p2 or p;
- if playerData[p2] then
- local points, rounds, victories, inK, asK = handler:query(p2, "points"), handler:query(p2, "rounds"), handler:query(p2, "victories"), handler:query(p2, "inK"), handler:query(p2, "asK");
- local ids = ui.addWindow(53, string.format(translate(p, "profile"), p2, rounds, victories, points, inK, asK), p, 275, 75, 250, 250, 1, true, true, "<p align='center'><a href='event:closeWindow'>Close<br></a></p>")
- for i = 1,#ids do
- for p in pairs(tfm.get.room.playerList) do
- table.insert(playerData[p].imagesIDS, ids[i])
- end
- end
- end
- end
- function shopTop10(p)
- if globalRanking then
- local textNames = {};
- local textRounds = {};
- local textScore = {};
- local textWins = {};
- for i = 1, #globalRanking do
- local player = globalRanking[i]
- textNames[#textNames+1] = player.name
- textScore[#textScore+1] = player.score
- textRounds[#textRounds+1] = player.rounds;
- textWins[#textWins+1] = player.wins
- end
- local ids = ui.addWindow(60, [[<p align='center'><font size="16"><J><b>Ranking</b></J></font></p> <b># Player Rounds Points Wins</b>]], p, 205, 85, 390+65, 230, 1, true, true, "<p align='center'><a href='event:closeRanking'>Close<br></a></p>")
- local ids2 = ui.addWindow(61, [[<p align='center'><CH><b>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10</b></CH></p>]], p, 215, 135, 20+20, 135, 1, true, false)
- local ids3 = ui.addWindow(62, [[<p align='center'><N><b>]]..table.concat(textNames, '<br>')..[[</b></N></p>]], p, 260+10, 135, 100+20, 135, 1, true, false)
- local ids4 = ui.addWindow(63, [[<p align='center'><V><b>]]..table.concat(textRounds, '<br>')..[[</b></V></p>]], p, 385+25, 135, 50+20, 135, 1, true, false)
- local ids5 = ui.addWindow(64, [[<p align='center'><V><b>]]..table.concat(textScore, '<br>')..[[</b></V></p>]], p, 460+35, 135, 50+20, 135, 1, true, false)
- local ids6 = ui.addWindow(65, [[<p align='center'><V><b>]]..table.concat(textWins, '<br>')..[[</b></V></p>]], p, 535+45, 135, 50+20, 135, 1, true, false)
- for i = 1,#ids do
- for p in pairs(tfm.get.room.playerList) do
- table.insert(playerData[p].imagesIDS, ids[i])
- table.insert(playerData[p].imagesIDS, ids2[i])
- table.insert(playerData[p].imagesIDS, ids3[i])
- table.insert(playerData[p].imagesIDS, ids4[i])
- table.insert(playerData[p].imagesIDS, ids5[i])
- table.insert(playerData[p].imagesIDS, ids6[i])
- end
- end
- end
- end
- --[[function checkAlive()
- local mur = 0;
- local ino = 0;
- for i,v in pairs(tfm.get.room.playerList) do
- if not v.isDead then
- if playerData[i].team == 2 then
- mur = mur + 1;
- else
- ino = ino + 1;
- end
- end
- end
- print(mur.." - "..ino)
- if mur == 0 then
- --tfm.exec.chatMessage("Todos os assassinos estão mortos! Os inocentes ganharam!")
- --system.newTimer(function() tfm.exec.newGame(maps[math.random(#maps)]) end, 2500)
- elseif ino == 0 then
- tfm.exec.chatMessage("Todos os inocentes estão mortos! Os assassinos ganharam!")
- system.newTimer(function() tfm.exec.newGame(maps[math.random(#maps)]) end, 2500)
- elseif mur == 0 and ino == 0 then
- tfm.exec.chatMessage("O round acabou em empate!")
- system.newTimer(function() tfm.exec.newGame(maps[math.random(#maps)]) end, 2500)
- end
- end]]--
- -- tfm events
- function eventNewPlayer(p)
- print(name)
- playerData[p] = {
- ["imgNi"] = 10000;
- ["imagesIDS"] = {};
- ["team"] = 0;
- ["gunCol"] = false;
- ["haveGun"] = false;
- ["prepGun"] = false;
- ["imageGun"] = 10000;
- ["objs"] = 0;
- ["alive"] = false;
- ["flashBang"] = false;
- ["points"] = 0;
- ["loaded"] = false;
- ["calCol"] = os.time();
- }
- help(p)
- handler:recordPlayer(p, "")
- tfm.exec.lowerSyncDelay(p)
- for i,v in pairs{32, 72} do
- system.bindKeyboard(p, v, false)
- end
- system.loadPlayerData(p)
- system.bindMouse(p)
- ui.addWindow(70, "<p align='center'><font size='12px'><b><a href='event:menu'>» Menu</a></b></font></p>", p, 8, 28, 70, 22+7, 1, false, false)
- message(p, "welcome")
- --tfm.exec.chatMessage("<VP><b>Envie seus mapas:</b></VP>\n<v>http://atelier801.com/topic?f=745381&t=892082</v>\n<ROSE>Bem vindo ao <r><b>#murder</b></r>! Se precisar de ajuda use <j><b>!help</b>", p)
- end
- function eventKeyboard(p, k, d, x, y)
- if k == 32 and playerData[p].team == 2 and playerData[p].alive then
- if not playerData[p].prepGun then
- if playerData[p].gunCol < os.time() then
- playerData[p].gunCol = os.time()+500;
- playerData[p].prepGun = true;
- --tfm.exec.chatMessage("Você empunhou a sua <r><b>faca</b></r>! Aperte <ch><b>espaço</b></ch> de um jogador para mata-ló.", p)
- message(p, "prepKnife")
- playerData[p].imageGun = tfm.exec.addImage("159364b2ac8.png", "$"..p, -20, 0)
- else
- local gunCol = math.floor((playerData[p].gunCol - os.time())/1000)
- --tfm.exec.chatMessage("A sua <r><b>faca</b></r> está em countdown de <j><b>"..gunCol.." segundos.</b></j>", p)
- message(p, "colKnife", gunCol)
- end
- elseif playerData[p].prepGun and playerData[p].gunCol < os.time()-500 then
- playerData[p].gunCol = os.time();
- for i,v in pairs(tfm.get.room.playerList) do
- if x > v.x-20 and x < v.x+20 and y > v.y-20 and y < v.y+20 and i ~= p and not v.isDead and playerData[i].team < 2 then
- --tfm.exec.chatMessage("Você matou <v><b>"..i.."</b> (+1)</v>, sua faca entrou em countdown de <j><b>9 segundos.</b></j>", p)
- message(p, "mrK", i)
- if tfm.get.room.uniquePlayers > 6 then
- handler:set(p, "inK", handler:query(p, "inK") + 1)
- end
- --tfm.exec.chatMessage("O <bv><b>inocente</b></bv> <ch><b>"..i.."</b></ch> foi morto(a) por um <r><b>assassino(a)!</b></r>")
- room.txtNames = room.txtNames + 1;
- ui.addTextArea(room.txtNames, "<font size=\"10\"><BV>"..i.."</BV></font>", nil, v.x-25, v.y-25, nil, 19, 0x080808, 0x000000, 0.1, false)
- tfm.exec.addImage("15938ae765f.png", "!1", v.x-15, v.y-15)
- playerData[p].points = playerData[p].points + 2;
- tfm.exec.killPlayer(i)
- playerData[p].prepGun = false;
- tfm.exec.removeImage(playerData[p].imageGun)
- playerData[p].gunCol = os.time()+11*1000;
- return;
- end
- end
- end
- elseif k == 32 and playerData[p].haveGun and not playerData[p].prepGun and playerData[p].alive then
- if playerData[p].gunCol < os.time() then
- --tfm.exec.chatMessage("Sua <j><b>arma</b></j> foi empunhada!<ch><b>Clique em um jogador</b></ch> para atirar em alguém.", p)
- message(p, "prepGun")
- playerData[p].prepGun = true;
- playerData[p].imageGun = tfm.exec.addImage("15936b18f2a.png", "$"..p, 0, -10)
- else
- local gunCol = math.floor((playerData[p].gunCol - os.time()) / 1000)
- message(p, "colGun", gunCol)
- --tfm.exec.chatMessage("Sua <j><b>arma</b></j> está em countdown de <j><b>"..gunCol.." segundos.</b></j>", p)
- end
- elseif k == 32 and playerData[p].alive and not playerData[p].haveGun and playerData[p].team == 0 then
- if playerData[p].gunCol < os.time()-750 then
- playerData[p].gunCol = os.time();
- local objs = room.currentObjs;
- for i,v in pairs(objs) do
- if x > v[2]-30 and x < v[2]+30 and y > v[3]-30 and y < v[3]+30 and room.currentObjs[i] then
- tfm.exec.removeImage(v[1])
- playerData[p].objs = playerData[p].objs + 1;
- --tfm.exec.chatMessage("Você coletou <vp><b>um objeto</b></vp><v> (+1)</v>, você tem no total: <v><b>"..playerData[p].objs.." / 5</b></v>", p)
- message(p, "obj", playerData[p].objs)
- playerData[p].points = playerData[p].points + 1;
- if playerData[p].objs >= 5 then
- --tfm.exec.chatMessage("Agora você tem uma <j><b>arma!</b></j> Aperte <ch><b>espaço</b></ch> para empunhar ela.", p)
- message(p, "obj-5")
- playerData[p].objs = 0;
- playerData[p].prepGun = false;
- playerData[p].haveGun = true;
- playerData[p].gunCol = os.time()+1*1000;
- end
- table.remove(room.currentObjs, i)
- break;
- end
- end
- end
- end
- if k == 72 and playerData[p].alive and playerData[p].flashBang and playerData[p].flashBang < os.time() then
- addTimer(function(i)
- if i == 1 then
- tfm.exec.removeImage(room.flashID)
- room.flashID = tfm.exec.addImage("15937b95aa1.png", "&1", 0, 0)
- elseif i == 2 then
- tfm.exec.removeImage(room.flashID)
- room.flashID = tfm.exec.addImage("15937b97d74.png", "&1", 0, 0)
- elseif i == 3 then
- tfm.exec.removeImage(room.flashID)
- room.flashID = tfm.exec.addImage("15937b9a1f9.png", "&1", 0, 0)
- elseif i == 5 then
- tfm.exec.removeImage(room.flashID)
- end
- end, 500, 5)
- playerData[p].flashBang = os.time()+40*1000;
- elseif k == 72 and playerData[p].alive and playerData[p].flashBang then
- local flashCol = math.floor((playerData[p].flashBang - os.time())/1000)
- --tfm.exec.chatMessage("A sua <n2><b>flashbang</b></n2> está em countdown de <j><b>"..flashCol.." segundos.</b></j>", p)
- message(p, "flb", flashCol)
- end
- end
- function eventMouse(p, x, y)
- if playerData[p].haveGun and playerData[p].prepGun and playerData[p].gunCol < os.time()-1000 and playerData[p].alive then
- playerData[p].gunCol = os.time();
- --tfm.exec.chatMessage("A sua <j><b>arma</b></j> entrou em cooldown de <j><b>1 segundo</b></j>", p)
- for i,v in pairs(tfm.get.room.playerList) do
- if x > v.x-25 and x < v.x+25 and y > v.y-25 and y < v.y+25 and i ~= p and not v.isDead then
- tfm.exec.removeImage(playerData[p].imageGun)
- if playerData[i].team == 0 then
- --tfm.exec.chatMessage("O(A) <ch><b>"..p.."</b></ch> suicidou-se por ter matado o(a) <bv><b>inocente</b></bv> <ch><b>"..i.."</b></ch>!")
- message(nil, "suicide", p, i)
- tfm.exec.killPlayer(p)
- tfm.exec.killPlayer(i)
- break;
- else
- --tfm.exec.chatMessage("O(A) <r><b>assassino</b></r> <ch><b>"..i.."</b></ch> foi morto por <ch><b>"..p.."</b></ch><v> (+5)</v>!")
- message(nil, "inK", i, p)
- if tfm.get.room.uniquePlayers > 6 then
- handler:set(p, "asK", handler:query(p, "asK") + 1)
- end
- --tfm.exec.chatMessage("Era a última bala restante! Vá coletar outra arma.", p)
- message(p, "inK-2")
- playerData[p].points = playerData[p].points + 5;
- playerData[p].haveGun = false;
- tfm.exec.killPlayer(i)
- break;
- end
- end
- end
- end
- end
- function eventPlayerDataLoaded(p, dt)
- handler:recordPlayer(p, dt)
- playerData[p].loaded = true;
- end
- function eventPlayerDied(p)
- playerData[p].alive = false;
- local ino = 0;
- local mur = 0;
- for i,v in pairs(tfm.get.room.playerList) do
- if not v.isDead then
- if playerData[i].team == 0 then
- ino = ino + 1;
- elseif playerData[i].team == 2 then
- mur = mur + 1;
- end
- end
- end
- ui.setMapName(string.format(translate(p, "map"), tfm.get.room.xmlMapInfo.author, mur, ino))
- if not room.newGameTimer then
- if mur == 0 then
- win(0)
- --tfm.exec.chatMessage("Os <bv><b>inocentes</b></bv> ganharam a partida!")
- message(nil, "team1Win")
- system.newTimer(function() tfm.exec.newGame(maps[math.random(#maps)]) end, 2500)
- room.newGameTimer = true;
- elseif ino == 0 then
- win(2)
- --tfm.exec.chatMessage("Os <r><b>assassinos</b></r> ganharam a partida!")
- message(nil, "team2Win")
- system.newTimer(function() tfm.exec.newGame(maps[math.random(#maps)]) end, 2500)
- room.newGameTimer = true;
- elseif mur == 0 and ino == 0 then
- win(0)
- --tfm.exec.chatMessage("O round acabou em empate!")
- message(nil, "draw")
- system.newTimer(function() tfm.exec.newGame(maps[math.random(#maps)]) end, 2500)
- room.newGameTimer = true;
- end
- end
- end
- local id = 0;
- function eventNewGame()
- local np = 0;
- room.newGameTimer = false;
- tfm.exec.setGameTime(3*60+3)
- local pls = {};
- room.murders = {};
- room.objs = {};
- --test
- room.currentObjs = {};
- for i = 1,#room.timers.resetOnNewGame do
- system.removeTimer(room.timers.resetOnNewGame[i])
- end
- room.timers.resetOnNewGame = {};
- for i = 1,room.txtNames do
- ui.removeTextArea(i)
- end
- room.txtNames = 0;
- for i,v in pairs(tfm.get.room.playerList) do
- playerData[i].imgNi = tfm.exec.addImage("159341ae791.png", "$"..i, -1000, -1000, i)
- table.insert(pls, i)
- playerData[i].team = 0;
- playerData[i].haveGun = false;
- playerData[i].gunCol = os.time()+15*1000;
- playerData[i].prepGun = false;
- playerData[i].objs = 0;
- room.imgNi = 0;
- playerData[i].alive = true;
- playerData[i].flashBang = false;
- playerData[i].points = 0;
- np = np + 1;
- tfm.exec.setPlayerScore(i, handler:query(i, "points"), false)
- if tfm.get.room.uniquePlayers > 6 then
- handler:set(i, "rounds", handler:query(i, "rounds") + 1)
- end
- if playerData[i].loaded then
- end
- if v.registrationDate == 0 then
- tfm.exec.killPlayer(i)
- end
- end
- pls = shuffle(pls)
- local nm = np > 4 and math.floor(np/5) or 1;
- local gm = nm > 2 and math.floor(nm/3) or 0;
- ui.setMapName(string.format(translate(nil, "map"), tfm.get.room.xmlMapInfo.author, nm, np-nm))
- for i = 1,#pls do
- if nm ~= 0 then
- playerData[pls[i]].team = 2;
- nm = nm - 1;
- playerData[pls[i]].flashBang = os.time()+26*1000;
- elseif gm > 0 then
- playerData[pls[i]].team = 0;
- playerData[pls[i]].haveGun = true;
- gm = gm - 1;
- else
- break;
- end
- end
- --playerData["Brenower"].team = 0;
- --playerData.Brenower.haveGun = false;
- for i,v in pairs(pls) do
- if playerData[v].team == 0 and not playerData[v].haveGun then
- --tfm.exec.chatMessage("Você é um <bv><b>inocente</b></bv>, colete objetos <vp><b>verdes</b></vp> e brilhantes espalhados pelo mapa apertando <ch><b>espaço</b></ch>, tente escapar do assassino.", v)
- message(v, "newGameI")
- elseif playerData[v].haveGun then
- --tfm.exec.chatMessage("Você é um <bv><b>inocente com arma</b></bv>, aperte <ch><b>espaço</b></ch> para empunhar a sua <j><b>arma</b></j> e em seguida <ch><b>clique em um jogador</b></ch> para atirar.", v)
- message(v, "newGameIG")
- elseif playerData[v].team == 2 then
- --tfm.exec.chatMessage("Você é um <r><b>assassino</b></r>, aperte <ch><b>espaço</b></ch> para empunhar a sua <r><b>faca</b></r> e use-a para matar outros jogadores.", v)
- --tfm.exec.chatMessage("Você tem acesso a <n2><b>flashbang</b></n2> aperte <ch><b>H</b></ch> para usar-lá.", v)
- table.insert(room.murders, v)
- message(v, "newGameM")
- message(v, "newGameM-2")
- end
- end
- table.insert(room.timers.resetOnNewGame ,system.newTimer(function()
- room.imgNi = room.imgNi + 1;
- if room.imgNi > 5 then
- return;
- end
- for i,v in pairs(tfm.get.room.playerList) do
- if not v.isDead then
- tfm.exec.removeImage(playerData[i].imgNi)
- if room.imgNi == 1 then
- playerData[i].imgNi = tfm.exec.addImage("159341a53d4.png", "$"..i, -1000, -1000, i)
- else
- playerData[i].imgNi = tfm.exec.addImage("159341ac243.png", "$"..i, -1000, -1000, i)
- end
- end
- end
- end, 40*1000, true))
- for xml in tfm.get.room.xmlMapInfo.xml:gmatch("<O[^/]+/>") do
- if tonumber(xml:match('C="(%d+)"')) == 14 then
- room.objs[#room.objs+1] = {tonumber(xml:match('X="(%d+)"')), tonumber(xml:match('Y="(%d+)"'))} -- x, y
- end
- end
- table.insert(room.timers.resetOnNewGame, system.newTimer(function()
- local tob = np > 9 and math.floor(np/10) or 1;
- for i = 1,tob do
- local rnd = room.objs[math.random(#room.objs)]
- if #room.currentObjs > 2 then
- return;
- end
- --id = id + 1;
- room.currentObjs[#room.currentObjs+1] = {tfm.exec.addImage(imgs.objs[math.random(#imgs.objs)], "!1", rnd[1], rnd[2]-30), rnd[1], rnd[2]}
- --tfm.exec.addPhysicObject(id, rnd[1]+15, rnd[2], {["type"]=1;["width"]=48;["height"]=48})
- end
- end, 3000, true))
- --table.insert(room.timers.resetOnNewGame, system.newTimer(function() checkAlive() end), 5*1000, true)
- end
- function eventTextAreaCallback(id, p, event)
- if playerData[p].calCol < os.time()-750 then
- playerData[p].calCol = os.time();
- if event == "closeWindow" then
- local ids = {id, id.."0", id.."00", id.."000", id.."0000", id.."00000", id.."000000", id.."0000000", id.."00000000", id.."000000000"}
- for i = 1,#ids do
- ui.removeTextArea(ids[i], p)
- end
- if playerData[p] and #playerData[p].imagesIDS > 0 then
- for i in pairs(playerData[p].imagesIDS) do
- tfm.exec.removeImage(playerData[p].imagesIDS[i])
- end
- playerData[p].imagesIDS = {};
- end
- elseif event == "closeRanking" then
- for i = 60,65 do
- local id = i;
- local ids = {id, id.."0", id.."00", id.."000", id.."0000", id.."00000", id.."000000", id.."0000000", id.."00000000", id.."000000000"}
- for i = 1,#ids do
- ui.removeTextArea(ids[i], p)
- end
- end
- if playerData[p] and #playerData[p].imagesIDS > 0 then
- for i in pairs(playerData[p].imagesIDS) do
- tfm.exec.removeImage(playerData[p].imagesIDS[i])
- end
- playerData[p].imagesIDS = {};
- end
- elseif event == "menu" then
- ui.addWindow(71, "<p align='center'><font size='12px'><b><a href='event:closeMenu'>» Close</a></b></font></p>", p, 8, 28, 70, 22+7, 1, false, false)
- ui.addWindow(72, "<CH><p align='center'><font size='11px'><b><a href='event:help'>» Help</a></b></font></p>", p, 8, 59+8, 70, 22+7, 1, false, false)
- ui.addWindow(73, "<CH><p align='center'><font size='10px'><b><a href='event:profile'>» Profile</a></b></font></p>", p, 8, 90+15, 70, 22+7, 1, false, false)
- ui.addWindow(74, "<CH><p align='center'><font size='10px'><b><a href='event:ranking'>» Rank</a></b></font></p>", p, 8, 121+23, 70, 22+7, 1, false, false)
- ui.addWindow(75, "<CH><p align='center'><font size='10px'><b><a href='event:skins'>» ???</a></b></font></p>", p, 8, 152+30, 70, 22+7, 1, false, false)
- elseif event == "closeMenu" then
- for i = 71,75 do
- local id = i;
- local ids = {id, id.."0", id.."00", id.."000", id.."0000", id.."00000", id.."000000", id.."0000000", id.."00000000", id.."000000000"}
- for i = 1,#ids do
- ui.removeTextArea(ids[i], p)
- end
- end
- elseif event == "help" then
- help(p)
- elseif event == "profile" then
- profile(p, p)
- elseif event == "ranking" then
- shopTop10(p)
- end
- end
- end
- function eventLoop(ct, rt)
- if rt <= 0 and not room.newGameTimer then
- --tfm.exec.chatMessage("O round acababou em empate!")
- message(nil, "draw")
- system.newTimer(function() tfm.exec.newGame(maps[math.random(#maps)]) end, 2500)
- room.newGameTimer = true;
- win(0)
- end
- local timersToRemove = {}
- for id = 1, #timerList do
- local timer = timerList[id]
- if type(timer) == 'table' then
- if not timer.isComplete then
- timer.currentTime = timer.currentTime + 500
- if timer.currentTime >= timer.time then
- timer.currentTime = 0
- timer.currentLoop = timer.currentLoop + 1
- if timer.loops > 0 then
- if timer.currentLoop >= timer.loops then
- timer.isComplete = true
- end
- end
- if type(timer.callback) == 'function' then
- timer.callback(timer.currentLoop, table.unpack(timer.arguments))
- end
- end
- end
- if timer.isComplete then
- if type(eventTimerComplete) == 'function' then
- eventTimerComplete(id, timer.label)
- end
- timersToRemove[#timersToRemove+1] = id
- end
- end
- end
- for i = 1, #timersToRemove do
- removeTimer(timersToRemove[i])
- end
- end
- function eventFileLoaded(id, data)
- local id = tonumber(id:match('%d+'))
- fileHandler:recordPlayer("Jarvis", data)
- if id == 5 then
- local dRanking = fileHandler:query("Jarvis", "ranking")
- local localTop10 = {}
- for name, rounds, score, victories in string.gmatch(dRanking, '([0-9a-zA-Z_]+)!([0-9]+)!([0-9]+)!([0-9]+);?') do
- --tfm.exec.chatMessage('carregou '..name)
- localTop10[#localTop10+1] = {
- name = name,
- rounds = rounds,
- score = score,
- wins = victories
- }
- end
- local rankingString = {}
- for i = #localTop10, 1, -1 do
- if tfm.get.room.playerList[localTop10[i].name] then
- table.remove(localTop10, i)
- end
- end
- for name in pairs(tfm.get.room.playerList) do
- localTop10[#localTop10+1] = {name=name, wins=handler:query(name, 'victories'), score=handler:query(name, 'points'), rounds=handler:query(name, 'rounds')}
- end
- table.sort(localTop10, function(a, b) return tonumber(a.score) > tonumber(b.score) end)
- if #localTop10 > 10 then
- local len = #localTop10
- for i = len, 11, -1 do
- table.remove(localTop10, i)
- end
- end
- for _, player in pairs(localTop10) do
- rankingString[#rankingString+1] = string.format('%s!%i!%i!%i', player.name or "", player.rounds or 0, player.score or 0, player.wins or 0)
- end
- rankingString = table.concat(rankingString, ';');
- fileHandler:set("Jarvis", "ranking", rankingString)
- globalRanking = {}
- globalRanking = deepcopy(localTop10)
- --tfm.exec.chatMessage("<rose>carregou")
- end
- end
- function eventChatCommand(p, cmd)
- local params = {};
- for param in cmd:gmatch('[^%s]+') do
- params[#params+1] = param;
- end
- if params[1] == "help" then
- help(p)
- return;
- elseif params[1] == "p" then
- params[2] = params[2] or p;
- local target = params[2]:lower():gsub('%a', string.upper, 1);
- profile(p, params[2])
- return
- elseif params[1] == "see" then
- tfm.exec.chatMessage(handler:retrievePlayer(p), p)
- return
- elseif params[1] == "ranking" or params[1] == "rank" then
- shopTop10(p)
- return
- elseif params[1] == "tc" and playerData[p] and (p == "Brenower" or playerData[p].team == 2) then
- for i,v in pairs(room.murders) do
- tfm.exec.chatMessage("<R>• <b>[#Murder] ["..p.."]</b></R> <N>"..table.concat(params, " ", 2), v)
- end
- return;
- end
- if p == "Brenower" then
- if params[1] == "msg" then
- tfm.exec.chatMessage("<font color='#fe9d4d'>• <b>[Jarvis]</b></font> <N>"..table.concat(params, " ", 2))
- return;
- elseif params[1] == "np" then
- pcall(tfm.exec.newGame, params[2])
- elseif params[1] == "addmap" then
- table.insert(maps, params[2])
- elseif params[1] == "acc" then
- tfm.exec.chatMessage("[color=#30BA76]@"..tfm.get.room.xmlMapInfo.mapCode.."[/color][color=#6C77C1] - [/color][color=#BABD2F]"..tfm.get.room.xmlMapInfo.author.."[/color][color=#6C77C1] - Aceito[/color]", p)
- elseif params[1] == "rec" then
- params[2] = params[2] or "";
- tfm.exec.chatMessage("[color=#CB546B]@"..tfm.get.room.xmlMapInfo.mapCode.."[/color][color=#6C77C1] - [/color][color=#BABD2F]"..tfm.get.room.xmlMapInfo.author.."[/color][color=#6C77C1] - "..table.concat(params, " ", 2).."[/color]", p)
- end
- end
- end
- for i,v in pairs{"help", "msg", "np", "addmap", "p", "see", "rank", "ranking", "tc"} do
- system.disableChatCommandDisplay(v)
- end
- for i in pairs(tfm.get.room.playerList) do
- eventNewPlayer(i)
- end
- tfm.exec.disableAutoNewGame()
- tfm.exec.disableAutoScore()
- tfm.exec.disableAutoShaman()
- tfm.exec.disableAutoTimeLeft()
- tfm.exec.disableWatchCommand()
- tfm.exec.disableDebugCommand()
- tfm.exec.setAutoMapFlipMode(false)
- tfm.exec.setRoomMaxPlayers(28)
- tfm.exec.newGame('@6983192')
- system.loadFile(5) -- carrega a primeira vez que o module carrega ai dps só no timer abaixo
- system.newTimer(function()
- system.loadFile(5)
- end, 1000 * 65 + 1, true)
- --ui.addTextArea(0, "<p align=\"center\"><b><font size=\"18\" face=\"Arial\"><VP>Murder</VP></font></b></p><br>Bem vindo ao <j><b>#murder</b>!</j> A cada rodada você recebe um nome diferente e uma cor para identifica-ló, não revele a sua verdadeira identidade ou poderá ter consequências graves!<br><br><BV><b>• Inocente:</b></BV><br>Como inocente seu objetivo é escapar do <r><b>assassino</b></r> e procurar por objetos com brilho <v><b>verde</b>,</v> quando você obtém <j><b>5 objetos</b></j> você ganha <j><b>em breve</b></j> para tornar o jogo mais fácil, mas cuidado <r><b>assassino</b></r> vai tentar interromper a coleta desses objetos.<br><br><bv><b>• Inocente com arma:</b></bv><br>Quando tiver mais de <j><b>3 </b></j><r><b>assassinos</b></r> um jogador inocente é selecionado para ter uma arma especial, para empunhar a arma tem um delay de <j><b>2 segundos</b></j> e pode ficar-lá na mão por no máximo <j><b>10 segundos</b></j> antes de entrar em tempo de recarga.<br><br><r><b>• Assassino:</b></r><br>O assassino tem uma <r><b>faca</b>,</r> ele demora <j><b>1 segundo</b></j> para empunhar-lá (nesse tempo a faca fica visível aos jogadores) e então pode usar-lá em um jogador apertando <ch><b>espaço</b></ch> proxima ao jogador alvo. Ele também tem pode usar uma granada de flashbang que pode cegar a sua visão por <j><b>1 segundo</b></j> e cada vez que ele mata alguém a granada é jogada automaticamente cegando sua visão por mais tempo!", nil, 75, 50, 650, 300, 0x0a1f1d, 0x000000, 1, true)
Advertisement
Add Comment
Please, Sign In to add comment