World Championship Posted June 18, 2011 Posted June 18, 2011 Muy buenas a todos. Estaba experimentando con los mensajes de entrada y salida del jugador y vi que "outputChatBox" tenía tres parametros para los colores. Ya se que normalmente pongo la cantidad de rojo, verde y azul en cada parámetro pero, ¿hay alguna forma de predefinirlos para no tener que estar recordando cuales son? Claro, sin usar los códigos hexadecimales. Intente los siguiente: color = {0, 0, 0} -- Debería ser negro. Root = getRootElement() function onPlayerConnect() outputChatBox("* "..getPlayerName(source).." ha entrado al servidor.", Root, color) end addEventHandler("onPlayerJoin", Root, onPlayerConnect) Pero el mensaje sale de cualquier otro color menos negro.
ryden Posted June 18, 2011 Posted June 18, 2011 color = {0, 0, 0} -- Debería ser negro. Root = getRootElement() function onPlayerConnect() outputChatBox("* "..getPlayerName(source).." ha entrado al servidor.", Root, unpack(color)) end addEventHandler("onPlayerJoin", Root, onPlayerConnect) También puedes hacerte una función que actúe como biblioteca de colores: function color(nombre) if not colores then colores = {} colores["negro"] = { 0, 0, 0 } colores["blanco"] = { 255, 255, 255 } colores["rojo"] = { 255, 0, 0 } colores["error"] = colores["rojo"] end if not colores[nombre] then return 0, 0, 0 end return unpack(colores[nombre]) end Root = getRootElement() function onPlayerConnect() outputChatBox("* "..getPlayerName(source).." ha entrado al servidor.", Root, color("negro")) end addEventHandler("onPlayerJoin", Root, onPlayerConnect)
Recommended Posts