Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local data = {}
- local titles = {"Noob","Pro","Divino","Cool"}
- local numerodewins = {1,2,3}
- function eventNewPlayer(name)
- if not data[name] then
- data[name]={}
- data[name].puntos = 0
- data[name].muertes = 0
- data[name].title = 1
- data[name].titles = {1}
- end
- end
- for i, command in ipairs ({"perfil","p","stats","profile"}) do
- system.disableChatCommandDisplay(command,true)
- end
- for name, player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- function eventPlayerDied(name)
- data[name].muertes = data[name].muertes+1
- print(name.." ha muerto, ahora tiene "..data[name].muertes.." muertes")
- end
- function eventPlayerWon(name)
- data[name].puntos = data[name].puntos+1
- desbloquearT(name)
- print(name.." ha conseguido un queso, ahora tiene "..data[name].puntos.." puntos")
- end
- function eventTextAreaCallback(id,name,cb)
- if cb=='cperfil' then
- removePerfil(name)
- end
- end
- function eventChatCommand(name,command)
- local args={}
- for word in command:gmatch("[^%s]+") do
- table.insert(args, word)
- end
- if args[1] == "stats" or args[1] == "perfil" or args[1] == "p" or args[1]=="profile" and data[capitalize(args[2])] then
- getPerfil(capitalize(args[2]), name)
- elseif args[1] == "title" then
- changeTitle(args[2], name)
- end
- end
- function getPerfil(n,to)
- ui.addTextArea(2,"<font size='13'><br><bl>• Puntos: <g>"..data[n].puntos.."<br><bl>• Muertes: <g>"..data[n].muertes.."",to,300,120,260,nil,0x324650,0x324650,nil,true)
- ui.addTextArea(3,"<font size='17'><v>Perfil: <n>"..n.."",to,300,100,260,nil,0x1C3C41,0x1C3C41,nil,true)
- ui.addTextArea(4,"",to,543,104,13,13,0x009D9D,0x009D9D,nil,true)
- ui.addTextArea(5,"<font size='15' color='#1C3C41'><b><a href='event:cperfil'>X",to,542,99,nil,nil,"0","0",nil,true)
- end
- function removePerfil(name)
- ui.removeTextArea(2,name)
- ui.removeTextArea(3,name)
- ui.removeTextArea(4,name)
- ui.removeTextArea(5,name)
- end
- function capitalize(word)
- if word then
- if word:find("+") then
- return string.upper(word:sub(1,2)) .. string.lower (word:sub(3));
- else
- return string.upper(word:sub(1,1)) .. string.lower (word:sub(2));
- end
- end
- end
- function desbloquearT(n)
- for i,ulo in ipairs(numerodewins) do
- if data[n].puntos==ulo then
- til = #data[n].titles + 1
- table.insert(data[n].titles, til)
- ui.addPopup(0, 0, "<VP>Has desbloqueado un nuevo título! <font color='#db186d'>"..titles[til].."</font> (<font color='#BABD2F'>!title "..til.."</font>)",n, 300, 175, nil)
- end
- end
- end
- function have(x,tabla)
- for _,objetc in pairs(tabla) do
- if objetc == x then return true end
- end
- return false
- end
- function changeTitle(change, playerName)
- if have(tonumber(change),data[playerName].titles) then
- data[playerName].title = tonumber(change)
- ui.addPopup(0, 0, "<VP>Ahora tienes el título: <J>"..titles[tonumber(change)].." <VP>", playerName,300, 175, nil)
- else
- ui.addPopup(0, 0, "<n>No tienes ese título :(",playerName, 300, 175, nil)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement