SP

[Resolvido] colocar cor no texto

Por Spasr, 27 de mai. de 2018 em Resolvidos

4
1.2k
SpasrS
27 de maio de 2018 às 22:46

Alguém poderia arrumar esse script para que eu possa escolher a cor que vai aparecer a msg?

 

-- by GodMarini --
local pokemons = {"Zapdos", "Moltres", "Articuno","Entei","Lugia","Ho-oh"}


function onKill(cid, target, lastHit)
    if isInArray(pokemons,getCreatureName(target)) then
        doBroadcastMessage("O jogador "..getCreatureName(cid).." derrotou o passáro lendario "..getCreatureName(target).."!")
    end
    return true


end

 

 

Dou Rep++ =D

Editado Maio 27 por Spasr

PoRaIP
27 de maio de 2018 às 23:03
Melhor resposta

0.4:

local pokemons = {"Zapdos", "Moltres", "Articuno","Entei","Lugia","Ho-oh"}

function onKill(cid, target, lastHit)
    if isInArray(pokemons, getCreatureName(target)) then
       for _, pid in pairs(getPlayersOnline()) do
          doPlayerSendTextMessage(pid, MESSAGE_TYPES["blue"], "O jogador "..getCreatureName(cid).." derrotou o passáro lendario "..getCreatureName(target).."!")
       end
    end
    return true
end

1.2:

local pokemons = {"Zapdos", "Moltres", "Articuno","Entei","Lugia","Ho-oh"}

function onKill(creature, target)
	if isInArray(pokemons, target:getName()) then
		for _, player in pairs(Game.getPlayers()) do
			player:sendTextMessage(MESSAGE_TYPES["blue"], "O jogador "..player:getName().." derrotou o passáro lendario "..target:getName().."!")
		end
	end
	return true
end


Caso dê algum erro de MESSAGE_TYPES (provavelmente na 1.2), adicione ao final do arquivo constant, na pasta data/lib do seu servidor, isso:

local MESSAGE_TYPES = {
	["advance"] = MESSAGE_EVENT_ADVANCE,
	["event"]   = MESSAGE_EVENT_DEFAULT,
	["white"]   = MESSAGE_EVENT_DEFAULT,
	["orange"]  = MESSAGE_STATUS_CONSOLE_ORANGE,
	["info"]    = MESSAGE_INFO_DESCR,
	["green"]   = MESSAGE_INFO_DESCR,
	["small"]   = MESSAGE_STATUS_SMALL,
	["blue"]    = MESSAGE_STATUS_CONSOLE_BLUE,
	["red"]     = MESSAGE_STATUS_CONSOLE_RED,
	["warning"] = MESSAGE_STATUS_WARNING,
	["status"]  = MESSAGE_STATUS_DEFAULT
}


Qualquer alteração, basta trocar no script "blue" para qualquer outro valor dessa tabela.

Editado Maio 28 por PoRaI

SpasrS
28 de maio de 2018 às 00:05

vlw cara o/

BennyB
28 de maio de 2018 às 00:09
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.