Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local data = {}
- function eventNewPlayer(name)
- if not data[name] then
- data[name]={}
- data[name].puntos = 0
- data[name].muertes = 0
- 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
- 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)
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement