Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 16/08/2015
- --Last update: 15/05/2016
- --[[ Notes:
- Does:
- Altera a cor do nome de um jogador.
- Commands:
- !
- namecolor
- * --> Todos os jogadores
- Player
- cor --> Insere cor na cor de Player ou *
- ? --> Cor aleatória.
- * --> Cor aleatória.
- rand --> Cor aleatória.
- picker --> Abre uma tabela de cores para que você selecione a cor.
- loop --> Loop de cores aleatórias infinitas
- stop
- looping --> Interrompe o loop de cores aleatórias
- Player
- loop --> Para com o loop de cores aleatórias de player
- colors --> Volta com a cor normal de nickaname para todos os jogadores
- ]]--
- adm = {Bolodefchoco=1} -- Para usar os comandos, substitua Bolodefchoco e coloque seu nickname no lugar.
- string.nick=function(player)
- return player:lower():gsub('%a',string.upper,1)
- end
- mice={}
- eventNewPlayer=function(n)
- mice[n] = {
- color = 0,
- rand = false,
- player = ""
- }
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
- looping = false
- eventChatCommand=function(n,c)
- if adm[n] then
- local p = {}
- for val in c:gmatch("[^%s]+") do table.insert(p,val) end
- if p[1]:lower() == "namecolor" then
- mice[n].player = ""
- if p[3]:lower() ~= "picker" and p[3]:lower() ~= "loop" then
- local color = ""
- if p[3]:find("^%x") then
- color = p[3]
- elseif p[3] == "?" or p[3] == "*" or p[3] == "rand" then
- color = math.random(0x0000000,0xFFFFFF)
- end
- if color ~= "" then
- if p[2] == "*" then
- for n in next,tfm.get.room.playerList do
- tfm.exec.setNameColor(n,color)
- mice[n].color = color
- end
- else
- p[2] = string.nick(p[2])
- if tfm.get.room.playerList[p[2]] then
- tfm.exec.setNameColor(p[2],color)
- mice[n].color = color
- end
- end
- end
- else
- if p[3]:lower() == "picker" then
- if p[2] == "*" then
- ui.showColorPicker(0,n,1)
- else
- p[2] = string.nick(p[2])
- if tfm.get.room.playerList[p[2]] then
- mice[n].player = p[2]
- ui.showColorPicker(1,n,mice[p[2]].color)
- end
- end
- end
- if p[3]:lower() == "loop" then
- if p[2] == "*" then
- looping = true
- else
- p[2] = string.nick(p[2])
- if tfm.get.room.playerList[p[2]] then
- mice[p[2]].loop = true
- end
- end
- end
- end
- end
- if p[1]:lower() == "stop" then
- if p[2] == "looping" then
- looping = false
- elseif p[3] == "loop" then
- p[2] = string.nick(p[2])
- if tfm.get.room.playerList[p[2]] then
- mice[p[2]].loop = false
- end
- elseif p[2] == "colors" then
- for n in next,tfm.get.room.playerList do
- tfm.exec.setNameColor(n,0)
- mice[n].color = 0
- end
- end
- end
- end
- end
- eventLoop=function()
- for n in next,tfm.get.room.playerList do
- if mice[n].loop or looping then
- tfm.exec.setNameColor(n,math.random(0x000000,0xFFFFFF))
- end
- end
- end
- eventColorPicked=function(i,n,c)
- if i == 0 then
- for k in next,tfm.get.room.playerList do
- tfm.exec.setNameColor(k,c)
- mice[k].color = c
- end
- end
- if i == 1 then
- tfm.exec.setNameColor(mice[n].player,c)
- mice[mice[n].player].color = c
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement