PezFenix2016 Posted April 13, 2017 Share Posted April 13, 2017 hola, pues es una pequeña duda que tengo y además un problema, nunca había trabajado con un outputChatBox en clientSide, primera vez que lo he hecho, ahora mismo estoy haciendo un pequeño script y tengo un problema y es el siguiente: outputChatBox("\n#00FF00 NOTICIAS: #ffFFff "..text1.."\n") lo que pasa es que, se supone que al ponerle los códigos HTML de colores, los debería de leer, pero no me está apareciendo el color, al contrario, cuando sale el mensaje en el chat, se muestra precisamente así: #00FF00 NOTICIAS: #ffFFfffcomo están?? a lo que quiero llegar es que, no me está mostrando los colores indicados, he visto un script que realizó alguien mas y le funciona perfectamente, lo que no entiendo es por qué a la hora de yo hacerlo no me está funcionando. Agradezco ayuda. Link to comment
Arsilex Posted April 13, 2017 Share Posted April 13, 2017 Buenas, principalmente porque no le estas diciendo al script que te lo ponga en color outputChatBox ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] ) Esa es la syntax de outputChatBox en client-side eso quiere decir que aparte del string que tu tienes definido para que aparezca en color debes de poner el colorCoded en true que por defecto esta en false. outputChatBox("\n#00FF00 NOTICIAS: #ffFFff "..text1.."\n", 231, 217, 176, true) Así te debería de funcionar a la perfección el color. Link to comment
PezFenix2016 Posted April 14, 2017 Author Share Posted April 14, 2017 3 hours ago, Arsilex said: Buenas, principalmente porque no le estas diciendo al script que te lo ponga en color outputChatBox ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] ) Esa es la syntax de outputChatBox en client-side eso quiere decir que aparte del string que tu tienes definido para que aparezca en color debes de poner el colorCoded en true que por defecto esta en false. outputChatBox("\n#00FF00 NOTICIAS: #ffFFff "..text1.."\n", 231, 217, 176, true) Así te debería de funcionar a la perfección el color. Gracias capo, otra preguntica, eso me lo está mostrando en client pero, como hago para que todos vean mi mensaje? intenté hacer trigger pero al parecer nadie lo ve excepto yo... Link to comment
Calculador Posted April 14, 2017 Share Posted April 14, 2017 2 minutes ago, PezFenix2016 said: Gracias capo, otra preguntica, eso me lo está mostrando en client pero, como hago para que todos vean mi mensaje? intenté hacer trigger pero al parecer nadie lo ve excepto yo... Si quieres que todo el mundo lo vea hazlo en server no en client. Link to comment
PezFenix2016 Posted April 14, 2017 Author Share Posted April 14, 2017 27 minutes ago, Calculador said: Si quieres que todo el mundo lo vea hazlo en server no en client. Si pero sería mucho más facil en client porque estoy trabajando con todas las variables que necesito no? en todo caso, hice un trigger pero parece que no funciona Link to comment
Calculador Posted April 14, 2017 Share Posted April 14, 2017 50 minutes ago, PezFenix2016 said: Si pero sería mucho más facil en client porque estoy trabajando con todas las variables que necesito no? en todo caso, hice un trigger pero parece que no funciona Si quieres trabajar desde el client haz un trigger no del client al server, sino del server al client, si tienes problema con el trigger postea el código para poder ayudarte. Link to comment
aka Blue Posted April 14, 2017 Share Posted April 14, 2017 Puedes usar tablas en vez de variables en server-side Link to comment
Arsilex Posted April 14, 2017 Share Posted April 14, 2017 Client-side local myText = "#00FF00 NOTICIAS: #ffFFff "..text1.."" triggerServerEvent("onClientMessage", localPlayer, myText) Server-side addEvent("onClientMessage", true) addEventHandler("onClientMessage", root, function(message) outputChatBox(message, root, 231, 217, 176, true) end) Link to comment
PezFenix2016 Posted April 14, 2017 Author Share Posted April 14, 2017 8 hours ago, Arsilex said: Client-side local myText = "#00FF00 NOTICIAS: #ffFFff "..text1.."" triggerServerEvent("onClientMessage", localPlayer, myText) Server-side addEvent("onClientMessage", true) addEventHandler("onClientMessage", root, function(message) outputChatBox(message, root, 231, 217, 176, true) end) Ah! ya entendí! ahora me funciona perfecto, gracias capo. otra pregunta y creo que la última, tengo esto: autores = {} outputs = {} informacionTotal= {} function output1() local text = guiGetText ( nombreBox ) local text1 = guiGetText ( mensajeBox ) if ( (guiCheckBoxGetSelected(staffCheck) == false) and (guiCheckBoxGetSelected(gobiernoCheck) == false) and (guiCheckBoxGetSelected(faCheck) == false) and (guiCheckBoxGetSelected(swatCheck) == false) and (guiCheckBoxGetSelected(desempleadosCheck) == false) and (guiCheckBoxGetSelected(desocupadosCheck) == false) and (guiCheckBoxGetSelected(emergencyCheck) == false) and (guiCheckBoxGetSelected(civilCheck) == false) and (guiCheckBoxGetSelected(pandillerosCheck) == false) and (guiCheckBoxGetSelected(policiasCheck) == false) and (guiCheckBoxGetSelected(criminalesCheck) == false) and (guiCheckBoxGetSelected(honourablesCheck) == false) and (guiCheckBoxGetSelected(hitCheck) == false) and (guiCheckBoxGetSelected(noticiasCheck) == true)) then if (text1 ~= "") then textito14 = "\n#00FF00NOTICIAS: #FFFFFF "..text1.."\n" triggerServerEvent("onClientMessage", localPlayer, textito14) table.insert(autores,getPlayerName(localPlayer)) table.insert(outputs,textito14) end end for k,v in ipairs(autores) do for _,i in ipairs(outputs) do cadenitaTexto = tostring(autores[v].."agregó un output cuyo texto era: "..outputs[i].."\n") table.insert(informacionTotal,cadenitaTexto) end end end addEventHandler("onClientGUIClick", showingButton, output1) function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiMemoSetCaretIndex(memoLogs,#textoString) end end function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiMemoSetCaretIndex(memoLogs,#textoString) end end Básicamente, lo que pasa es que cuando el jugador que tiene la GUI abierta, clickee en la checkbox y acto seguido llene la información de 2 edit box que hay, me mande un mensaje al outputChatBox, hasta ahí todo funciona correctamente. ahora lo que quiero hacer es que, usando tables, me guarde el nombre y el mensaje que dicho jugador ha enviado al output, todo eso en una nueva tabla que se llama "informacionTotal", para hacer una especie de "logs", luego cuando el jugador use /outputlogs, el memo que tengo vacío se llene con la información que tiene la tabla. el problema es que, el debugscript me arroja el siguiente error: ERROR: outputpanel/c.lua:310: attempt to concatenate field "?" (a nil value) y lo que no logro entender es, por qué hay un valor vacío si se supone que cuando el jugador le da click al botón de la primera gui, me guarda en una table la información que esté llenó... en donde me estaré equivocando? Link to comment
Arsilex Posted April 14, 2017 Share Posted April 14, 2017 No estoy seguro pero debería de funcionar. local autores = {} local outputs = {} local informacionTotal = {} function output1() local text = guiGetText ( nombreBox ) local text1 = guiGetText ( mensajeBox ) if ( (guiCheckBoxGetSelected(staffCheck) == false) and (guiCheckBoxGetSelected(gobiernoCheck) == false) and (guiCheckBoxGetSelected(faCheck) == false) and (guiCheckBoxGetSelected(swatCheck) == false) and (guiCheckBoxGetSelected(desempleadosCheck) == false) and (guiCheckBoxGetSelected(desocupadosCheck) == false) and (guiCheckBoxGetSelected(emergencyCheck) == false) and (guiCheckBoxGetSelected(civilCheck) == false) and (guiCheckBoxGetSelected(pandillerosCheck) == false) and (guiCheckBoxGetSelected(policiasCheck) == false) and (guiCheckBoxGetSelected(criminalesCheck) == false) and (guiCheckBoxGetSelected(honourablesCheck) == false) and (guiCheckBoxGetSelected(hitCheck) == false) and (guiCheckBoxGetSelected(noticiasCheck) == true)) then if (text1 ~= "") then textito14 = "\n#00FF00NOTICIAS: #FFFFFF "..text1.."\n" triggerServerEvent("onClientMessage", localPlayer, textito14) table.insert(autores, getPlayerName(localPlayer)) table.insert(outputs, textito14) end end for k,v in ipairs(autores) do for _,i in ipairs(outputs) do cadenitaTexto = tostring(autores[v].."agregó un output cuyo texto era: "..outputs[i].."\n") table.insert(informacionTotal, cadenitaTexto) end end end addEventHandler("onClientGUIClick", showingButton, output1) function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end Eso del error en que linea exactamente te sale? Link to comment
PezFenix2016 Posted April 14, 2017 Author Share Posted April 14, 2017 5 minutes ago, Arsilex said: No estoy seguro pero debería de funcionar. local autores = {} local outputs = {} local informacionTotal = {} function output1() local text = guiGetText ( nombreBox ) local text1 = guiGetText ( mensajeBox ) if ( (guiCheckBoxGetSelected(staffCheck) == false) and (guiCheckBoxGetSelected(gobiernoCheck) == false) and (guiCheckBoxGetSelected(faCheck) == false) and (guiCheckBoxGetSelected(swatCheck) == false) and (guiCheckBoxGetSelected(desempleadosCheck) == false) and (guiCheckBoxGetSelected(desocupadosCheck) == false) and (guiCheckBoxGetSelected(emergencyCheck) == false) and (guiCheckBoxGetSelected(civilCheck) == false) and (guiCheckBoxGetSelected(pandillerosCheck) == false) and (guiCheckBoxGetSelected(policiasCheck) == false) and (guiCheckBoxGetSelected(criminalesCheck) == false) and (guiCheckBoxGetSelected(honourablesCheck) == false) and (guiCheckBoxGetSelected(hitCheck) == false) and (guiCheckBoxGetSelected(noticiasCheck) == true)) then if (text1 ~= "") then textito14 = "\n#00FF00NOTICIAS: #FFFFFF "..text1.."\n" triggerServerEvent("onClientMessage", localPlayer, textito14) table.insert(autores, getPlayerName(localPlayer)) table.insert(outputs, textito14) end end for k,v in ipairs(autores) do for _,i in ipairs(outputs) do cadenitaTexto = tostring(autores[v].."agregó un output cuyo texto era: "..outputs[i].."\n") table.insert(informacionTotal, cadenitaTexto) end end end addEventHandler("onClientGUIClick", showingButton, output1) function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end Eso del error en que linea exactamente te sale? dice que en la línea 310, pero debe ser en la que uso el table.concat Link to comment
Arsilex Posted April 14, 2017 Share Posted April 14, 2017 Has probado el código? Que te he posteado Link to comment
PezFenix2016 Posted April 14, 2017 Author Share Posted April 14, 2017 2 minutes ago, Arsilex said: Has probado el código? Que te he posteado Si, me sigue tirando el mismo error: ERROR: outputpanel/c.lua:310: attempt to concatenate field "?" (a nil value) la línea 310 es la que contiene esta parte del código cadenitaTexto = autores[v].."agregó un output cuyo texto era: "..outputs.."\n" pero creo que el error me la debe estár causando esta local textoString = table.concat(informacionTotal) Link to comment
Arsilex Posted April 14, 2017 Share Posted April 14, 2017 local autores = {} local outputs = {} local informacionTotal = {} function output1() local text = guiGetText ( nombreBox ) local text1 = guiGetText ( mensajeBox ) if ( (guiCheckBoxGetSelected(staffCheck) == false) and (guiCheckBoxGetSelected(gobiernoCheck) == false) and (guiCheckBoxGetSelected(faCheck) == false) and (guiCheckBoxGetSelected(swatCheck) == false) and (guiCheckBoxGetSelected(desempleadosCheck) == false) and (guiCheckBoxGetSelected(desocupadosCheck) == false) and (guiCheckBoxGetSelected(emergencyCheck) == false) and (guiCheckBoxGetSelected(civilCheck) == false) and (guiCheckBoxGetSelected(pandillerosCheck) == false) and (guiCheckBoxGetSelected(policiasCheck) == false) and (guiCheckBoxGetSelected(criminalesCheck) == false) and (guiCheckBoxGetSelected(honourablesCheck) == false) and (guiCheckBoxGetSelected(hitCheck) == false) and (guiCheckBoxGetSelected(noticiasCheck) == true)) then if (text1 ~= "") then textito14 = "\n#00FF00NOTICIAS: #FFFFFF "..text1.."\n" triggerServerEvent("onClientMessage", localPlayer, textito14) table.insert(autores, getPlayerName(localPlayer)) table.insert(outputs, textito14) end end for k,v in ipairs(autores) do for _,i in ipairs(outputs) do cadenitaTexto = tostring(v.."agregó un output cuyo texto era: "..i.."\n") table.insert(informacionTotal, cadenitaTexto) end end end addEventHandler("onClientGUIClick", showingButton, output1) function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end Link to comment
PezFenix2016 Posted April 14, 2017 Author Share Posted April 14, 2017 5 minutes ago, Arsilex said: local autores = {} local outputs = {} local informacionTotal = {} function output1() local text = guiGetText ( nombreBox ) local text1 = guiGetText ( mensajeBox ) if ( (guiCheckBoxGetSelected(staffCheck) == false) and (guiCheckBoxGetSelected(gobiernoCheck) == false) and (guiCheckBoxGetSelected(faCheck) == false) and (guiCheckBoxGetSelected(swatCheck) == false) and (guiCheckBoxGetSelected(desempleadosCheck) == false) and (guiCheckBoxGetSelected(desocupadosCheck) == false) and (guiCheckBoxGetSelected(emergencyCheck) == false) and (guiCheckBoxGetSelected(civilCheck) == false) and (guiCheckBoxGetSelected(pandillerosCheck) == false) and (guiCheckBoxGetSelected(policiasCheck) == false) and (guiCheckBoxGetSelected(criminalesCheck) == false) and (guiCheckBoxGetSelected(honourablesCheck) == false) and (guiCheckBoxGetSelected(hitCheck) == false) and (guiCheckBoxGetSelected(noticiasCheck) == true)) then if (text1 ~= "") then textito14 = "\n#00FF00NOTICIAS: #FFFFFF "..text1.."\n" triggerServerEvent("onClientMessage", localPlayer, textito14) table.insert(autores, getPlayerName(localPlayer)) table.insert(outputs, textito14) end end for k,v in ipairs(autores) do for _,i in ipairs(outputs) do cadenitaTexto = tostring(v.."agregó un output cuyo texto era: "..i.."\n") table.insert(informacionTotal, cadenitaTexto) end end end addEventHandler("onClientGUIClick", showingButton, output1) function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end function mostrarLogs() if (guiGetVisible(ventanaLogs) == true) then local textoString = table.concat(informacionTotal) guiSetText(memoLogs, textoString) end end Ok parece que el error se ha quitado, pero ahora cuando uso /outputlogs no me muestra nada, sería mejor meterlo en un xml y luego mostrarlo directamente en el memo? Link to comment
Arsilex Posted April 14, 2017 Share Posted April 14, 2017 Si lo que quieres es guardar el texto es decir que cunado el script se reinicie o algo se guarde aun asi es mejor guardarlo en alguna parte ya sea XML para cargarlo cuando se apague el script ya que las array son temporales. Link to comment
PezFenix2016 Posted April 14, 2017 Author Share Posted April 14, 2017 2 minutes ago, Arsilex said: Si lo que quieres es guardar el texto es decir que cunado el script se reinicie o algo se guarde aun asi es mejor guardarlo en alguna parte ya sea XML para cargarlo cuando se apague el script ya que las array son temporales. Está bien, y para guardarlo en un xml simplemente lo creo y, para llamarlo al Client que puedo utilizar? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now